我在這裏第一次搞亂了Django,並且我已經設置了一些初步的東西。在管理頁面上,我有一個正常工作的數據庫功能的自定義應用程序。但是,鏈接文本不正確(以紅色here突出顯示)。它應該只是說沒有第二個「s」的「食譜」。我無法弄清楚爲什麼會發生這種情況或如何解決這個問題。以下是我已經檢查過的一些關鍵文件的代碼。Django App中的錯誤鏈接文本
settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'recipes',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
models.py
from django.db import models
class Recipes(models.Model):
name = models.CharField(max_length=100)
ingredients = models.CharField(max_length=1000)
def __unicode__(self):
return self.name + "/" + self.ingredients
admin.py
from recipes.models import Recipes
from django.contrib import admin
admin.site.register(Recipes)
根據記錄,我爲這個應用程序文件夾也命名爲 「菜譜」。
我該如何解決這個問題?