Django modelform ForeignKey List
- by Harry
How do you get each item in the ForeignKey field in a list, for example:
class Delegate(models.Model):
excursion = models.ForeignKey(Excursion, limit_choices_to = {'is_activity': False}, related_name='excursion', null=True, blank=True)
Template:
{% for object in formset.excursion_set.all %}
{{ object.lable }}
etc
{% endfor %}
My reason is that I don't want the options to display as a dropdown, but in a custom way that I will style etc.