I made something like this :
models.py
from django.db import models
from django.utils.encoding import smart_text
class SignUp(models.Model):
first_name=models.CharField(max_length=100,null=True,blank=True)
second_name=models.CharField(max_length=100,null=True,blank=True)
email=models.EmailField(max_length=100)
casPridania=models.DateTimeField(auto_now_add=True,auto_now=False)
casAktualizacie=models.DateTimeField(auto_now_add=False,auto_now=True)
def __unicode__(self):
return smart_text(self.first_name)
admin.py
from django.contrib import admin
from .models import SignUp
class prihlasenieAdmin (admin.ModelAdmin):
class Meta:
model=SignUp
admin.site.register(SignUp,prihlasenieAdmin)
It looks fine, but when I log on my page with /admin and make a new sign up, it doesn't return first name, it returns "Sign up object". I tried to return email and now first_name, but nothing worked.
//Solved by using __str__ instead of __unicode__ in module.py