Re: get_or_create gave IntegrityError: (1062, "Duplicate entry) error sometimes

2012-10-15 Thread Zheng Li
Oct 15, 2012 at 9:43 AM, Tom Evans <tevans...@googlemail.com> wrote: >>> >>> On Mon, Oct 15, 2012 at 1:50 PM, Zheng Li <dllizh...@gmail.com> wrote: >>>> get_or_create shouldn't give duplicate entry error >>>> anyone help. >>>&

Re: get_or_create gave IntegrityError: (1062, "Duplicate entry) error sometimes

2012-10-15 Thread Zheng Li
get_or_create shouldn't give duplicate entry error anyone help. On 2012/10/13, at 11:06, Wei Wei wrote: > I am new to Django. But does the error message literally mean you have > duplicated records against your unique_together constriction? > > On Sat, Oct 13, 2012 at 9:47 AM, Zhen

get_or_create gave IntegrityError: (1062, "Duplicate entry) error sometimes

2012-10-12 Thread Zheng Li
class AB(models.Model): a = models.ForeignKey(A) b = models.ForeignKey(B) c = models.IntegerField(default=0) d = models.FloatField(default=0) e = models.IntegerField(default=0) f = models.FloatField(default=0) class Meta: unique_together = (('a', 'b'),) I have

how to suppress ForeignKey related query

2012-06-04 Thread Zheng Li
I have a class class PlayerSoul(ModelAbstract, ModelBatchSaveHelper): player = models.ForeignKey(Player) .. When I call PlayerSoul.objects.all() PlayerSoul.objects.get() there is always an additional query for Player. Can I delay the query for Player until I really

why can not request context be accessed in filter

2012-04-15 Thread Zheng Li
if there any reason that request context can NOT be accessed in a filter? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to

Re: question about "\d" in url pattern

2012-02-28 Thread Zheng Li
thank you very much On 2012/02/28, at 0:37, Justin Myers wrote: > On Feb 27, 1:44 am, Masklinn <maskl...@masklinn.net> wrote: >> On 27 févr. 2012, at 07:23, Zheng Li <dllizh...@gmail.com> wrote: >>> i thought "\d+" in url promises i can get an int poi

question about "\d" in url pattern

2012-02-26 Thread Zheng Li
url(r'^friend_page/cheer/confirm/(?P\w+)/(?P\d+)/(?P\d+)/$', 'cheer_confirm', name = 'friend_page'), def cheer_confirm(request, fid, key, point): data = { 'point' : 10 + point, } ... i got TypeError: unsupported operand type(s) for +: 'int' and 'unicode' i

Re: Beginner questions: on the official polls tutorial

2011-01-05 Thread Zheng Li
Thank you, Shawn. On Wed, Jan 5, 2011 at 8:24 PM, Shawn Milochik wrote: > 1. When you were running the development server, you were probably > executing from the www directory, so importing from 'mysite' would work. > When running in production, it has to be properly on the