Skip to content

Commit

Permalink
Merge pull request #16 from jdxnlabs/add-subscription-migrations
Browse files Browse the repository at this point in the history
Add subscription migrations
  • Loading branch information
sirodoht authored Sep 21, 2024
2 parents 0526399 + 9651e22 commit 995edd6
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/factory_apps/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def add_backing(self, create, extracted, **kwargs):
@factory.post_generation
def add_stuff(self, create, extracted, **kwargs):
# avoid recursive import
from . import events, payment
from . import events

LocationFeeFactory(location=self)

Expand Down
1 change: 0 additions & 1 deletion core/factory_apps/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .user import UserFactory



class BillFactory(DjangoModelFactory):
"""Bookings or BillLineItem"""

Expand Down
62 changes: 62 additions & 0 deletions core/migrations/0006_remove_backing_subscription_and_more.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Generated by Django 5.0.7 on 2024-09-21 19:26

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("core", "0005_membership"),
]

operations = [
migrations.RemoveField(
model_name="backing",
name="subscription",
),
migrations.RemoveField(
model_name="subscriptionbill",
name="subscription",
),
migrations.RemoveField(
model_name="subscriptionnote",
name="subscription",
),
migrations.RemoveField(
model_name="subscriptionbill",
name="bill_ptr",
),
migrations.RemoveField(
model_name="subscriptionnote",
name="created_by",
),
migrations.AlterField(
model_name="emailtemplate",
name="context",
field=models.CharField(choices=[("booking", "Booking")], max_length=32),
),
migrations.AlterField(
model_name="locationemailtemplate",
name="key",
field=models.CharField(
choices=[
("admin_daily_update", "Admin Daily Update"),
("guest_daily_update", "Guest Daily Update"),
("invoice", "Invoice"),
("receipt", "Booking Receipt"),
("newbooking", "New Booking"),
("pre_arrival_welcome", "Pre-Arrival Welcome"),
("departure", "Departure"),
],
max_length=32,
),
),
migrations.DeleteModel(
name="Subscription",
),
migrations.DeleteModel(
name="SubscriptionBill",
),
migrations.DeleteModel(
name="SubscriptionNote",
),
]
2 changes: 0 additions & 2 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
import logging
import os
import uuid
from datetime import date, timedelta
from decimal import Decimal

import django.dispatch
from dateutil.relativedelta import relativedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.flatpages.models import FlatPage
Expand Down
7 changes: 3 additions & 4 deletions core/views/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.db.models import Q
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
Expand All @@ -29,11 +28,9 @@
Bill,
BillLineItem,
Booking,
EmailTemplate,
Location,
LocationFee,
Payment,
UserNote,
)
from core.tasks import guest_welcome
from core.views import occupancy
Expand Down Expand Up @@ -294,7 +291,9 @@ def BillCharge(request, location_slug, bill_id):
"Cannot charge more than remaining amount owed ($%d was requested on $%d owed)"
% (charge_amount_dollars, bill.total_owed()),
)
raise Exception("bill charge error: cannot charge more than remaining amount owed")
raise Exception(
"bill charge error: cannot charge more than remaining amount owed"
)

if bill.is_booking_bill():
user = bill.bookingbill.booking.user
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruff==0.6.5
ruff==0.6.7

0 comments on commit 995edd6

Please sign in to comment.