Skip to content

Instantly share code, notes, and snippets.

@sam-thecoder
Created December 28, 2019 13:46
Show Gist options
  • Save sam-thecoder/ec2c86dc7f3bf8bbf83768c9a3555904 to your computer and use it in GitHub Desktop.
Save sam-thecoder/ec2c86dc7f3bf8bbf83768c9a3555904 to your computer and use it in GitHub Desktop.
company model
from django.db import models
from django.contrib.auth.models import User
from location.models import Address
class Company(models.Model):
name = models.CharField(max_length=500)
phone = models.CharField(max_length=500)
email = models.EmailField(unique=True)
address = models.ForeignKey(Address, related_name="companies", on_delete=models.CASCADE, null=True)
def __str__(self):
return self.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment