Correct. I over looked a few basics.

On 19 יולי, 04:58, "Ben Ford" <[EMAIL PROTECTED]> wrote:
> This error message is to do with a syntax error... It doesn't have anything
> to do with django specifically. If you've cut and pasted verbatim, then you
> need a colon ( : ) at the end of your if .... > 0 line. This is what python
> is flagging as an error as far as i can see.
> Ben
>
> On 18/07/07, Ilan <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > You're correct I did have a extra space, but the original problem was
> > syntax error on the following line :
> > if self.segment_set.count() > 0
> > so my question is : can I acess to FK queryset as described in
> >http://www.djangoproject.com/documentation/db-api/#Backwardin a model
> > method
>
> > thanks
>
> > On 18 יולי, 17:32, Tim Chase <[EMAIL PROTECTED]> wrote:
> > > > Can someone point me to the problem?
>
> > > > class Base(models.Model):
> > > >     User = models.CharField(maxlength=200)
> > > >     Notes = models.CharField(maxlength=200) # free text
>
> > > >      def _first_date(self):
> > > >        """ Return the first date """
> > > >          if self.segment_set.count() > 0
> > > >              return(self.segment_set.order_by('create_date')
> > > > [0].create_date)
> > > >      first_date = property(_first_date)
>
> > > > class Segment(models.Model):
> > > >     base = models.ForeignKey(Base)
> > > >     create_date = models.DateTimeField(auto_now_add=True)
> > > >     update_date = models.DateTimeField(auto_now=True)
> > > >     Notes = models.CharField(maxlength=200) # free tex
>
> > > > #################
> > > > D:\Sites\mysite>python manage.py syncdb
> > > > Error: Couldn't install apps, because there were errors in one or more
> > > > models:
> > > > mysite.traveler: invalid syntax (models.py, line 8)
>
> > > If you did a copy&paste of your actual code, line #8 ("def
> > > _first_date(self):") seems to have an extra space worth of
> > > indentation from the User/Notes lines.
>
> > > Python would flag this as bogus, which in turn would likely
> > > trigger an error in validation.
>
> > > -tim
>
> --
> Regards,
> Ben Ford
> [EMAIL PROTECTED]
> +628111880346


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to