diff --git a/users/__init__.py b/users/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/users/admin.py b/users/admin.py new file mode 100644 index 00000000..8c38f3f3 --- /dev/null +++ b/users/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/users/migrations/__init__.py b/users/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/users/models.py b/users/models.py new file mode 100644 index 00000000..d5637fd9 --- /dev/null +++ b/users/models.py @@ -0,0 +1,37 @@ +from django.db import models +from django.forms import ModelForm + +class User(models.Model): + STATE_ACTIVE = 0 + STATE_DEACTIVATED = 1 + STATE_ARCHIVED = 2 + STATES = ( + (0, 'STATE_ACTIVE') + (1, 'STATE_DEACTIVATED') + (2, 'STATE_ARCHIVED') + ) + + name = models.CharField(max_length=255) + surname = models.CharField(max_length=255) + pseudo = models.CharField(max_length=255) + email = models.EmailField() + school = models.ForeignKey('School', on_delete=models.PROTECT) + promo = models.CharField(max_length=255) + pwd_ssha = models.CharField(max_length=255) + pwd_ntlm = models.CharField(max_length=255) + #location = models.ForeignKey('Location', on_delete=models.SET_DEFAULT) + state = models.CharField(max_length=30, choices=STATES, default=STATE_ACTIVE) + + +class School(models.Model): + name = models.CharField(max_length=255) + +class UserForm(ModelForm): + class Meta: + model = User + fields = ['name','surname','pseudo','email','school','promo','pwd_ssha','pwd_ntlm','state'] + +class SchoolForm(ModelForm): + class Meta: + model = School + fields = ['name'] diff --git a/users/tests.py b/users/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/users/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/users/views.py b/users/views.py new file mode 100644 index 00000000..91ea44a2 --- /dev/null +++ b/users/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.