-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: event, presentation app & model & list API 개발 #19
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Register your models here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import importlib | ||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class EventConfig(AppConfig): | ||
| name = "event" | ||
|
|
||
| def ready(self): | ||
| importlib.import_module("event.translation") | ||
|
|
||
| from event.models import Event | ||
| from simple_history import register | ||
|
|
||
| register(Event) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| # Generated by Django 5.2 on 2025-06-05 11:04 | ||
|
|
||
| import uuid | ||
|
|
||
| import django.db.models.deletion | ||
| import simple_history.models | ||
| from django.conf import settings | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| initial = True | ||
|
|
||
| dependencies = [ | ||
| ("user", "0002_organization_historicalorganization_and_more"), | ||
| migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="Event", | ||
| fields=[ | ||
| ( | ||
| "id", | ||
| models.UUIDField( | ||
| default=uuid.uuid4, | ||
| editable=False, | ||
| primary_key=True, | ||
| serialize=False, | ||
| ), | ||
| ), | ||
| ("created_at", models.DateTimeField(auto_now_add=True)), | ||
| ("updated_at", models.DateTimeField(auto_now=True)), | ||
| ("deleted_at", models.DateTimeField(blank=True, null=True)), | ||
| ("name", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("name_ko", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("name_en", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("banner_image", models.TextField(blank=True, null=True)), | ||
| ("slogan", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ("slogan_ko", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ("slogan_en", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ( | ||
| "description", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ( | ||
| "description_ko", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ( | ||
| "description_en", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ("event_start_at", models.DateTimeField(blank=True, null=True)), | ||
| ("event_end_at", models.DateTimeField(blank=True, null=True)), | ||
| ( | ||
| "banner_display_start_at", | ||
| models.DateTimeField(blank=True, null=True), | ||
| ), | ||
| ("banner_display_end_at", models.DateTimeField(blank=True, null=True)), | ||
| ( | ||
| "created_by", | ||
| models.ForeignKey( | ||
| null=True, | ||
| on_delete=django.db.models.deletion.PROTECT, | ||
| related_name="%(class)s_created_by", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "deleted_by", | ||
| models.ForeignKey( | ||
| null=True, | ||
| on_delete=django.db.models.deletion.PROTECT, | ||
| related_name="%(class)s_deleted_by", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "organization", | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.PROTECT, | ||
| related_name="events", | ||
| to="user.organization", | ||
| ), | ||
| ), | ||
| ( | ||
| "updated_by", | ||
| models.ForeignKey( | ||
| null=True, | ||
| on_delete=django.db.models.deletion.PROTECT, | ||
| related_name="%(class)s_updated_by", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ], | ||
| options={ | ||
| "abstract": False, | ||
| }, | ||
| ), | ||
| migrations.CreateModel( | ||
| name="HistoricalEvent", | ||
| fields=[ | ||
| ( | ||
| "id", | ||
| models.UUIDField(db_index=True, default=uuid.uuid4, editable=False), | ||
| ), | ||
| ("created_at", models.DateTimeField(blank=True, editable=False)), | ||
| ("updated_at", models.DateTimeField(blank=True, editable=False)), | ||
| ("deleted_at", models.DateTimeField(blank=True, null=True)), | ||
| ("name", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("name_ko", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("name_en", models.CharField(blank=True, max_length=256, null=True)), | ||
| ("banner_image", models.TextField(blank=True, null=True)), | ||
| ("slogan", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ("slogan_ko", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ("slogan_en", models.CharField(blank=True, max_length=1000, null=True)), | ||
| ( | ||
| "description", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ( | ||
| "description_ko", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ( | ||
| "description_en", | ||
| models.CharField(blank=True, max_length=1000, null=True), | ||
| ), | ||
| ("event_start_at", models.DateTimeField(blank=True, null=True)), | ||
| ("event_end_at", models.DateTimeField(blank=True, null=True)), | ||
| ( | ||
| "banner_display_start_at", | ||
| models.DateTimeField(blank=True, null=True), | ||
| ), | ||
| ("banner_display_end_at", models.DateTimeField(blank=True, null=True)), | ||
| ("history_id", models.AutoField(primary_key=True, serialize=False)), | ||
| ("history_date", models.DateTimeField(db_index=True)), | ||
| ("history_change_reason", models.CharField(max_length=100, null=True)), | ||
| ( | ||
| "history_type", | ||
| models.CharField( | ||
| choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")], | ||
| max_length=1, | ||
| ), | ||
| ), | ||
| ( | ||
| "created_by", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| db_constraint=False, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.DO_NOTHING, | ||
| related_name="+", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "deleted_by", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| db_constraint=False, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.DO_NOTHING, | ||
| related_name="+", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "history_user", | ||
| models.ForeignKey( | ||
| null=True, | ||
| on_delete=django.db.models.deletion.SET_NULL, | ||
| related_name="+", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ( | ||
| "organization", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| db_constraint=False, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.DO_NOTHING, | ||
| related_name="+", | ||
| to="user.organization", | ||
| ), | ||
| ), | ||
| ( | ||
| "updated_by", | ||
| models.ForeignKey( | ||
| blank=True, | ||
| db_constraint=False, | ||
| null=True, | ||
| on_delete=django.db.models.deletion.DO_NOTHING, | ||
| related_name="+", | ||
| to=settings.AUTH_USER_MODEL, | ||
| ), | ||
| ), | ||
| ], | ||
| options={ | ||
| "verbose_name": "historical event", | ||
| "verbose_name_plural": "historical events", | ||
| "ordering": ("-history_date", "-history_id"), | ||
| "get_latest_by": ("history_date", "history_id"), | ||
| }, | ||
| bases=(simple_history.models.HistoricalChanges, models.Model), | ||
| ), | ||
| ] |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from core.models import BaseAbstractModel | ||
| from django.core.exceptions import ValidationError | ||
| from django.db import models | ||
| from user.models import Organization | ||
|
|
||
|
|
||
| class Event(BaseAbstractModel): | ||
| organization = models.ForeignKey(Organization, on_delete=models.PROTECT, related_name="events") | ||
| name = models.CharField(max_length=256, null=True, blank=True) | ||
| banner_image = models.TextField(null=True, blank=True) | ||
| slogan = models.CharField(max_length=1000, null=True, blank=True) | ||
| description = models.CharField(max_length=1000, null=True, blank=True) | ||
| event_start_at = models.DateTimeField(null=True, blank=True) | ||
| event_end_at = models.DateTimeField(null=True, blank=True) | ||
| banner_display_start_at = models.DateTimeField(null=True, blank=True) | ||
| banner_display_end_at = models.DateTimeField(null=True, blank=True) | ||
|
|
||
| def clean(self) -> None: | ||
| super().clean() | ||
| if self.event_start_at and self.event_end_at and self.event_start_at > self.event_end_at: | ||
| raise ValidationError("event의 종료 날짜는 시작 날짜보다 이전일 수 없습니다.") | ||
| if ( | ||
| self.banner_display_start_at | ||
| and self.banner_display_end_at | ||
| and self.banner_display_start_at > self.banner_display_end_at | ||
| ): | ||
| raise ValidationError("banner 전시 종료 날짜는 시작 날짜보다 이전일 수 없습니다.") |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Register your models here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import importlib | ||
|
|
||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class PresentationConfig(AppConfig): | ||
| name = "event.presentation" | ||
|
|
||
| def ready(self): | ||
| importlib.import_module("event.presentation.translation") | ||
|
|
||
| from event.presentation.models import Presentation, PresentationCategory, PresentationSpeaker, PresentationType | ||
| from simple_history import register | ||
|
|
||
| register(PresentationType) | ||
| register(PresentationCategory) | ||
| register(Presentation) | ||
| register(PresentationSpeaker) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.