====== Sign-ups, users, logins ======
We want to add users into out application. First we create a new application
python manage.py startapp customers
models.py
# null= se tyka databaze, kdezto
# blank= se tyka vyplneni formulare
from django.utils.encoding import smart_unicode
class customer(models.Model):
first_name = models.CharField(max_length=120, null=True, blank=True)
last_name = models.CharField(max_length=120, null=True, blank=True)
email = models.EmailField(null=False, blank=False)
registered = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = models.DateTimeField(auto_now_add=True, auto_now=False)
def __unicode__(self):
return self.email
admin.py
from .models import customer
# Register your models here.
class customer_admin(admin.ModelAdmin):
class Meta:
model = customer
admin.site.register(customer, customer_admin)