university.py 511 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
from django.db import models
import uuid

class University(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    name = models.CharField(max_length=200)
    localization_lat = models.DecimalField(max_digits=10, decimal_places=6)
    localization_lon = models.DecimalField(max_digits=10, decimal_places=6)
    logo = models.ImageField(upload_to='uploads/'+str(id))

    def localization(self):
        return {'lat':self.localization_lat, 'lon':self.localization_lon}