Skip to content

Commit

Permalink
style(linters): run pre-commit and obey rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehr-akbarzadeh committed Sep 3, 2024
1 parent 670f03e commit df0f1cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sage_newsletter/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def get_context_data(self, **kwargs):
return context

def post(self, request, *args, **kwargs):
"""
Handles POST requests for newsletter subscription.
"""Handles POST requests for newsletter subscription.
This method processes the newsletter subscription form. If the form is valid,
it either adds a new subscription or reactivates an existing one. Appropriate
Expand All @@ -68,6 +67,7 @@ def post(self, request, *args, **kwargs):
Returns:
HttpResponseRedirect: Redirects to the specified URL on success.
HttpResponse: Renders the template with context on failure.
"""
form = self.form_class(request.POST)
if form.is_valid():
Expand All @@ -84,9 +84,9 @@ def post(self, request, *args, **kwargs):
request, _("You have successfully subscribed to the newsletter.")
)
return redirect(request.path)

# Check if the view has a get_queryset method
if hasattr(self, 'get_queryset'):
if hasattr(self, "get_queryset"):
self.object_list = self.get_queryset()

# Handling for DetailView
Expand Down

0 comments on commit df0f1cf

Please sign in to comment.