Rendering Foreign Key in Django

1

I am using CreateView in django and rendering my components with tweak widget would like to know if there is any way to swap this first combo option

rendered form in the template

{% render_field form.category class="form-control" %}

    
asked by anonymous 10.07.2017 / 03:01

1 answer

0

You can use initial , see:

>>> import datetime
>>> class DateForm(forms.Form):
...     day = forms.DateField(initial=datetime.date.today)

Or so for a text:

>>> class CommentForm(forms.Form):
...     name = forms.CharField()
...     url = forms.URLField()
...     comment = forms.CharField()
>>> default_data = {'name': 'Your name', 'url': 'http://'}
>>> f = CommentForm(default_data, auto_id=False)
    
10.07.2017 / 03:11