AttributeError at /admin/r/31/4/ 'NoneType' object has no attribute 'startswith'

Asked 1 months ago, Updated 1 months ago, 373 views

Hello, everyone. I was making something with janggo and got stuck, but I don't understand why the error message came out, so I'm asking if anyone knows. I Googled and tried it, but I really didn't get it.

to sum up the situation Create a collection in the form of a post and a corresponding category. Both category and model created get_absolute_url, and category loaded well. However, the model can be displayed, but the click itself cannot be clicked on the screen when put in HTML. class LectureDetail(DetailView): model = Lecture def lecture_detail(request, id): lecture = get_object_or_404(Lecture, id=id) return render(request, 'instructor/lecture_detail.html', {'lecture':lecture})

In this way, I created two apps with almost the same view and model, but I can't click both on the screen ({l.get_absolute_url}}). If you look at the detail page through the admin, only one side of the error appears.

I don't know if it's because the model name is duplicated. But to do that, there was no problem putting one category model into other apps?

I'm sorry for the question. --;;

django python

2023-01-26 06:10

1 Answers

'NoneType' object has no attribute 'startswith'

You put None in the command where you need to take out the property startwith. I can see all the problems with this phrase, but I don't know which one you don't know.

The fact that the implemented page cannot be clicked appears to be due to the fact that the element is not wrapped around the tag a.

2023-01-26 08:53

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.