Commit 97cab068 authored by Florent Chehab's avatar Florent Chehab
Browse files

Scholarship module added, not tested

parent e7310329
......@@ -4,11 +4,9 @@ from reversion_compare.admin import CompareVersionAdmin
from import University, MainCampus
from rex.models.location import Country, City
from rex.models.module import BasicModule, CompareVersionAdmin), CompareVersionAdmin)
from django.db import models
from import UsefullLinksField
from rex.models.module import Module
class BasicModule(models.Model):
class BasicModule(Module):
comment = models.TextField()
usefull_links = UsefullLinksField()
# class Meta:
# abstract = True
class Meta:
abstract = True
from django.db import models
from rex.models.module import BasicModule
from django.core.exceptions import ValidationError
from django.core.validators import MinValueValidator
class Scholarship(BasicModule):
type = models.CharField(required=True, max_length=200)
currency = models.CharField(required=True, max_length=50)
amount_min = models.DecimalField(
amount_max = models.DecimalField(
# Need custom validation
def clean(self, *args, **kwargs):
if self.amount_max < self.amount_min:
raise ValidationError(
"Amount_max should be greater or equal than amount_min")
super(Scholarship, self).clean(*args, **kwargs)
def save(self, *args, **kwargs):
super(Scholarship, self).save(*args, **kwargs)
class Meta:
abstract = True
Supports Markdown
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