Re: Storing IP address as integer within database to remove need for full text search

2011-07-18 Thread Dmitry Gladkov
I like the idea, but I don't like the approach, it should be a subclass of PositiveIntegerField, as it is an unsigned int on DB level. Also, I agree with Łukasz that it should support both IPv6 and IPv4. -- Best wishes, Dmitry Gladkov, mailto:dmitry.glad...@gmail.com +380 91 303-37-46 On Mon

How to make Form and ModelForm choise fields to pick first entry in queryset by default?

2009-09-14 Thread Dmitry Gladkov
By default Django make select options like this: - admin Testuser How to enforce Django to show it like this: admin Testuser I've managed to do so playing with form properties in view but that looked ugly (unfortunately I've lost the code example but you can trust me:))

Re: post_save signal to create the new user profile

2009-09-13 Thread Dmitry Gladkov
): Employee.objects.get_or_create(user=instance) models.signals.post_save.connect(user_post_save, sender=User) Now i get IntegrityError at /admin/auth/user/add/ column username is not unique On Sep 13, 3:12 pm, Dmitry Gladkov <dmitry.glad...@gmail.com> wrote: > Hi! > > I've got user profile, that uses multi-ta

post_save signal to create the new user profile

2009-09-13 Thread Dmitry Gladkov
Hi! I've got user profile, that uses multi-table inheritance: class Employee(User): address = models.CharField(max_length=50, null=True, blank=True) phone1 = models.CharField(max_length=15, null=True, blank=True) phone2 = models.CharField(max_length=15, null=True, blank=True)

Multiple data formats for one view

2009-08-05 Thread Dmitry Gladkov
Hello, What is the best Django-way to create multiple data formats for one view as in Ruby On Rails? For example, "articles.json" and "articles.xml" will serialize response object to json or xml representation, and articles.html will render to articles.html template. Thanks, Dmitry