Re: please help ForeignKey('Class')
> thanks that did work! > > I did have max_length but it didn't like it > > must update django?? No, probably not yet then. I'm just using 0.97pre, where the warning showed up. Probably doesn't in 0.96, but keep it in mind in case you do update. (Unless of course you're still at 0.95.) --~--~-~--~~~---~--~~ 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: please help ForeignKey('Class')
hello thanks that did work! I did have max_length but it didn't like it must update django?? --~--~-~--~~~---~--~~ 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: please help ForeignKey('Class')
> Hi there > I am having a problem with ForeignKey(Class) in my models.py > if the Class it comes before the class then it says I should put it in > quotes. > > ForeignKey('Class') > > put when i run python manage.py validate to check its ok it doesn't > like it You didn't give the error from manage.py, which should have pointed you in the right direction (and us as well): " Error: One or more models did not validate: test.group: Reverse query name for field 'leader' clashes with m2m field 'Members.group'. Add a related_name argument to the definition for 'leader'. " There's a name clash within the database created by django. Rename the second attribute in Members to 'groups' (better name anyway, being plural), rather than group: groups = models.ManyToManyField(Group) That will work. Oh, and depending on your Django version, you may want to change the parameter name 'maxlength' to 'max_length': I got a DeprecationWarning for that... > here is my models.py: > > from django.db import models > > class Group(models.Model): > groupname = models.CharField(maxlength=60) > leader = models.ForeignKey('Members') ##error with this line > > class Members(models.Model): > username = models.CharField(maxlength=30) > group = models.ManyToManyField(Group) > > > I have had to put the Members class after the Group class because ive > used a > ManytoMany in the members class referencing the Group class > > can anyone help me please > > nik > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
please help ForeignKey('Class')
Hi there I am having a problem with ForeignKey(Class) in my models.py if the Class it comes before the class then it says I should put it in quotes. ForeignKey('Class') put when i run python manage.py validate to check its ok it doesn't like it here is my models.py: from django.db import models class Group(models.Model): groupname = models.CharField(maxlength=60) leader = models.ForeignKey('Members') ##error with this line class Members(models.Model): username = models.CharField(maxlength=30) group = models.ManyToManyField(Group) I have had to put the Members class after the Group class because ive used a ManytoMany in the members class referencing the Group class can anyone help me please nik --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---