university.py 599 Bytes
Newer Older
1
from django.db import models
2
3
4
from rex.utils.friendly_path import friendly_path

path_and_rename = friendly_path("uploads/universities/logos/",'name')
5
6
7

class University(models.Model):
    name = models.CharField(max_length=200)
8
    acronym = models.CharField(max_length=20)
9
10
    localization_lat = models.DecimalField(max_digits=10, decimal_places=6)
    localization_lon = models.DecimalField(max_digits=10, decimal_places=6)
11
    logo = models.ImageField(upload_to=path_and_rename, max_length=250)
12
13
14

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