我分叉并克隆了一个gitlab仓库。它包含了一堆测试你
除了test_feature_08.py,所有测试都通过了,我不知道现在还能做些什么来让它通过
receipts.views.py
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from receipts.models import Receipt
@login_required
def receipt_list(request):
receipts = Receipt.objects.filter(purchaser=request.user)
context = {
"receipts": receipts,
}
return render(request, "receipts/list.html", context)
receipts.urls.py
from django.urls import path
from receipts.views import receipt_list
urlpatterns = [
path("", receipt_list, name="home"),
]
expenses.urls.py
from django.contrib import admin
from django.urls import include, path
from django.shortcuts import redirect
def return_home(request):
return redirect("home")
urlpatterns = [
path("", return_home),
path("admin/", admin.site.urls),
path("receipts/", include("receipts.urls")),
path("accounts/", include("accounts.urls")),
]
Traceback (most recent call last):
File "/Users/tommyg/django-two-shot/receipts/views.py", line 3, in <module>
from receipts.models import Receipt
ModuleNotFoundError: No module named 'receipts'
1条答案
按热度按时间bvn4nwqk1#
将
"receipts",
添加到settings.py
文件中的INSTALLED_APPS
列表中。