BuildmLearn/University-Campus-Portal-UCP

TypeError at /news/

Closed this issue · 7 comments

Without login if user try to acces /news/ url then this error occurs :-

TypeError at /news/
int() argument must be a string or a number, not 'SimpleLazyObje

same error for /events/ & /results/ & /schedule/ & /discussions/ & /user/edit_profile/ /pending_events/ urls without login

So U mean we need to redirect the user to login?

Yes we need to redirect the user to the login page if he is not logged in and tries to open one of these pages. This can be done using the login_required decorator. Since we have used Class based views, we would need to override the dispatch method in each of them and add the login required method decorator. That should do the job

@pranav15197 is right. and while writing code we should always use error handlers. means somehow if someone tries to do some hack on website. there should be 404 Error or something else.

Okay, so I should make a 404 Error page and redirect to that page.
Am I right?

@mukeshkharita here use of login_required decorator is correct. I was talking about a general 404 page to render whenever any error occur on server. means if somehow there is mistake by developer then that 404 page will render. we can do it by error handlers.

@pranav15197 Is there any problem with these commits?