Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Dec. 8, 2005 22:25:34

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

label for foreignkey-relations


is it possible to have different label-names for columns relating to the
same foreign table?


fragment of my film model:

country_1 = meta.ForeignKey(Country)
country_2 = meta.ForeignKey(Country)
country_3 = meta.ForeignKey(Country)

in the admin-interface, i´d like to have different labels for country_1 to
_3 when editing/updating a film. could look like:

Country
Country Co-Production (optional)
Country Co-Production (optional)

which would result in something like (code is not correct, of course):

country_1 = meta.ForeignKey(Country, labelName="Country")
country_2 = meta.ForeignKey(Country, labelName="Country Co-Production
(optional)")
country_3 = meta.ForeignKey(Country, labelName="Country Co-Production
(optional)")

patrick

Offline

#2 Dec. 8, 2005 23:51:52

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

label for foreignkey-relations


Hey Patrick --

The "verbose_name" attribute is what you want::

class MyModel(meta.Model)
country_1 = meta.ForeignKey(Country, verbose_name="Country One")
country_2 = meta.ForeignKey(Country, verbose_name="Country Two")

Jacob

Offline

Board footer

Moderator control

Enjoy the 24th of April
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