django-choices icon indicating copy to clipboard operation
django-choices copied to clipboard

Combine two list of choices

Open saranshbansal opened this issue 5 years ago • 1 comments

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)**)?

saranshbansal avatar Jan 23 '20 06:01 saranshbansal

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)

sergei-maertens avatar Jul 12 '21 13:07 sergei-maertens