Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 5 Tests #28

Open
mental-that-like opened this issue Jan 26, 2024 · 0 comments
Open

Chapter 5 Tests #28

mental-that-like opened this issue Jan 26, 2024 · 0 comments

Comments

@mental-that-like
Copy link

mental-that-like commented Jan 26, 2024

The tests for Chapter 5 are producing the error message on line 178 of the tests_chapter5.py file. The error message reads:
"We couldn't find the correct output in the Page view within the admin interface for page listings. Did you complete the exercises, adding extra columns to the admin view for this model? Are the columns in the correct order?"

I can see that the pertinent test checks whether expected_str is in response_body. When I print response_body, the string is identical to expected_str except for the start of the string, which begins instead of , but everything else is the same.

I.e. response_body reads:

image

instead of:

image

The code in my admin.py file for the project reads as follows:

"from django.contrib import admin
from rango.models import Category, Page

class PageAdmin (admin.ModelAdmin):
list_display = ('title', 'category', 'url')

Register your models here.

admin.site.register(Category)
admin.site.register(Page,PageAdmin)"

which matches the code suggested in the Excercise Hints part of the book on Page 89. The code also produces the correct Pages view on the /admin/ site:

image

The above is a screenshot of the /admin/ page from my project which exactly matches the screenshot on page 88 of the book.

I am running a later version of Django than suggested in the book (4.1), which perhaps explains this error.

Can you please confirm whether there is something wrong with my implementation or whether the error is produced due to external reasons (e.g. using a later version of Django)? Thanks in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant