various fixes
This commit is contained in:
parent
404516d677
commit
cb35666f0e
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -1,15 +0,0 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredPackages">
|
||||
<value>
|
||||
<list size="2">
|
||||
<item index="0" class="java.lang.String" itemvalue="dotenv" />
|
||||
<item index="1" class="java.lang.String" itemvalue="psycopg2" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="file://$PROJECT_DIR$" libraries="{bootstrap, jquery-3.2.1.slim, jquery-3.3.1, popper, select2, tabulator}" />
|
||||
</component>
|
||||
</project>
|
24
README.md
24
README.md
@ -1,8 +1,16 @@
|
||||
# Recipies
|
||||
Recipes is a Django application that allows tagging of arbitrary numbers of recipes (or in fact any other file) in a storage backend.
|
||||
It also allows the easy creation of recipes directly on the page.
|
||||
Currently the only supported storage backend is dropbox, but this can easily be changed as the system is modular and
|
||||
already has fields to support different backends.
|
||||
# Recipes
|
||||
Recipes is a django application to manage, tag and search recipes using either built in models or external storage providers hosting PDF's, Images or other files.
|
||||
|
||||
|
||||
|
||||
<u>Features</u>
|
||||
|
||||
- Sync files with Dropbox and Nextcloud (more can easily be added)
|
||||
- Create and search for tags, assign them in batch to all files matching certain filters
|
||||
- Create recipes locally within a nice, standardized webinterface
|
||||
- Share recipes with friends and comment on them to suggest or remember changes you made
|
||||
|
||||
This application is meant for people with a collection of recipes they want to share with family and friends or simply store them in a nicely organized way. A basic permission System will be implemented but this is not meant as a public website.
|
||||
|
||||
## Usage
|
||||
Most things should be straight forward but there are some more complicated things.
|
||||
@ -21,8 +29,7 @@ Then enter the path you want to monitor starting at the storage root (e.g. `/Fol
|
||||
##### Syncing Data
|
||||
To sync the recipes app with the storage backends press `Sync now` under `Manage Data >> Configure Sync`.
|
||||
##### Import Recipes
|
||||
All files found by the sync can be found under `Manage Data >> Import recipes`. There you can either import all at once without
|
||||
modifying them or import one by one, adding Category and Tags while importing.
|
||||
All files found by the sync can be found under `Manage Data >> Import recipes`. There you can either import all at once without modifying them or import one by one, adding Category and Tags while importing.
|
||||
##### Batch Edit
|
||||
If you have many untagged recipes you may want to edit them all at once. For this go to
|
||||
`Manage Data >> Batch Edit`. Enter a word which should be contained in the recipe name and select the tags you want to apply.
|
||||
@ -57,5 +64,4 @@ To start developing:
|
||||
Pull Requests and ideas are welcome, feel free to contribute in any way.
|
||||
|
||||
## License
|
||||
This project is licensed under the MIT license. Even though it is not required to publish derivatives i highly encourage
|
||||
pushing changes upstream and letting people profit from any work done on this project.
|
||||
This project is licensed under the MIT license. Even though it is not required to publish derivatives i highly encourage pushing changes upstream and letting people profit from any work done on this project.
|
18
cookbook/migrations/0012_auto_20191118_1251.py
Normal file
18
cookbook/migrations/0012_auto_20191118_1251.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.7 on 2019-11-18 11:51
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cookbook', '0011_recipe_time'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='recipe',
|
||||
name='time',
|
||||
field=models.IntegerField(default=0),
|
||||
),
|
||||
]
|
@ -61,7 +61,7 @@ class Recipe(models.Model):
|
||||
file_path = models.CharField(max_length=512, default="")
|
||||
link = models.CharField(max_length=512, default="")
|
||||
keywords = models.ManyToManyField(Keyword, blank=True)
|
||||
time = models.IntegerField(blank=True)
|
||||
time = models.IntegerField(default=0)
|
||||
internal = models.BooleanField(default=False)
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -86,8 +86,7 @@
|
||||
<form method="POST" class="post-form">
|
||||
{% csrf_token %}
|
||||
<div class="input-group mb-3">
|
||||
<textarea name="text" cols="15" rows="2" class="textarea form-control" required id="id_text">
|
||||
</textarea>
|
||||
<textarea name="text" cols="15" rows="2" class="textarea form-control" required id="id_text"></textarea>
|
||||
<div class="input-group-append">
|
||||
<input type="submit" value="{% trans 'Comment' %}" class="btn btn-success">
|
||||
</div>
|
||||
|
@ -52,7 +52,8 @@ def internal_recipe_update(request, pk):
|
||||
else:
|
||||
form = InternalRecipeForm(instance=recipe_instance)
|
||||
|
||||
return render(request, 'forms/edit_internal_recipe.html', {'form': form, 'view_url': reverse('view_recipe', args=[pk])})
|
||||
return render(request, 'forms/edit_internal_recipe.html',
|
||||
{'form': form, 'view_url': reverse('view_recipe', args=[pk])})
|
||||
|
||||
|
||||
class SyncUpdate(LoginRequiredMixin, UpdateView):
|
||||
@ -103,6 +104,40 @@ class StorageUpdate(LoginRequiredMixin, UpdateView):
|
||||
return context
|
||||
|
||||
|
||||
@login_required
|
||||
def edit_storage(request, pk):
|
||||
instance = get_object_or_404(Storage, pk=pk)
|
||||
|
||||
if request.method == "POST":
|
||||
form = StorageForm(request.POST)
|
||||
if form.is_valid():
|
||||
instance.name = form.cleaned_data['name']
|
||||
instance.method = form.cleaned_data['method']
|
||||
instance.username = form.cleaned_data['username']
|
||||
instance.url = form.cleaned_data['url']
|
||||
|
||||
if form.cleaned_data['password'] != '__NO__CHANGE__':
|
||||
instance.password = form.cleaned_data['password']
|
||||
|
||||
if form.cleaned_data['token'] != '__NO__CHANGE__':
|
||||
instance.token = form.cleaned_data['token']
|
||||
|
||||
instance.save()
|
||||
|
||||
messages.add_message(request, messages.SUCCESS, _('Storage saved!'))
|
||||
return HttpResponseRedirect(reverse('edit_storage', args=[pk]))
|
||||
else:
|
||||
messages.add_message(request, messages.ERROR, _('There was an error updating this storage backend.!'))
|
||||
else:
|
||||
pseudo_instance = instance
|
||||
pseudo_instance.password = '__NO__CHANGE__'
|
||||
pseudo_instance.token = '__NO__CHANGE__'
|
||||
form = InternalRecipeForm(instance=pseudo_instance)
|
||||
|
||||
return render(request, 'forms/edit_internal_recipe.html',
|
||||
{'form': form, 'view_url': reverse('view_recipe', args=[pk])})
|
||||
|
||||
|
||||
class CommentUpdate(LoginRequiredMixin, UpdateView):
|
||||
template_name = "generic/edit_template.html"
|
||||
model = Comment
|
||||
|
Loading…
Reference in New Issue
Block a user