changed emoji widget
This commit is contained in:
parent
efabed8b2a
commit
417e372c42
@ -1,6 +1,7 @@
|
||||
from django import forms
|
||||
from django.forms import widgets
|
||||
from django.utils.translation import gettext as _
|
||||
from emoji_picker.widgets import EmojiPickerTextInput
|
||||
|
||||
from .models import *
|
||||
|
||||
@ -10,11 +11,6 @@ class MultiSelectWidget(widgets.SelectMultiple):
|
||||
js = ('custom/js/form_multiselect.js',)
|
||||
|
||||
|
||||
class EmojiWidget(forms.TextInput):
|
||||
class Media:
|
||||
js = ('custom/js/form_emoji.js',)
|
||||
|
||||
|
||||
class ExternalRecipeForm(forms.ModelForm):
|
||||
file_path = forms.CharField(disabled=True, required=False)
|
||||
storage = forms.ModelChoiceField(queryset=Storage.objects.all(), disabled=True, required=False)
|
||||
@ -65,7 +61,7 @@ class KeywordForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Keyword
|
||||
fields = ('name', 'icon', 'description')
|
||||
widgets = {'icon': EmojiWidget}
|
||||
widgets = {'icon': EmojiPickerTextInput}
|
||||
|
||||
|
||||
class StorageForm(forms.ModelForm):
|
||||
|
@ -45,11 +45,6 @@
|
||||
<!-- Fontawesome icons -->
|
||||
<link rel="stylesheet" href="{% static "fontawesome/fontawesome_all.min.css" %}">
|
||||
|
||||
<!-- Emojiara stuff for emoji select -->
|
||||
<!--TODO refactor and look for better solution -->
|
||||
<link rel="stylesheet" href="{% static "emojionearea/emojionearea.min.css" %}">
|
||||
<script type="text/javascript" src="{% static "emojionearea/emojionearea.min.js" %}"></script>
|
||||
|
||||
{% block extra_head %} <!-- block for templates to put stuff into header -->
|
||||
{% endblock %}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col col-md-9">
|
||||
<h5 class="card-title">{% trans 'Ingredients' %}</h5>
|
||||
<h4 class="card-title">{% trans 'Ingredients' %}</h4>
|
||||
</div>
|
||||
<div class="col col-md-3">
|
||||
|
||||
|
@ -232,6 +232,11 @@ class RecipeDelete(LoginRequiredMixin, DeleteView):
|
||||
model = Recipe
|
||||
success_url = reverse_lazy('index')
|
||||
|
||||
def form_valid(self, form):
|
||||
self.object = form.save(commit=False)
|
||||
|
||||
return super(RecipeDelete, self).form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(RecipeDelete, self).get_context_data(**kwargs)
|
||||
context['title'] = _("Recipe")
|
||||
|
@ -50,6 +50,7 @@ INSTALLED_APPS = [
|
||||
'django_tables2',
|
||||
'django_filters',
|
||||
'crispy_forms',
|
||||
'emoji_picker',
|
||||
'rest_framework',
|
||||
'cookbook.apps.CookbookConfig',
|
||||
]
|
||||
|
@ -4,6 +4,7 @@ django-filter
|
||||
django-crispy-forms
|
||||
djangorestframework
|
||||
django-autocomplete-light
|
||||
django-emoji-picker
|
||||
six
|
||||
requests
|
||||
markdown
|
||||
|
Loading…
Reference in New Issue
Block a user