StudE-Backend/stude/study_groups/models.py

17 lines
624 B
Python

from django.db import models
from subjects.models import Subject
from django.contrib.gis.db import models as gis_models
from django.contrib.gis.geos import Point
# Create your models here.
class StudyGroup(models.Model):
name = models.CharField(max_length=48, unique=True)
location = gis_models.PointField(blank=True, null=True, srid=4326)
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
timestamp = models.DateTimeField(auto_now_add=True)
landmark = models.ForeignKey(
'landmarks.Landmark', on_delete=models.SET_NULL, null=True)
def __str__(self):
return self.name