Commit c8583636 authored by Florent Chehab's avatar Florent Chehab

Campus Models added

parent e934ec9b
from django.contrib import admin
from reversion_compare.admin import CompareVersionAdmin
from rex.models.university import University
from rex.models.university import University, MainCampus
from rex.models.localization import Country, Region, City
admin.site.register(University, CompareVersionAdmin)
admin.site.register(Country)
admin.site.register(Region)
admin.site.register(City)
admin.site.register(University, CompareVersionAdmin)
admin.site.register(MainCampus)
# Generated by Django 2.0.3 on 2018-04-25 09:22
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('rex', '0003_city'),
]
operations = [
migrations.CreateModel(
name='MainCampus',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('modified_date', models.DateTimeField(auto_now=True)),
('comment', models.TextField(null=True)),
('lat', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-85.05112878), django.core.validators.MaxValueValidator(85.05112878)])),
('lon', models.DecimalField(decimal_places=6, max_digits=10, validators=[django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180)])),
('city', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='rex.City')),
('modified_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
),
]
# Generated by Django 2.0.3 on 2018-04-25 09:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rex', '0004_maincampus'),
]
operations = [
migrations.AlterField(
model_name='maincampus',
name='comment',
field=models.TextField(blank=True, null=True),
),
]
# Generated by Django 2.0.3 on 2018-04-25 09:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rex', '0005_auto_20180425_1131'),
]
operations = [
migrations.AddField(
model_name='maincampus',
name='name',
field=models.CharField(max_length=200, null=True),
),
]
from .localization import localization # noqa: F401
from .university import university # noqa: F401
from .module import module # noqa: F401
from .module import Module # noqa: F401
from django.db import models
from rest_framework import serializers, viewsets, permissions
from django.contrib.auth.models import User
class Module(models.Model):
modified_date = models.DateTimeField(auto_now=True)
modified_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
module_icon = "You forget to override the icon in the sub-class"
module_name = "You forget to override the name in the sub-class"
module_description = "You forget to override the description in the sub-class"
class Meta:
abstract = True
"""
API RELATED STUFF BELLOW
"""
from .university import University # noqa: F401
from .campus import MainCampus # noqa: F401
from django.db import models
from rex.models.module import Module
from rex.models.localization import City
from django.core.validators import MinValueValidator, MaxValueValidator
class Campus(Module):
name = models.CharField(max_length=200, null=True)
comment = models.TextField(null=True, blank=True)
city = models.ForeignKey(City, on_delete=models.PROTECT, null=False)
lat = models.DecimalField(
max_digits=10,
decimal_places=6,
validators=[MinValueValidator(-85.05112878),
MaxValueValidator(85.05112878)]
)
lon = models.DecimalField(
max_digits=10,
decimal_places=6,
validators=[MinValueValidator(-180),
MaxValueValidator(180)]
)
class Meta:
abstract = True
class MainCampus(Campus):
module_icon = "You forget to override the icon in the sub-class : I know"
module_name = "Campus principal"
module_description = "Campus principal de l'université."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment