mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 05:11:31 -05:00
added option to choose webdav path
This commit is contained in:
@@ -238,7 +238,7 @@ class StorageForm(forms.ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Storage
|
||||
fields = ('name', 'method', 'username', 'password', 'token', 'url')
|
||||
fields = ('name', 'method', 'username', 'password', 'token', 'url', 'path')
|
||||
|
||||
help_texts = {
|
||||
'url': _('Leave empty for dropbox and enter only base url for nextcloud (<code>/remote.php/webdav/</code> is added automatically)'), # noqa: E501
|
||||
|
||||
18
cookbook/migrations/0101_storage_path.py
Normal file
18
cookbook/migrations/0101_storage_path.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.5 on 2021-01-22 18:57
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0100_recipe_servings_text'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='storage',
|
||||
name='path',
|
||||
field=models.CharField(blank=True, default='', max_length=256),
|
||||
),
|
||||
]
|
||||
@@ -124,6 +124,7 @@ class Storage(models.Model):
|
||||
password = models.CharField(max_length=128, blank=True, null=True)
|
||||
token = models.CharField(max_length=512, blank=True, null=True)
|
||||
url = models.URLField(blank=True, null=True)
|
||||
path = models.CharField(blank=True, default='', max_length=256)
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
@@ -20,6 +20,8 @@ class Nextcloud(Provider):
|
||||
'webdav_password': storage.password,
|
||||
'webdav_root': '/remote.php/dav/files/' + storage.username
|
||||
}
|
||||
if storage.path != '':
|
||||
options['webdav_root'] = storage.path
|
||||
return wc.Client(options)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -402,7 +402,7 @@ def get_recipe_file(request, recipe_id):
|
||||
|
||||
@group_required('user')
|
||||
def sync_all(request):
|
||||
if DEMO or True:
|
||||
if DEMO:
|
||||
messages.add_message(
|
||||
request, messages.ERROR, _('This feature is not available in the demo version!')
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user