When saving in admin it will call model save() twice.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
class MyModel(models):
  myfield = modesl.CharField(max_length=100)

  def save(self, *args, **kwargs)
      super(MyModel, self).save(*args, **wargs)
      print 'save!!'


When I save this in admin, it will call model save() twice

Django version 1.2.3, using settings 'admin.development'
Development server is running at http://127.0.0.1:8080/
Quit the server with CONTROL-C.
[18/May/2011 10:08:22] "GET /admin/onixcodes/bookbatch/ HTTP/1.1" 200 38211
[18/May/2011 10:08:22] "GET /admin/jsi18n/ HTTP/1.1" 200 4256
[18/May/2011 10:08:29] "GET /admin/onixcodes/bookbatch/55/ HTTP/1.1" 200 9811
[18/May/2011 10:08:29] "GET /admin/jsi18n/ HTTP/1.1" 200 4256
save!!
save!!
[18/May/2011 10:08:33] "POST /admin/onixcodes/bookbatch/55/ HTTP/1.1" 302 0
[18/May/2011 10:08:33] "GET /admin/onixcodes/bookbatch/ HTTP/1.1" 200 38364
[18/May/2011 10:08:33] "GET /admin/jsi18n/ HTTP/1.1" 200 4256

More like this

  1. Group results by a range of values in admin sidebar by wgollino 6 years, 2 months ago
  2. Moving items up/down from the admin interface by vicox 5 years, 7 months ago
  3. Context processor for django admin app_list by alexander 4 years, 2 months ago
  4. Get actual child model in multi-table inheritance by bronger 3 years, 9 months ago
  5. Custom management command to list recent admin actions by pbx 4 years, 9 months ago

Comments

danielroseman (on May 23, 2011):

This is not a Q&A site. Please delete this and repost it on Django-users or Stackoverflow.

#

(Forgotten your password?)