Login

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

Author:
jasonyan
Posted:
May 18, 2011
Language:
Python
Version:
1.2
Score:
0 (after 0 ratings)

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

Anyone has any suggestion? Thanks.

 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. Template tag - list punctuation for a list of items by shapiromatron 3 months, 1 week ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 3 months, 2 weeks ago
  3. Serializer factory with Django Rest Framework by julio 10 months, 2 weeks ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 11 months ago
  5. Help text hyperlinks by sa2812 12 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.

#

Please login first before commenting.