-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.py
32 lines (24 loc) · 922 Bytes
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from django.db import models
from django.db.models import Model
from django.utils import timezone
from django.contrib.auth.hashers import make_password
class User(Model):
STATUS_CHOICES = (
('ukryte', 'Ukryte'),
('widoczne', 'Widoczne')
)
imie = models.CharField(max_length=100)
nazwisko = models.CharField(max_length=100)
zgloszono = models.DateTimeField(default=timezone.now)
opis = models.CharField(max_length=15000)
status = models.CharField(max_length=10,
choices=STATUS_CHOICES,
default='widoczne')
class MyAdmin(Model):
nickname = models.CharField(max_length=100)
password = models.CharField(max_length=100)
def save(self, *args, **kwargs):
if not self.pk:
self.password = make_password(self.password)
super().save(*args, **kwargs)
# Create your models here.