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

Create event model and its children #9123

Open
wants to merge 2 commits into
base: dev-v3
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version = 1

test_patterns = ["tests/**"]

exclude_patterns = ["migrations/**"]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
max_line_length = 90

[[analyzers]]
name = "test-coverage"
enabled = true

[[analyzers]]
name = "docker"
enabled = true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__/
.tool-versions
Pipfile*
.env
.vscode/
**/.DS_Store
Empty file.
1 change: 1 addition & 0 deletions discount_code_tickets/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions discount_code_tickets/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DiscountCodeTicketsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "discount_code_tickets"
20 changes: 20 additions & 0 deletions discount_code_tickets/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 5.0 on 2024-03-12 03:59

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='DiscountCodeTicket',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
]
28 changes: 28 additions & 0 deletions discount_code_tickets/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.0 on 2024-03-12 03:59

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
('discount_code_tickets', '0001_initial'),
('events', '0001_initial'),
('tickets', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='discountcodeticket',
name='event',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.event'),
),
migrations.AddField(
model_name='discountcodeticket',
name='ticket',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='tickets.ticket'),
),
]
Empty file.
10 changes: 10 additions & 0 deletions discount_code_tickets/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.db import models

from events.models import Event
from tickets.models import Ticket


# Create your models here.
class DiscountCodeTicket(models.Model):
event = models.ForeignKey(Event, on_delete=models.CASCADE)
ticket = models.ForeignKey(Ticket, on_delete=models.CASCADE)
1 change: 1 addition & 0 deletions discount_code_tickets/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your tests here.
1 change: 1 addition & 0 deletions discount_code_tickets/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.
Empty file added discount_codes/__init__.py
Empty file.
1 change: 1 addition & 0 deletions discount_codes/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions discount_codes/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DiscountCodesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "discount_codes"
34 changes: 34 additions & 0 deletions discount_codes/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Generated by Django 5.0 on 2024-03-12 03:59

import django.contrib.postgres.fields.citext
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='DiscountCode',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', django.contrib.postgres.fields.citext.CICharField(max_length=255, null=True, unique=True)),
('value', models.FloatField()),
('type', models.CharField(max_length=255)),
('is_active', models.BooleanField(blank=True, null=True)),
('tickets_number', models.IntegerField(blank=True, null=True)),
('min_quantity', models.IntegerField(blank=True, null=True)),
('max_quantity', models.IntegerField(blank=True, null=True)),
('valid_from', models.DateTimeField(blank=True, null=True)),
('valid_till', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(blank=True, null=True)),
('used_for', models.CharField(max_length=255)),
('discount_url', models.URLField(blank=True, null=True)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
],
),
]
29 changes: 29 additions & 0 deletions discount_codes/migrations/0002_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.0 on 2024-03-12 03:59

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
('discount_codes', '0001_initial'),
('events', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AddField(
model_name='discountcode',
name='associated_event',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='events.event'),
),
migrations.AddField(
model_name='discountcode',
name='marketer',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
),
]
Empty file.
23 changes: 23 additions & 0 deletions discount_codes/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from django.contrib.postgres.fields import CICharField
from django.db import models

from users.models import CustomUser


class DiscountCode(models.Model):
code = CICharField(max_length=255, unique=True, null=True)
value = models.FloatField()
type = models.CharField(max_length=255)
is_active = models.BooleanField(null=True, blank=True)
tickets_number = models.IntegerField(null=True, blank=True)
min_quantity = models.IntegerField(null=True, blank=True)
max_quantity = models.IntegerField(null=True, blank=True)
valid_from = models.DateTimeField(null=True, blank=True)
valid_till = models.DateTimeField(null=True, blank=True)
associated_event = models.ForeignKey("events.Event", on_delete=models.SET_NULL, null=True, blank=True)
# Use 'associated_event' to avoid naming conflict. Using'events.Event' as a string to avoid circular import.
created_at = models.DateTimeField(null=True, blank=True)
marketer = models.ForeignKey(CustomUser, on_delete=models.SET_NULL, null=True, blank=True)
used_for = models.CharField(max_length=255)
discount_url = models.URLField(blank=True, null=True)
deleted_at = models.DateTimeField(null=True, blank=True)
1 change: 1 addition & 0 deletions discount_codes/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your tests here.
1 change: 1 addition & 0 deletions discount_codes/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.
Empty file added event_sub_topics/__init__.py
Empty file.
1 change: 1 addition & 0 deletions event_sub_topics/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions event_sub_topics/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class EventSubTopicsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "event_sub_topics"
25 changes: 25 additions & 0 deletions event_sub_topics/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 5.0 on 2024-03-12 03:59

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
('event_topics', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='EventSubTopic',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('slug', models.CharField(max_length=200)),
('event_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='event_topics.eventtopic')),
],
),
]
Empty file.
10 changes: 10 additions & 0 deletions event_sub_topics/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.db import models

from event_topics.models import EventTopic


# Create your models here.
class EventSubTopic(models.Model):
name = models.CharField(max_length=200)
slug = models.CharField(max_length=200)
event_type = models.ForeignKey(EventTopic, on_delete=models.SET_NULL, null=True, blank=True)
1 change: 1 addition & 0 deletions event_sub_topics/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your tests here.
1 change: 1 addition & 0 deletions event_sub_topics/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.
Empty file added event_types/__init__.py
Empty file.
1 change: 1 addition & 0 deletions event_types/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions event_types/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class EventTypesConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "event_types"
23 changes: 23 additions & 0 deletions event_types/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.0 on 2024-03-12 03:59

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='EventType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('slug', models.CharField(max_length=200)),
('deleted_at', models.DateTimeField(blank=True, null=True)),
],
),
]
Empty file.
11 changes: 11 additions & 0 deletions event_types/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.db import models


# Create your models here.
class EventType(models.Model):
name = models.CharField(max_length=200)
slug = models.CharField(max_length=200)
deleted_at = models.DateTimeField(null=True, blank=True)

def __str__(self):
return self.name
1 change: 1 addition & 0 deletions event_types/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your tests here.
1 change: 1 addition & 0 deletions event_types/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Create your views here.
Empty file added events/__init__.py
Empty file.
1 change: 1 addition & 0 deletions events/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Register your models here.
6 changes: 6 additions & 0 deletions events/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class EventsConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "events"
Loading