Home > OS >  django charfield not showing in admin panel
django charfield not showing in admin panel

Time:02-26

i create a model in django and register it in admin.py when i go to admin panel it shows the model but when i want to create object it doesn't show the charfields and i can just create the oject without any details

this is my codes below

view.py

from django.shortcuts import render
from django.http import HttpResponse
from .models import Feature

# Create your views here.
def index(request):
    features = Feature.objects.all()
    return render(request, 'index.html', {'features' : features})

model.py

from django.db import models

# Create your models here.
class Feature(models.Model):
    name: models.CharField(max_length=100)
    details: models.CharField(max_length=200)

stting.py

"""
Django settings for myproject project.

Generated by 'django-admin startproject' using Django 3.2.12.

For more information on this file, see

For the full list of settings and their values, see
 """

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-dubzu2qq@tk9lk           
  • Related