Can't execute SQL functions in app_name/sql/*.sql (IndexError: tuple index out of range)

2009-11-14 Thread Monika Sulik
I have two SQL functions that I'd like to use in Django. They both work no problem if I paste them into psql (PostgreSQL's shell). As I have the same problem with both, I'll just post and explain the simpler one. It looks like this: CREATE OR REPLACE FUNCTION skater_name_match(INTEGER,VARCHAR) RET

Re: forms.ChoiceField and empty values

2009-11-13 Thread Monika Sulik
Sorry for the double post *blush* Not sure how that happened... The model looks something like this: class Competition(MessageboardOwner): name = models.CharField(max_length=256) type = models.IntegerField(choices=COMPETITION_TYPE_CHOICES) start = models.DateField() end = models.D

Re: forms.ChoiceField and empty values

2009-11-12 Thread Monika Sulik
As I haven't had any replies so far, I'll add some more information... The empty label appears if I redefine the form like this: class CompetitionSearchForm(forms.ModelForm): class Meta: model = Competition fields = ('name','type') It disappears again if I make the changes I

Re: forms.ChoiceField and empty values

2009-11-12 Thread Monika Sulik
As I haven't had any replies so far, I'll add some more information... The empty label appears if I redefine the form like this: class CompetitionSearchForm(forms.ModelForm): class Meta: model = Competition fields = ('name','type') It disappears again if I make the changes I

Re: TemplateSyntaxError

2009-11-10 Thread Monika Sulik
When you execute manage.py sql wkw, the output is just how your current models translate into SQL. To see what's actually in the database you should do manage.py dbshell and then use whatever command your database supports (\d wkw_lawyer in PostgreSQL and DESCRIBE wkw_lawyer in MySQL). Try doing

forms.ChoiceField and empty values

2009-11-10 Thread Monika Sulik
Hi, I have the following problem... I've got a form, which looks like this: class CompetitionSearchForm(forms.Form): name = forms.CharField(required=False) type = forms.ChoiceField(choices=COMPETITION_TYPE_CHOICES, required=False) The tuple COMPETITION_TYPE_CHOICES is used in a model cl

Re: Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-23 Thread Monika Sulik
Thanks :) On Oct 22, 5:52 pm, Tom Evans wrote: > On Thu, 2009-10-22 at 07:57 -0700, Monika Sulik wrote: > > Hi, > > > I was wondering what exactly are the advantages of having code like > > this: > > > class Foo (models.Model): > >     bar_m2m = mode

Advantages of using ManyToManyField(Bar, through='Foo_Bar') syntax vs not declaring a ManyToManyField at all

2009-10-22 Thread Monika Sulik
Hi, I was wondering what exactly are the advantages of having code like this: >> class Foo (models.Model): bar_m2m = models.ManyToManyField(Bar,through='Foo_Bar') class Bar (models.Model): pass class Foo_Bar (models.Model): foo = models.ForeignKey(Foo)