possible bug with onetoone relationship and psycopg2
Looking for someone to check into this, before i submit problem is with __isnull=False handling backend is psycopg2 tables: class Person(models.Model): name = models.CharField(max_length=60) surname = models.CharField(max_length=60) class SampleTest(models.Model): person = models.OneToOneField(Person,primary_key=True) entry_date = models.DateField() from django.db import connection Person.objects.filter(sampletest__isnull=True)[0] print connection.queries [SQL OK] Person.objects.filter(sampletest__isnull=False)[0] print connection.queries now note that person table doesnt even try to join sampletest table ... Person.objects.filter(sampletest__isnull=False)[0].sampletest throws DoesNotExist exception -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: best practice to construct 10x10 grid
yes it is On Jan 29, 11:58 am, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote: > On 29-Jan-08, at 4:18 PM, sircco wrote: > > > I have grid 10x10 populated with int>0. > > is the size fixed? > > -- > > regards > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/ > Foss Conference for the common man:http://registration.fossconf.in/web/ --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
best practice to construct 10x10 grid
I have grid 10x10 populated with int>0. Currently I'm avoiding modelforms all together and doing my own processing, definining it as array and rendering with loop, custom checking with my own validators outside of database Model. Any hints how to standardize it and move to django way of thinking? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: i18n and choices from database
tnx, works even with internationalized data! Damir On Nov 3, 7:38 pm, RajeshD <[EMAIL PROTECTED]> wrote: > > Question is how to show query from database on template with localized > > output > > Try this in your template (assuming p is a person model instance > available to your template): > > {{ p.get_gender_display }} > > See:http://www.djangoproject.com/documentation/db-api/#get-foo-display > > Also, another suggestion: consider using more intuitive keys for your > gender field instead of 0, 1. You could define it as a CharField and > change choices keys to M, F instead of 0, 1 (or even better "male", > "female"). If you're worried about performance, you can even set > db_index=True on the gender field. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
i18n and choices from database
lets say i have a model from django.utils.translation import ugettext_lazy as _ class Person (models.Model): GENDER = ( (0, _('Male'), (1,_('Female') ) name = models.CharField(maxlength=100) gender = models.IntegerField(choices=GENDER) and i show it on the form with localized output after submit i get values ( 0,"name" ) in the database. Question is how to show query from database on template with localized output TIA, Damir --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
i18n and choices from database
lets say i have model . . class Person (models.Model): CHOICE = ( (0,_("m"), (1,_("f")) gender = models.IntegerField( --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---