Skip to content
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

Remove simple history change reason #924

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adserver/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from django.utils.text import slugify
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
from simple_history.utils import update_change_reason

from .models import Advertisement
from .models import Campaign
Expand Down Expand Up @@ -1358,7 +1357,8 @@ def save(self, commit=True):
user.invite_user()

# Track who added this user
update_change_reason(user, "Invited via authorized users view")
# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(user, "Invited via authorized users view")

# You will need to add the user to the publisher/advertiser in the view
return user
Expand Down
35 changes: 22 additions & 13 deletions adserver/staff/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from djstripe.models import Customer
from simple_history.utils import update_change_reason

from ..constants import EMAILED
from ..constants import PUBLISHER_HOUSE_CAMPAIGN
Expand Down Expand Up @@ -110,7 +109,10 @@ def create_user(self):
user_email = self.cleaned_data["user_email"]

user = User.objects.create_user(name=user_name, email=user_email, password="")
update_change_reason(user, self.message)

# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(user, self.message)

if hasattr(user, "invite_user"):
user.invite_user()
return user
Expand All @@ -134,7 +136,7 @@ def create_advertiser(self):
campaign.publisher_groups.add(pub_group)

flight_name = f"{advertiser_name} Initial Flight"
flight = Flight.objects.create(
Flight.objects.create(
campaign=campaign,
name=flight_name,
slug=slugify(flight_name),
Expand All @@ -145,9 +147,10 @@ def create_advertiser(self):
},
)

update_change_reason(advertiser, self.message)
update_change_reason(campaign, self.message)
update_change_reason(flight, self.message)
# See https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(advertiser, self.message)
# update_change_reason(campaign, self.message)
# update_change_reason(flight, self.message)

return advertiser

Expand Down Expand Up @@ -256,7 +259,10 @@ def create_user(self):
user_email = self.cleaned_data["user_email"]

user = User.objects.create_user(name=user_name, email=user_email, password="")
update_change_reason(user, self.message)

# See https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(user, self.message)

if hasattr(user, "invite_user"):
user.invite_user()
return user
Expand All @@ -277,7 +283,8 @@ def create_publisher(self):
if group_obj:
group_obj.publishers.add(publisher)

update_change_reason(publisher, self.message)
# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(publisher, self.message)

# Create this publisher's advertiser account
self.create_publisher_advertiser_account(publisher)
Expand Down Expand Up @@ -305,7 +312,7 @@ def create_publisher_advertiser_account(self, publisher):
campaign.publisher_groups.add(pub_group)

flight_name = f"{publisher.name} House Ads"
flight = Flight.objects.create(
Flight.objects.create(
campaign=campaign,
name=flight_name,
slug=slugify(flight_name),
Expand All @@ -316,9 +323,10 @@ def create_publisher_advertiser_account(self, publisher):
},
)

update_change_reason(advertiser, self.message)
update_change_reason(campaign, self.message)
update_change_reason(flight, self.message)
# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(advertiser, self.message)
# update_change_reason(campaign, self.message)
# update_change_reason(flight, self.message)

def save(self):
"""Create the publisher and associated objects. Send the invitation to the user account."""
Expand Down Expand Up @@ -408,6 +416,7 @@ def save(self):
status=EMAILED,
)

update_change_reason(payout, "Payout via staff interface")
# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(payout, "Payout via staff interface")

return payout
8 changes: 4 additions & 4 deletions adserver/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from django_slack import slack_message
from simple_history.utils import update_change_reason

from config.celery_app import app

Expand Down Expand Up @@ -886,9 +885,10 @@ def notify_of_completed_flights():
flight.save()

# Store the change reason in the history
update_change_reason(
flight, f"Hard stopped with ${value_remaining} value remaining."
)
# See: https://github.com/jazzband/django-simple-history/issues/1181
# update_change_reason(
# flight, f"Hard stopped with ${value_remaining} value remaining."
# )

completed_flights_by_advertiser[flight.campaign.advertiser.slug].append(
flight
Expand Down
Loading