24 lines
743 B
Python
24 lines
743 B
Python
from crispy_forms.helper import FormHelper
|
|
from crispy_forms.layout import Submit, Hidden, HTML
|
|
from django import forms
|
|
from django.urls import reverse_lazy
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from idescriptor.models import Image
|
|
|
|
|
|
class ImageForm(forms.ModelForm):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
self.helper = FormHelper()
|
|
self.helper.form_id = 'form-describe-image'
|
|
self.helper.form_class = ''
|
|
self.helper.form_method = 'post'
|
|
self.helper.add_input(Hidden("action", "add_image_details"))
|
|
self.helper.add_input(Submit('submit', _('Submit')))
|
|
|
|
class Meta:
|
|
model = Image
|
|
fields = ('title', 'alt_text')
|