1👍
✅
Could it be something simple like:
models.py:
from django.db import models
class Place(models.Model):
name = models.CharField(max_length=50)
class Restaurant(Place):
serves_hot_dogs = models.BooleanField(default=False)
serves_pizza = models.BooleanField(default=False)
is_restaurant = True
class Garage(Place):
car_brands_serviced = Models.ManyToManyField(Brands)
is_garage = True
A template could work like this – template.html:
{% for place in places %}
{% if place.is_restaurant %}
<!-- Restaurant Stuff -->
{% elif place.is_garage %}
<!-- Garage Stuff -->
{% endif %}
{% endfor %}
Source:stackexchange.com