Commit 9743527c authored by Florent Chehab's avatar Florent Chehab
Browse files

Fixed models and add frequency to scholarship

parent 0204a094
# Generated by Django 2.0.3 on 2018-09-10 16:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('backend', '0003_auto_20180910_1731'),
]
operations = [
migrations.AlterField(
model_name='universityinfo',
name='costs_currency',
field=models.ForeignKey(default='EUR', on_delete=django.db.models.deletion.PROTECT, to='backend.Currency'),
),
]
# Generated by Django 2.0.3 on 2018-09-10 16:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0004_auto_20180910_1834'),
]
operations = [
migrations.AddField(
model_name='countryscholarship',
name='frequency',
field=models.CharField(choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1),
),
migrations.AddField(
model_name='universityscholarship',
name='frequency',
field=models.CharField(choices=[('w', 'week'), ('m', 'month'), ('s', 'semester'), ('y', 'year'), ('o', 'one_shot')], default='m', max_length=1),
),
]
...@@ -4,11 +4,25 @@ from backend.models.currency import Currency ...@@ -4,11 +4,25 @@ from backend.models.currency import Currency
from rest_framework import serializers from rest_framework import serializers
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
SCHOLARSHIP_FREQUENCIES = (
('w', 'week'),
('m', 'month'),
('s', 'semester'),
('y', 'year'),
('o', 'one_shot')
)
class Scholarship(BasicModule): class Scholarship(BasicModule):
type = models.CharField(max_length=200) type = models.CharField(max_length=200)
currency = models.ForeignKey(Currency, on_delete=models.PROTECT) currency = models.ForeignKey(Currency, on_delete=models.PROTECT)
frequency = models.CharField(
max_length=1,
choices=SCHOLARSHIP_FREQUENCIES,
default='m',
)
amount_min = models.DecimalField( amount_min = models.DecimalField(
max_digits=20, max_digits=20,
decimal_places=2, decimal_places=2,
......
...@@ -26,7 +26,7 @@ class UniversityInfo(BasicModule): ...@@ -26,7 +26,7 @@ class UniversityInfo(BasicModule):
null=True null=True
) )
costs_currency = models.ForeignKey(Currency, on_delete=models.PROTECT) costs_currency = models.ForeignKey(Currency, on_delete=models.PROTECT, default='EUR')
@classmethod @classmethod
def get_serializer(cls): def get_serializer(cls):
......
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