mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-09-12 01:03:09 +00:00
Add users app, with basic model
This commit is contained in:
parent
a4a3324325
commit
6e152bc027
6 changed files with 46 additions and 0 deletions
0
users/__init__.py
Normal file
0
users/__init__.py
Normal file
3
users/admin.py
Normal file
3
users/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
0
users/migrations/__init__.py
Normal file
0
users/migrations/__init__.py
Normal file
37
users/models.py
Normal file
37
users/models.py
Normal file
|
@ -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']
|
3
users/tests.py
Normal file
3
users/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
3
users/views.py
Normal file
3
users/views.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
Loading…
Reference in a new issue