Now how can I populate the filter_vertical panel in admin with the data in the table?
A piece of my model is:
class Position(models.Model):
POSITIONS = (('GK', 'Goalkeeper'), ('DFC', 'Defender Central'), ('SW', 'Sweeper'),
('DFL', 'Defender Left'), ('DFR', 'Defender Right'),
('WBL', 'Wing Back Left'), ('WBR', 'Wing Back Right'),
('DM', 'Defender Midfielder'), ('MR', 'Midfielder Right'), ('ML', 'Midfielder Left'),
('MC', 'Midfielder Center'), ('AMC', 'Attacking Midfielder Center'), ('AML', 'Attacking Midfielder Left'),
('MC', 'Attacking Midfielder Right'), ('ST', 'Striker'))
position_name = models.CharField(max_length=50, choices=POSITIONS)
def __unicode__(self):
return self.position_name
class Player(models.Model):
........
........
role = models.ManyToManyField(Position)
.........
in admin:
class PlayerAdmin(admin.ModelAdmin):
.......
.......
filter_vertical = ('role')
I want that in PlayerAdmin I have the choices values listed.
Thanks
Il giorno lunedì 2 luglio 2012 20:17:42 UTC+2, ledzgio ha scritto:
Thanks very much for your response, really appreciated. But I am a noob and I don't know how to do this :)--
Could you please provide a simple example?
and more, how can I populate this field in admin with the table data?
thanks again
Il giorno lunedì 2 luglio 2012 17:28:48 UTC+2, Sunny Nanda ha scritto:You can specify a 'filter-horizontal' tuple in the admin model declaration:-Sandeep
On Monday, July 2, 2012 6:56:07 PM UTC+5:30, ledzgio wrote:In default admin panel, under group permissions, I saw a double panels where I can add an element from the left list panel to the right one instead of selecting multiple elements by holding CTRL. I would like to have this panel implementation in my admin with my models, how can I do that?
thanks
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/BL49rguY-9cJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment