Tuesday, July 25, 2017

Re: Adding code when pressing one of admin's save buttons

Try using 'def save(self):' on your models.
When you save a new record, this will be executed, so if you hit any button, you are saving in anyway and the code will be executed.

Just my cents about your question.


2017-07-25 8:29 GMT-03:00 ron_w_add via Django users <django-users@googlegroups.com>:

I am using Django's admin interface to create new records. A record includes (amongst other fields) the date and time that a photo was taken. These fields will be filled into the database when either the 'Save and add another', 'Save and continue editing' or the 'Save' buttons are pressed (i.e. these details will be read from the image file and entered into the database rather than the administrator doing this manually).

 

How can I added the extra code required to add the date and time when I press one of these buttons? Some example code would be appreciated.

 

Thanks

--
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-users@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/63559d9c-15c6-4ce1-b477-8e24b030ce0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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-users@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/CACTnJ001etLw57wChAeEKJWVKqTVuQtcjgJoSDGAedjoEzXouQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment