Skip to content

Instantly share code, notes, and snippets.

@egitimplus
Last active November 3, 2020 19:28
Show Gist options
  • Save egitimplus/734a0438154c0f20386cf0360501d58a to your computer and use it in GitHub Desktop.
Save egitimplus/734a0438154c0f20386cf0360501d58a to your computer and use it in GitHub Desktop.
from django.db import models
class FuelType(models.Model):
name = models.CharField(max_length=255)
def __str__(self):
return self.name
class CarModel(models.Model):
name = models.CharField(max_length=255)
fueltype = models.ManyToManyField(FuelType)
def __str__(self):
return self.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment