I'm using raw_id_fields in admin.py
the question, how could i get the Poll question atribute and the
number in admin?
number is ok but it would be better if i could get more info than
that...
can i create a new class atribute in models.py and refer to Poll
class?
something like this:
tempPoll = Poll.objects.get(id=14)
question = tempPoll.question
here i dont know the id couse raw_id_fields is defined in admin.py
how can i do that? i've try some combinations but just cant make it
working...
# this is the current model.py:
from django.db import models
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
poll = models.ForeignKey(Poll, raw_id_admin=True)
choice = models.CharField(max_length=200)
votes = models.IntegerField()
#this is admin.py:
from gui_test.someapp.models import Poll
from django.contrib import admin
class ChoiceAdmin(admin.ModelAdmin):
raw_id_fields = ('poll',)
admin.site.register(Choice, ChoiceAdmin)
admin.site.register(Poll)
tnx!
vedran
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---