Hello,

I have a little problem with the "limit_choices_to" functionality. I
found two group discussions concerning the same problem, but the
authors got no answers.
http://groups.google.com/group/django-users/browse_thread/thread/fab619f35e322486/e9f34786dbba2666?lnk=gst&q=limit_choices_to#e9f34786dbba2666
http://groups.google.com/group/django-users/browse_thread/thread/881f29143ec8a6e/ffe217c861e090f2?lnk=gst&q=limit_choices_to#ffe217c861e090f2

--------------------------------------------------------------------------------------------------
class EventType(models.Model):
    desc = models.CharField(max_length=40, unique=True)
    valid_from = models.DateField()
    valid_to = models.DateField()
.....

class Event(models.Model):
    date = models.DateField(core=True)
    type = models.ForeignKey(EventType, limit_choices_to =
 
{'valid_from__lte': ?????
 
'valid_to__gte': ?????})

???? = should be the value Event.date
---------------------------------------------------------------------------------------------------
errormessage if I type: self.date

    type = models.ForeignKey(EventType, limit_choices_to =
{'valid_from__lte': self.date})
NameError: name 'self' is not defined
---------------------------------------------------------------------------------------------------
errormessage if I type: date

Incorrect date value: '<django.db.models.fields.DateField object at
0x849bf6c>' for column 'valid_from' at row 1
---------------------------------------------------------------------------------------------------


I hope that someone will help me!

Regards
  Bernd


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