On Oct 25, 4:53 am, Caisys <amamd...@gmail.com> wrote:
> > Just override the form in the inlne admin. All you have to do is set a
> > default in the field you want.
>
> I managed to do that but now all the extra fields have the default
> text not just one.
>

What about overriding the formset? You override the __init__ of the
formset and before calling super, you add an initial data to the
formset adding the default value for the first form.

> > In this case i prefer the approach of creating a "fake" field called
> > places, populated with the places, and when the user select the place,
> > you do an ajax request and populate the subplace select with the
> > subplaces from the selected place. You will have to override the form
> > in the ModelAdmin and add this behaviour to the form. Also you will
> > have to create a view to retrieve the subplaces based in the selected
> > place.
>
> I am not so sure how to do that yet. However, i would like to know how
> i could not return the related object name in __unicode__ . Where did
> I go wrong?
>
> Thanks
>
> On Oct 24, 1:38 pm, "Vinicius Mendes | meiocodigo.com"
>
> <vbmen...@gmail.com> wrote:
> > On Oct 24, 7:14 am, Caisys <amamd...@gmail.com> wrote:
>
> > > Thanks !!! I also felt the second sounds more "right" which leads to
> > > two requirements, the first is for convenience but the second is a
> > > must:
>
> > > 1) On the admin page for add Place I will put 2 or 3 slots for adding
> > > Subplace to a place ... is there a way where the first one would be
> > > filled with "default" by default? so that each created place would
> > > have a default subplace?
>
> > Just override the form in the inlne admin. All you have to do is set a
> > default in the field you want.
>
> > > 2) On the admin page for add event there will be a drop down list for
> > > the subplace.... most of the subplaces will be called "default" is
> > > there a way to change the label on drop down list to "place -
> > > subplace". i tried to change the __unicode__ of subplace to "return
> > > u"% - %" % (self.place, self.name)" but it generated and error that
> > > subplace object has no attribute 'place'.
>
> > In this case i prefer the approach of creating a "fake" field called
> > places, populated with the places, and when the user select the place,
> > you do an ajax request and populate the subplace select with the
> > subplaces from the selected place. You will have to override the form
> > in the ModelAdmin and add this behaviour to the form. Also you will
> > have to create a view to retrieve the subplaces based in the selected
> > place.
>
> > > thanks
>
> > > On Oct 24, 2:27 am, Léon Dignòn <leon.dig...@gmail.com> wrote:
>
> > > > The second sounds more logically.
>
> > > > On 23 Okt., 15:41, chefsmart <moran.cors...@gmail.com> wrote:
>
> > > > > I would go with your second solution.
>
> > > > > On Oct 23, 5:17 pm, Caisys <amamd...@gmail.com> wrote:
>
> > > > > > Hi,
> > > > > > I have classes for Event, Place and Subplace. Some of the Places are
> > > > > > divided into different Halls (Subplace) and some have only one. I
> > > > > > would like to know how design the relations between the classes.
>
> > > > > > 1) Should I put two columns in the Event one FK to Place and another
> > > > > > FK to Hall?
> > > > > > 2) Should I create one FK only to Hall and create a record in Hall 
> > > > > > for
> > > > > > every Place even if the Place has no Halls?
>
> > > > > > Thanks- Zitierten Text ausblenden -
>
> > > > > - Zitierten Text anzeigen -
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to