I wonder if anyone would know a way to return the categories related to the session chosen in the select options.
Example:
class Session(models.Model):
name = models.CharField("Sessão", max_length=100)
slug = models.SlugField("Slug", max_length=100)
class Category(models.Model):
session = models.ForeignKey(Session, verbose_name='Sessão', on_delete=models.CASCADE, max_length=100, default=1, blank=True, null=True)
category = models.CharField("Categoria", max_length=100)
slug = models.SlugField("Slug", max_length=100)
class Article(models.Model):
category = models.ForeignKey(Category, verbose_name='Categoria', on_delete=models.CASCADE, max_length=100, default=1, blank=True, null=True)
session = models.ForeignKey(Session, verbose_name='Sessão', on_delete=models.CASCADE, max_length=100, default=1, blank=True, null=True)
When registering an Article, I would define a session for the article, and then I would like to return categories, only the categories related to that session.
Can anybody help me ? I believe this would have to be dynamically ...
Strong hug!