Dear all,

I'm using generic edit view to create my form, building the form from a
ModelForm.

Take a look of this quick example code:

    class Event(models.Model)

        location = models.ForeignKey(Location)

    class EventCreate(CreateView):

        model =  Event

        def get_initial(self):
            initial = super(EventCreate, self).get_initial()
            initial['location'] =
Location.objects.filter(user=self.request.user)

The select element shows the Location from all the user and not only the
one from the current.
More over, when I Update the model (Using the generic UpdateView), all the
field are already filled,
except the select for the ForeignKey that picks the first location in
alphabetical order, instead of the one
selected for the Event.

Am I doing something wrong?

Cheers,
Michele.

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to