In models.py:
from colorfield.fields import ColorFieldclass colour(models.Model): color=ColorField(format="hexa") def __str__(self): return str(self.id)
In admin.py:
admin.site.register(colour)
When I am running python manage.py makemigrations it says:
System check identified some issues:WARNINGS:?: (urls.W005) URL namespace 'userauths' isn't unique. You may not be able to reverse all URLs in this namespaceNo changes detected
And when I am running python manage.py migrate it says:
System check identified some issues:WARNINGS:?: (urls.W005) URL namespace 'userauths' isn't unique. You may not be able to reverse all URLs in this namespaceOperations to perform: Apply all migrations: admin, auth, contenttypes, sessionsRunning migrations:
Now When I am going to admin pannel there is a table called colour but when I am clicking it there is an
no such table: core_colour
errorIN settings.py:
"""Django settings for ecomprj project.Generated by 'django-admin startproject' using Django 5.0.1.For more information on this file, seehttps://docs.djangoproject.com/en/5.0/topics/settings/For the full list of settings and their values, seehttps://docs.djangoproject.com/en/5.0/ref/settings/"""from pathlib import Pathimport 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# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/# SECURITY WARNING: keep the secret key used in production secret!SECRET_KEY = 'django-insecure-^mlg-*n8+um7^s$ivuodjy$sma!&ilikxhs^!t69k#&kuj-$gd'# SECURITY WARNING: don't run with debug turned on in production!DEBUG = TrueALLOWED_HOSTS = []# Application definitionINSTALLED_APPS = ['jazzmin','colorfield','core.apps.CoreConfig','django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles', # Custom Apps # 'core','userauths']MIDDLEWARE = ['django.middleware.security.SecurityMiddleware','django.contrib.sessions.middleware.SessionMiddleware','django.middleware.common.CommonMiddleware','django.middleware.csrf.CsrfViewMiddleware','django.contrib.auth.middleware.AuthenticationMiddleware','django.contrib.messages.middleware.MessageMiddleware','django.middleware.clickjacking.XFrameOptionsMiddleware',]ROOT_URLCONF = 'ecomprj.urls'TEMPLATES = [ {'BACKEND': 'django.template.backends.django.DjangoTemplates','DIRS': [os.path.join(BASE_DIR,'templates')],'APP_DIRS': True,'OPTIONS': {'context_processors': ['django.template.context_processors.debug','django.template.context_processors.request','django.contrib.auth.context_processors.auth','django.contrib.messages.context_processors.messages', ], }, },]WSGI_APPLICATION = 'ecomprj.wsgi.application'# Database# https://docs.djangoproject.com/en/5.0/ref/settings/#databasesDATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3','NAME': os.path.join(BASE_DIR , 'db.sqlite3'), }}# Password validation# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validatorsAUTH_PASSWORD_VALIDATORS = [ {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', },]# Internationalization# https://docs.djangoproject.com/en/5.0/topics/i18n/LANGUAGE_CODE = 'en-us'TIME_ZONE = 'UTC'USE_I18N = TrueUSE_TZ = True# Static files (CSS, JavaScript, Images)# https://docs.djangoproject.com/en/5.0/howto/static-files/STATIC_URL = '/static/'STATIC_ROOT=os.path.join(BASE_DIR,'staticfiles')STATICFILES_DIRS=[os.path.join(BASE_DIR,'static')]MEDIA_URL='/media/'MEDIA_ROOT=os.path.join(BASE_DIR,"media")# Default primary key field type# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-fieldDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'JAZZMIN_SETTINGS={'site_header':"Sagarmoy Shop",'site_brand':"Sagarmoy Shop",'site_logo':"assets/images/logo/logo1.jpg",'site_copyright':"Sagarmoy Shop.com"}AUTH_USER_MODEL = 'userauths.CustomUser'
See in settings.py I Installed core app. Even my other models are working properly.