There are three models:
# Model event class Event(models.Model): title = models.CharField("event Name", max_length=25) location = models.CharField("Location", max_length=25) # Model of a simple blog post class Post(models.Model): title = models.CharField("post Title", max_length=50) body = models.TextField("Text post", blank=True, null=True) pub_date = models.DateTimeField("date published", default=timezone.now) # Model post tied to a specific event class EventPost(Post): event = models.ForeignKey(Event, on_delete=models.CASCADE)
The bottom line is that you need the blog to display all posts (related to the t. and simple) by date, but by posts from the events in the template is added to the die with the name of the event and place. I.e. you can merge two queries and pass to the template, but can't figure out how to get the dice values from the model outputs.
Came to mind the option to make in the model property EventPost something
@property def location(self): location = Event.objects.get(pk=self.event)
But I think it's not a very good option (and not the fact that working))