Reputation: 19
I try to create user with user information like first name, last name, bio and hobby. But it show some problem on admin and saving. On admin it only show and save first name and last name but don’t show and save other field.
myuser = User.objects.create_user(username,email,password)
myuser.hobby = hobby
myuser.first_name = fname
myuser.last_name = lname
myuser.bio = bio
myuser.save()
Upvotes: 0
Views: 232
Reputation: 672
In your admin.py edit to look like this .. (obviously replace "yourapp" appropriately)
from django.contrib import admin
from yourapp.models import Yourapp
@admin.register(Yourapp) # This could be User, whatever the name of your model class is
class YourappAdmin(admin.ModelAdmin):
list_display = ("id", "first_name", "last_name", "hobby ", "bio")
Upvotes: 1