Django Admin Page show model referencing to another model as choose list

Viewed 41

I already created a new database instance called StatusList:

class StatusList(models.Model):
    status_text = models.CharField(max_length=300)
    color = ColorField(default='#ff0000')


    def __str__(self):
        return self.status_text

I also created some entries like: "Shop closed; red color", "Shop open; green color", etc...

This is supposed to show up, when calling the Homepage and show the status with the associated color.

Therefore, I would like to choose (drop-down list in Admin Page) one entry provided by StatusList.

I thought about a second model called "StatusChoosen", but does it make sense? It is an instance with just one entry representiong the one choosen by an admin. Even in this case I don't know how to show all entries from StatusList and return the active one.

I would appreciate your help.

0 Answers
Related