CreateView autoset field

23 views
Skip to first unread message

Ferdinand Rohlfing

unread,
Apr 14, 2018, 8:39:24 AM4/14/18
to Django users
How can a create a field with a automatically input?

Like setting the date automatically to datetime.now()?

Samuel Muiruri

unread,
Apr 14, 2018, 9:51:28 AM4/14/18
to Django users
on the models for example info = models.CharField(max_length=100, default='West Indiana')

Ferdinand Rohlfing

unread,
Apr 14, 2018, 10:02:39 AM4/14/18
to Django users
Thanks for the answer, it's working like I want it to work...
Nice

DYAA CHBIB

unread,
Apr 14, 2018, 3:26:57 PM4/14/18
to django...@googlegroups.com
I did the same, but it does not displayed in the field ! Any advice?
Thanks

2018-04-14 16:02 GMT+02:00 'Ferdinand Rohlfing' via Django users <django...@googlegroups.com>:
Thanks for the answer, it's working like I want it to work...
Nice

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/565c773c-4c09-4b98-a4e0-76bac19bab73%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Samuel Muiruri

unread,
Apr 16, 2018, 2:05:57 AM4/16/18
to django...@googlegroups.com
did you make the migration, also note it's the default if a new item is created with the field blank.

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/0QrMLT33NB4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--
Best Regards,
Samuel Muiruri.
Student in Machine Learning & a veteran web developer.
Reply all
Reply to author
Forward
0 new messages