bigjason / django-choices

Sanity to the django choices functionality.
MIT License
175 stars 23 forks source link

Combine two list of choices #70

Closed saranshbansal closed 1 year ago

saranshbansal commented 4 years ago

I have a model field as below:

    suggestion = models.CharField(
        _('suggestion'),
        blank=True,
       choices= **(choice1, choice2)**,
        max_length=255,
    )

I have two choice lists...let's say

class FeedbackComplimentType(DjangoChoices):
...

and

class FeedbackIssueType(DjangoChoices):
...

How do I combine the above two choices and use them with my model field's choices attribute? (choices: **(choice1, choice2)**)?

sergei-maertens commented 3 years ago

Sorry for getting back to you so late, but this is not something provided out of the box.

I suppose you could do something like choices=list(FeedbackComplimentType.choices) + list(FeedbackIssueType.choices)