2👍
✅
Take a look at the middleware from the django_app:
and either create your own based on this or extended by overriding. As mentioned there, probably the get_message method.
👤Rush
1👍
to handle this, I do the following:
settings.py
...
SOCIAL_AUTH_PIPELINE = (
'social.pipeline.social_auth.social_details',
'social.pipeline.social_auth.social_uid',
'social.pipeline.social_auth.auth_allowed',
'social.pipeline.social_auth.social_user',
'social.pipeline.social_auth.associate_user',
'social.pipeline.social_auth.load_extra_data',
'social.pipeline.user.user_details',
# the custom pipeline step
'accounts.views.user_details_after',
)
...
views.py
def user_details_after(strategy, details, user=None, *args, **kwargs):
if not user:
messages.info(strategy.request, "You have to sign up first.")
in the loging template I render the message to display it to the user.
👤udo
- [Django]-User with permission to modify only one field of the model in the Django Admin
- [Django]-Django CreateView filter foreign key in select field
- [Django]-ValueError('Related model %r cannot be resolved' % self.remote_field.model) inside a single app
- [Django]-Angular JS and Django
0👍
A simpler way is to just render the error page with the info you want, like
return render(
request,
"error.html",
{
"error_title":"Custom Error",
"error_message":"This is an error"
}
)
and your templates/error.html
template
<h1>{{ error_title }}</h1>
<p>{{ error_message }}</p>
Source:stackexchange.com