Hi folks,
Here i am eager to find out why django render model dateField type as text 
??

<input type="text" ...>

instead of 
<input type="date" ...>

*Is there any alternative or inbuilt method to render datefield as date ?*


This is my code

*models.py*
    class HumanUser(AbstractUser):
        birth_date = models.DateField(null=True, blank=True, verbose_name=u
"DOB")


*forms.py*
class profile_form(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        kwargs.setdefault('label_suffix', '')
        super(profile_form, self).__init__(*args, **kwargs)
        for field in self.fields:
            self.fields[field].widget.attrs.update({'class': 'form-control 
form-control-line', })

    class Meta:
        model = User
        fields = [
            'full_name',
            'birth_date',
            'mobile',
            'bio',
            'gender',
        ]


*HTML output*

<input type="text" name="birth_date" class="form-control form-control-line" 
id="id_birth_date" />



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/caa35f1c-3a8e-4e45-954b-14876efdf8db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to