-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add alert review #3160
Add alert review #3160
Conversation
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Codecov Report
@@ Coverage Diff @@
## master #3160 +/- ##
=======================================
Coverage 97.82% 97.83%
=======================================
Files 273 273
Lines 19075 19087 +12
=======================================
+ Hits 18661 18673 +12
Misses 414 414
Continue to review full report at Codecov.
|
geotrek/trekking/tests/test_views.py
Outdated
@override_settings(ALERT_REVIEW=True) | ||
def test_status_review_alert(self): | ||
element_not_published = self.modelfactory.create() | ||
element_not_published.published = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je l'aurais plutôt mis dans la factory et enlevé cette ligne
element_not_published.published = False | |
element_not_published = self.modelfactory.create(published=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ ajouter le changelog
geotrek/common/mixins/models.py
Outdated
@@ -317,6 +319,14 @@ class PublishableMixin(BasePublishableMixin): | |||
class Meta: | |||
abstract = True | |||
|
|||
def save(self, *args, **kwargs): | |||
old_object = self.__class__.objects.filter(pk=self.pk) | |||
if (old_object and getattr(old_object, 'review', None) != self.review and self.review) and settings.ALERT_REVIEW: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can't acces review attribute from a queryset, you should get instance from qs
geotrek/common/mixins/models.py
Outdated
if (self.pk and self.__class__.objects.get(pk=self.pk).review != self.review and self.review) and settings.ALERT_REVIEW: | ||
subject = _("{obj} need a review").format(obj=self) | ||
message = render_to_string('common/review_email_message.txt', {"obj": self}) | ||
mail_managers(subject, message, fail_silently=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fail_silently=False -> unable to modify review attribute if mail server or configuration has problem
No description provided.