You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

from django.db import models
from django.contrib.gis.db.models import PointField
# Create your models here.
class Region(models.Model):
code = models.PositiveIntegerField()
name = models.CharField(max_length=64)
class Location(models.Model):
coords = PointField(db_index=True)
region = models.ForeignKey(Region, on_delete=models.SET_NULL, null=True)
address = models.CharField(max_length=512, blank=True, null=True)
class Category(models.Model):
name = models.CharField(max_length=64)
icon = models.ImageField(upload_to='icons/category/')
class Organization(models.Model):
location = models.ForeignKey(Location, on_delete=models.SET_NULL, null=True)
name = models.CharField(max_length=256)
phone = models.CharField(max_length=20)
website = models.URLField()
description = models.TextField()
owner = models.ForeignKey('jwtauth.CustomUser', on_delete=models.SET_NULL, null=True)
class OrganizationImage(models.Model):
image = models.ImageField(upload_to='images/organizations')
organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name='organization_images')