Replies: 2 comments
-
Sorry, I missed this message from a while ago. There isn't a current way to use the built-in Django form-rendering, so you have to write the HTML manually unfortunately. https://docs.djangoproject.com/en/4.1/topics/forms/#rendering-fields-manually has information around that. Instead of
you could do something like:
That should take the |
Beta Was this translation helpful? Give feedback.
-
Hello there. `#memberslist.py from pprint import pprint from members.models import Kid class EditForm(forms.ModelForm): class MemberslistView(UnicornView):
`#models.py class Kid(ModelMixin):
` ` Edit Data
FIRST NAME
LAST NAME
MIDDLE NAME
NICK NAME
STATE OF ORIGIN
Choose...
{% for state in states %}
{{state.name}}
{% endfor %}
ADDRESS
SEX
Choose...
{% for sex in sexes %}
{{sex.name}}
{% endfor %}
{{'Class'|upper}}
Choose...
{% for age_group_class in age_group_classes %}
{{age_group_class.name}}
{% endfor %}
{{'Date Of Birth'|upper}}
{{'Join Date'|upper}}
Check me out
Close
Save changes
`#the error in console ` |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am playing around with django-unicorn and I am not sure how to integrate it properly with django ModelForm. Let's say that I want a list of objects with edit button and after a click on the edit button, modal with prefilled form is opened.
I started with a template like this:
and following view:
I am aware of that form.as_p will not work and somehow I need to add
unicorn:model
to the input fields but first of all, I am not sure how to pre-fill the form with some data.Beta Was this translation helpful? Give feedback.
All reactions