# Path: kobra/db_fields.py
# class IdField(models.UUIDField):
#     def __init__(self, *args, **kwargs):
#         kwargs['primary_key'] = kwargs.get('primary_key', True)
#         kwargs['default'] = kwargs.get('default', uuid.uuid4)
#         kwargs['editable'] = kwargs.get('editable', False)
#         kwargs['verbose_name'] = kwargs.get('verbose_name', _('ID'))
#         super(IdField, self).__init__(*args, **kwargs)
# 
# class MoneyField(models.DecimalField):
#     def __init__(self, *args, **kwargs):
#         kwargs['max_digits'] = kwargs.get('max_digits', 12)
#         kwargs['decimal_places'] = 2
#         super(MoneyField, self).__init__(*args, **kwargs)
# 
# class NameField(StripValueMixin, models.CharField):
#     def __init__(self, *args, **kwargs):
#         kwargs['max_length'] = kwargs.get('max_length', 64)
#         kwargs['verbose_name'] = kwargs.get('verbose_name', _('name'))
#         super(NameField, self).__init__(*args, **kwargs)


import logging
import sesam
from django.conf import settings
from django.contrib.auth.models import (
    AbstractBaseUser,
    BaseUserManager,
    PermissionsMixin
)
from django.db import models
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from .db_fields import IdField, MoneyField, NameField
                student.mifare_id != int(kwargs['mifare_id'])):
            student.mifare_id = kwargs['mifare_id']
            student_changed = True

        if student_changed:
            student.save()

        return student

    def get(self, *args, use_sesam=False, **kwargs):
        # use_sesam is False by default since the get() method is used
        # extensively by Django internals.

        if hasattr(kwargs, 'liu_id'):
            # Always coerce LiU ID to lowercase
            kwargs['liu_id'] = kwargs['liu_id'].lower()

        if use_sesam:
            return self.get_with_sesam(*args, **kwargs)

        return super(StudentQuerySet, self).get(*args, **kwargs)


class Student(models.Model):
    id = IdField(default=None,  # Only accept explicitly set IDs
                 help_text=_("This ID is the same as the student's "
                             "norEduPersonLIN. It will never change and thus "
                             "can be used to integrate with other systems also "
                             "utilizing the norEduPersonLIN."))


# Path: kobra/db_fields.py
# class IdField(models.UUIDField):
#     def __init__(self, *args, **kwargs):
#         kwargs['primary_key'] = kwargs.get('primary_key', True)
#         kwargs['default'] = kwargs.get('default', uuid.uuid4)
#         kwargs['editable'] = kwargs.get('editable', False)
#         kwargs['verbose_name'] = kwargs.get('verbose_name', _('ID'))
#         super(IdField, self).__init__(*args, **kwargs)
# 
# class MoneyField(models.DecimalField):
#     def __init__(self, *args, **kwargs):
#         kwargs['max_digits'] = kwargs.get('max_digits', 12)
#         kwargs['decimal_places'] = 2
#         super(MoneyField, self).__init__(*args, **kwargs)
# 
# class NameField(StripValueMixin, models.CharField):
#     def __init__(self, *args, **kwargs):
#         kwargs['max_length'] = kwargs.get('max_length', 64)
#         kwargs['verbose_name'] = kwargs.get('verbose_name', _('name'))
#         super(NameField, self).__init__(*args, **kwargs)


# Path: kobra/models.py
import logging
import sesam
from django.conf import settings
from django.contrib.auth.models import (
    AbstractBaseUser,
    BaseUserManager,
    PermissionsMixin
)
from django.db import models
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from .db_fields import IdField, MoneyField, NameField

                student.mifare_id != int(kwargs['mifare_id'])):
            student.mifare_id = kwargs['mifare_id']
            student_changed = True

        if student_changed:
            student.save()

        return student

    def get(self, *args, use_sesam=False, **kwargs):
        # use_sesam is False by default since the get() method is used
        # extensively by Django internals.

        if hasattr(kwargs, 'liu_id'):
            # Always coerce LiU ID to lowercase
            kwargs['liu_id'] = kwargs['liu_id'].lower()

        if use_sesam:
            return self.get_with_sesam(*args, **kwargs)

        return super(StudentQuerySet, self).get(*args, **kwargs)


class Student(models.Model):
    id = IdField(default=None,  # Only accept explicitly set IDs
                 help_text=_("This ID is the same as the student's "
                             "norEduPersonLIN. It will never change and thus "
                             "can be used to integrate with other systems also "
                             "utilizing the norEduPersonLIN."))


    full_name = NameField(