Opened 16 years ago
Closed 16 years ago
#12451 closed (invalid)
limit_choices_to with ajax support
| Reported by: | scorpid | Owned by: | nobody |
|---|---|---|---|
| Component: | Uncategorized | Version: | 1.1 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
class Survey(models.Model):
name = models.TextField()
def __unicode__(self):
return self.name
class ChoiceGroup(models.Model):
order = models.IntegerField(max_length=2)
choice = models.CharField(max_length=60)
def __unicode__(self):
return self.choice
class Question(models.Model):
survey = models.ForeignKey(Survey)
questionText = models.TextField()
choices = models.ManyToManyField(ChoiceGroup)
def __unicode__(self):
return self.questionText
class Answer(models.Model):
ip = models.CharField(max_length=20)
question = models.ForeignKey(Question)
givenAnswer = models.ForeignKey(ChoiceGroup, limit_choices_to={Question.choices}) '''### i want that given answer can be selectable only
from question's answers in the admin panel. Is this possible? Or can you make a patch for that? '''
def __unicode__(self):
return self.ip
in the admin->answers form when i choose a question it will limit given answers to my chosen question's answer group. This would be a great feature if you can do it by ajax.
Note:
See TracTickets
for help on using tickets.
Sure - but that would be outside the scope of the Django core. Django has an explicit policy of not blessing a single javascript toolkit, and keeping itself to a server-side framework. Choosing widgets is a client-side decision.
If you want AJAX widgets for Django, there are plenty of options available. Google is your friend.