Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » question / suggestion for one to many fields [RSS Feed]

#1 Nov. 5, 2005 17:56:11

Le R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

question / suggestion for one to many fields


Let's say I have two types of objects (types A and B) and object A has
many object Bs. (typical foreign key)

Is there a way to tell the admin interface to add a little plus button
(either in the listing or edit view for object As) for quickly and
easily adding a new object of type B? In other words it will
pre-select the right object of type A in the select box on the object
B add form.

Example use: I'm working on a wiki farm service and I'm using the
admin interface during development (for test data until I have
interfaces for everything). In the list of wikis I just want a little
plus next to each wiki for adding a wikipage. This will then take you
to the wikipage add form and have the correct wiki preselected.

Maybe this is already possible, but I just can't find it ;)

Le Roux

Offline

#2 Nov. 5, 2005 18:05:41

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

question / suggestion for one to many fields


On 11/5/05, Le Roux Bodenstein <> wrote:
> Let's say I have two types of objects (types A and B) and object A has
> many object Bs. (typical foreign key)
>
> Is there a way to tell the admin interface to add a little plus button
> (either in the listing or edit view for object As) for quickly and
> easily adding a new object of type B? In other words it will
> pre-select the right object of type A in the select box on the object
> B add form.

Yes! If I understand you correctly, Django already does exactly that.
It puts a little plus button next to select boxes (for foreign-key
fields), which lets you add a foreign-key object. This appears on the
add and change forms.

The catch is that the foreign-key object needs to have "admin" set in
its model, and the currently-logged-in admin user needs to have
permission to add those foreign-key objects.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Nov. 5, 2005 19:18:29

Le R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

question / suggestion for one to many fields


Actually you got it the wrong way around ;) If I'm adding a wikipage, I
have a little "+" next to the wiki select box.

I want a "+" button for adding a wikipage on every row in the wiki
list. (and a "view wikipages" button that will take you to a filtered
list containing of wiki pages for that wiki only)

Is this possible? Or can you suggest an alternative? If there is
nothing to do this, then I don't mind adding something. Please just
point me in the right direction.. I don't really know my way around
Django's code yet ;)

Le Roux

Offline

#4 Nov. 6, 2005 03:07:00

j.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

question / suggestion for one to many fields


And, obviously, you must have a current release. I'm not sure when that
feature started. Every time I sync up, there's 'New Stuff' to look at.

Offline

  • Root
  • » Django
  • » question / suggestion for one to many fields [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support