What i am trying to do:
Trying to registering my model to django admin
What problem do i get:
I am getting the following error:
My Code:
admin.py:
from django.contrib import admin
from .models import UserProfile, Post
admin.site.register(UserProfile,Post)
model.py:
from django.contrib.auth.models import User
from django.db import models
class UserProfile(models.Model):
user = models.ForeignKey(User,on_delete=models.CASCADE)
avatar = models.ImageField(upload_to='static/media/',max_length=100)
class Post(models.Model):
title = models.CharField(max_length=120)
content = models.TextField()
urls.py:
from django.conf.urls import url
from .import views
urlpatterns = [
url(r'^register/$',views.registerUser),
url(r'^$', views.index, name="Index"),
url(r'^validateRegisterForm/$',views.validateRegisterForm),
url(r'^validateLoginForm/$',views.validateLoginForm),
url(r'^article/$', views.article, name="Article"),
url(r'^Login/$',views.loginUser, name="Login"),
url(r'^Logout/$',views.logoutUser, name="Logout"),
]
Note: I am new to django so, don't know much about it.