university.py 688 Bytes
Newer Older
1
from django.db import models
Florent Chehab's avatar
Florent Chehab committed
2
from backend.models.my_model import MyModel
3
from backend.utils.friendly_path import friendly_path
4

Florent Chehab's avatar
Florent Chehab committed
5
6
path_and_rename = friendly_path("uploads/universities/logos/", 'name')

7

8
class University(MyModel):
9
10
11
    """
    Model storing information about universities
    """
12
    name = models.CharField(max_length=200)
Florent Chehab's avatar
Florent Chehab committed
13
    acronym = models.CharField(max_length=20, null=True, blank=True)
Florent Chehab's avatar
linting  
Florent Chehab committed
14
15
    logo = models.ImageField(upload_to=path_and_rename, max_length=250,
                             default='path/to/my/default/image.jpg')  # TODO CHANGE !
16
    website = models.URLField(null=True)
Florent Chehab's avatar
Florent Chehab committed
17
18


19
# Rest API related stuff are in universityAPI.py to prevent circular depedencies