M
M
marataziat2018-06-02 11:18:50
Django
marataziat, 2018-06-02 11:18:50

How to work with choices correctly?

I need users to be able to add tags to the model:

class Task(models.Model):
    PROGRAMMING_TYPES = (
        ('FD', 'Frontend'),
        ('BD', 'Backend'),
        ('HL', 'High load / Multithreading'),
        ('ML', 'Machine learning'),
        ('PS', 'Parsing / Data mining'),
        ('DB', 'Databases / SQL'),
        ('AL', 'Administration / Linux'),
    )
    ...
    tag = models.CharField(max_length=9, choices=PROGRAMMING_TYPES)
   ...

How it will be more correct to implement it? I need to be able to add multiple tags, not just one. Also, is it possible to limit the number of tags?
I tried querying the database but it didn't work :(
5b12538732d7f111211346.png5b12538d12e04822252710.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question