Try throwing in an event.save() after creating the eventdate_date. The
event.dates.all() is spawning a new query, and you are trying to list
changes that haven't yet been committed to the database.

-James
On Nov 27, 2014 6:32 AM, "daedae11" <[email protected]> wrote:

> My EventDate model has a ForeignKey to Event shown as follows:
>
> *class EventDate( models.Model ): # {{{1*
> *    """ stores dates for events """*
> *    eventdate_name = models.CharField( *
> *            _( u'Name' ), blank = False, null = False,*
> *            max_length = 80, help_text = _( *
> *            "Example: call for papers" ) )*
> *    eventdate_date = models.DateField( _( u'Date' ), blank = False,*
> *            null = False, db_index = True, validators = [validate_year] )*
> *    event = models.ForeignKey( Event, related_name = 'dates' )*
> *    objects = models.GeoManager()*
>
> The shell output is:
> In [10]: event.dates.create(eventdate_name='start',
> eventdate_date=datetime.date.today())
> Out[10]: <EventDate: 2014-11-27    start>
> In [11]: event.dates.all()
> Out[11]: []
>
> Why is event.dates.all() empty?
>
> Does anyone have some advance?
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4655197f.1380a.149f1aab0f2.Coremail.daedae11%40126.com
> <https://groups.google.com/d/msgid/django-users/4655197f.1380a.149f1aab0f2.Coremail.daedae11%40126.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXc-%2BxOM7Wm990XKiH3GRfB%2BH75nW4poHrauWVWRd5pAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to