You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it is not possible to put the language field directly on the user model because the get_default_language() function expects to find it on a related model of the one specified in PINAX_NOTIFICATIONS_LANGUAGE_MODEL. I'm referring to this part of the code:
While I understand the reasoning for this, I think it would be useful to also look for the language in the user model directly. Something like:
model=settings.PINAX_NOTIFICATIONS_GET_LANGUAGE_MODEL()
try:
language=model._default_manager.get(user__id__exact=user.id)
exceptFieldError: # maybe we're using custom a user model?language=getattr(model, "language", None)
If this is not acceptable, adding FieldError to the tuple of exceptions which are caught would at least allow the function to still complete without error.
This would cater for use cases where the user model has been extended with additional fields.
The text was updated successfully, but these errors were encountered:
Currently it is not possible to put the
language
field directly on the user model because theget_default_language()
function expects to find it on a related model of the one specified inPINAX_NOTIFICATIONS_LANGUAGE_MODEL
. I'm referring to this part of the code:pinax-notifications/pinax/notifications/models.py
Line 131 in ac0fc53
While I understand the reasoning for this, I think it would be useful to also look for the language in the user model directly. Something like:
If this is not acceptable, adding
FieldError
to the tuple of exceptions which are caught would at least allow the function to still complete without error.This would cater for use cases where the user model has been extended with additional fields.
The text was updated successfully, but these errors were encountered: