init commit
This commit is contained in:
commit
2db4593dc9
47 changed files with 598 additions and 0 deletions
54
README.md
Normal file
54
README.md
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# Summary
|
||||
|
||||
# Detailed Design
|
||||
|
||||
## Functionality
|
||||
|
||||
### User Creates an Event
|
||||
|
||||
- Fills out form
|
||||
- form includes:
|
||||
- Event Address
|
||||
- Event Name
|
||||
- Event Description
|
||||
- Event Start Time
|
||||
- Event End Time
|
||||
- Rain Date
|
||||
- Price
|
||||
|
||||
- Images
|
||||
- Category
|
||||
- Tagging (optional)
|
||||
- RSVP Needed (optio nal)
|
||||
- Contact Info (optional)
|
||||
- Share Email (optional)
|
||||
- Event Size (how many people will go) (optional)
|
||||
- Event Size Maximum (optional)
|
||||
- After filling out form:
|
||||
- Direct to event page
|
||||
- Event page allows editing, cancelling
|
||||
- share on all platforms
|
||||
|
||||
### User Searches for an event
|
||||
- Types in location, or read location
|
||||
- Provides radius (default provided)
|
||||
- Events populate
|
||||
- events are clickable and show more Info
|
||||
- ability to say they are going to an event (require login)
|
||||
- email event to me, or others
|
||||
- share on all platforms
|
||||
- user can add event to list of events associated to their account
|
||||
- users can filter events by category, tag, date
|
||||
- users can comment on events, and post pictures of events that they went to (require login)
|
||||
|
||||
## User Flow
|
||||
|
||||
## Web Pages
|
||||
|
||||
## DB Structure
|
||||
|
||||
## API Endpoints
|
||||
|
||||
## Authentication
|
||||
|
||||
# Dependencies
|
||||
0
api/__init__.py
Normal file
0
api/__init__.py
Normal file
BIN
api/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
api/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
api/__pycache__/admin.cpython-314.pyc
Normal file
BIN
api/__pycache__/admin.cpython-314.pyc
Normal file
Binary file not shown.
BIN
api/__pycache__/apps.cpython-314.pyc
Normal file
BIN
api/__pycache__/apps.cpython-314.pyc
Normal file
Binary file not shown.
BIN
api/__pycache__/models.cpython-314.pyc
Normal file
BIN
api/__pycache__/models.cpython-314.pyc
Normal file
Binary file not shown.
3
api/admin.py
Normal file
3
api/admin.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
api/apps.py
Normal file
5
api/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ApiConfig(AppConfig):
|
||||
name = "api"
|
||||
0
api/migrations/__init__.py
Normal file
0
api/migrations/__init__.py
Normal file
BIN
api/migrations/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
api/migrations/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
3
api/models.py
Normal file
3
api/models.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
3
api/tests.py
Normal file
3
api/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
api/views.py
Normal file
3
api/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
BIN
db.sqlite3
Normal file
BIN
db.sqlite3
Normal file
Binary file not shown.
0
localist/__init__.py
Normal file
0
localist/__init__.py
Normal file
BIN
localist/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
localist/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
localist/__pycache__/settings.cpython-314.pyc
Normal file
BIN
localist/__pycache__/settings.cpython-314.pyc
Normal file
Binary file not shown.
BIN
localist/__pycache__/urls.cpython-314.pyc
Normal file
BIN
localist/__pycache__/urls.cpython-314.pyc
Normal file
Binary file not shown.
BIN
localist/__pycache__/wsgi.cpython-314.pyc
Normal file
BIN
localist/__pycache__/wsgi.cpython-314.pyc
Normal file
Binary file not shown.
16
localist/asgi.py
Normal file
16
localist/asgi.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
ASGI config for localist project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "localist.settings")
|
||||
|
||||
application = get_asgi_application()
|
||||
119
localist/settings.py
Normal file
119
localist/settings.py
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
"""
|
||||
Django settings for localist project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 6.0.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/6.0/ref/settings/
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/6.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = "django-insecure-pek1teheggj8zzvtcntp4-u#s_^yc$&a@3f7wi+u%8)g*2xezw"
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"django.contrib.admin",
|
||||
"django.contrib.auth",
|
||||
"django.contrib.contenttypes",
|
||||
"django.contrib.sessions",
|
||||
"django.contrib.messages",
|
||||
"django.contrib.staticfiles",
|
||||
"web",
|
||||
"api",
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
]
|
||||
|
||||
ROOT_URLCONF = "localist.urls"
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [],
|
||||
"APP_DIRS": True,
|
||||
"OPTIONS": {
|
||||
"context_processors": [
|
||||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = "localist.wsgi.application"
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": BASE_DIR / "db.sqlite3",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/6.0/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
|
||||
},
|
||||
{
|
||||
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/6.0/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = "en-us"
|
||||
|
||||
TIME_ZONE = "UTC"
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/6.0/howto/static-files/
|
||||
|
||||
STATIC_URL = "static/"
|
||||
23
localist/urls.py
Normal file
23
localist/urls.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"""
|
||||
URL configuration for localist project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/6.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
urlpatterns = [
|
||||
path("admin/", admin.site.urls),
|
||||
]
|
||||
16
localist/wsgi.py
Normal file
16
localist/wsgi.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""
|
||||
WSGI config for localist project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/6.0/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "localist.settings")
|
||||
|
||||
application = get_wsgi_application()
|
||||
0
web/__init__.py
Normal file
0
web/__init__.py
Normal file
BIN
web/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
web/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/__pycache__/admin.cpython-314.pyc
Normal file
BIN
web/__pycache__/admin.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/__pycache__/apps.cpython-314.pyc
Normal file
BIN
web/__pycache__/apps.cpython-314.pyc
Normal file
Binary file not shown.
12
web/admin.py
Normal file
12
web/admin.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from django.contrib import admin
|
||||
from web.models.category import Category, CategoryAdmin
|
||||
from web.models.event import Event, EventAdmin
|
||||
from web.models.event_category import EventCategory, EventCategoryAdmin
|
||||
from web.models.event_tag import EventTag, EventTagAdmin
|
||||
from web.models.tag import Tag, TagAdmin
|
||||
|
||||
admin.site.register(Category, CategoryAdmin)
|
||||
admin.site.register(Event, EventAdmin)
|
||||
admin.site.register(EventCategory, EventCategoryAdmin)
|
||||
admin.site.register(EventTag, EventTagAdmin)
|
||||
admin.site.register(Tag, TagAdmin)
|
||||
5
web/apps.py
Normal file
5
web/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class WebConfig(AppConfig):
|
||||
name = "web"
|
||||
169
web/migrations/0001_initial.py
Normal file
169
web/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
# Generated by Django 6.0.6 on 2026-06-13 19:01
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="Category",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
||||
("active", models.BooleanField(default=True)),
|
||||
("name", models.CharField()),
|
||||
("description", models.TextField()),
|
||||
],
|
||||
options={
|
||||
"db_table": "category",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Event",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
||||
("active", models.BooleanField(default=True)),
|
||||
("name", models.CharField()),
|
||||
("description", models.TextField()),
|
||||
("url", models.URLField()),
|
||||
("address", models.CharField()),
|
||||
(
|
||||
"status",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("scheduled", "Scheduled"),
|
||||
("completed", "Completed"),
|
||||
("canceled", "Canceled"),
|
||||
],
|
||||
default="scheduled",
|
||||
max_length=20,
|
||||
),
|
||||
),
|
||||
(
|
||||
"price",
|
||||
models.DecimalField(
|
||||
blank=True, decimal_places=2, default=None, max_digits=10
|
||||
),
|
||||
),
|
||||
("require_rsvp", models.BooleanField()),
|
||||
("start_time", models.DateTimeField()),
|
||||
("end_time", models.DateTimeField()),
|
||||
("rain_date", models.DateTimeField()),
|
||||
("email", models.EmailField(max_length=254)),
|
||||
("phone_number", models.CharField(blank=True, default=None)),
|
||||
],
|
||||
options={
|
||||
"db_table": "events",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="Tag",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
||||
("active", models.BooleanField(default=True)),
|
||||
("name", models.CharField()),
|
||||
],
|
||||
options={
|
||||
"db_table": "tag",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="EventCategory",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
||||
("active", models.BooleanField(default=True)),
|
||||
(
|
||||
"category",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="web.category"
|
||||
),
|
||||
),
|
||||
(
|
||||
"event",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="web.event"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"db_table": "event_categories",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="EventTag",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, null=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True, null=True)),
|
||||
("active", models.BooleanField(default=True)),
|
||||
(
|
||||
"event",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="web.event"
|
||||
),
|
||||
),
|
||||
(
|
||||
"tag",
|
||||
models.ForeignKey(
|
||||
on_delete=django.db.models.deletion.CASCADE, to="web.tag"
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"db_table": "event_tags",
|
||||
},
|
||||
),
|
||||
]
|
||||
0
web/migrations/__init__.py
Normal file
0
web/migrations/__init__.py
Normal file
BIN
web/migrations/__pycache__/0001_initial.cpython-314.pyc
Normal file
BIN
web/migrations/__pycache__/0001_initial.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/migrations/__pycache__/__init__.cpython-314.pyc
Normal file
BIN
web/migrations/__pycache__/__init__.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/base.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/base.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/category.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/category.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/event.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/event.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/event_category.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/event_category.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/event_tag.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/event_tag.cpython-314.pyc
Normal file
Binary file not shown.
BIN
web/models/__pycache__/tag.cpython-314.pyc
Normal file
BIN
web/models/__pycache__/tag.cpython-314.pyc
Normal file
Binary file not shown.
10
web/models/base.py
Normal file
10
web/models/base.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from django.db import models
|
||||
|
||||
|
||||
class BaseModel(models.Model):
|
||||
created_at = models.DateTimeField(blank=True, null=True, auto_now_add=True)
|
||||
updated_at = models.DateTimeField(blank=True, null=True, auto_now=True)
|
||||
active = models.BooleanField(default=True)
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
23
web/models/category.py
Normal file
23
web/models/category.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from web.models.base import BaseModel
|
||||
|
||||
|
||||
class Category(BaseModel):
|
||||
name = models.CharField()
|
||||
description = models.TextField()
|
||||
|
||||
class Meta:
|
||||
db_table = 'category'
|
||||
|
||||
|
||||
class CategoryAdmin(admin.ModelAdmin):
|
||||
search_fields = (
|
||||
'name',
|
||||
'description'
|
||||
)
|
||||
|
||||
list_display = (
|
||||
'name',
|
||||
'description',
|
||||
)
|
||||
58
web/models/event.py
Normal file
58
web/models/event.py
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from web.models.base import BaseModel
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
|
||||
class Event(BaseModel):
|
||||
class Status(models.TextChoices):
|
||||
SCHEDULED = 'scheduled', 'Scheduled'
|
||||
COMPLETED = 'completed', 'Completed'
|
||||
CANCELED = 'canceled', 'Canceled'
|
||||
|
||||
name = models.CharField()
|
||||
description = models.TextField()
|
||||
url = models.URLField()
|
||||
address = models.CharField()
|
||||
status = models.CharField(max_length=20, choices=Status.choices, default=Status.SCHEDULED)
|
||||
price = models.DecimalField(max_digits=10, default=None, blank=True, decimal_places=2)
|
||||
require_rsvp = models.BooleanField()
|
||||
|
||||
start_time = models.DateTimeField()
|
||||
end_time = models.DateTimeField()
|
||||
rain_date = models.DateTimeField()
|
||||
|
||||
email = models.EmailField()
|
||||
phone_number = models.CharField(default=None, blank=True)
|
||||
|
||||
class Meta:
|
||||
db_table = 'events'
|
||||
|
||||
|
||||
class EventAdmin(admin.ModelAdmin):
|
||||
search_fields = (
|
||||
'name',
|
||||
'description',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'rain_date',
|
||||
'url',
|
||||
'address',
|
||||
'status',
|
||||
'price',
|
||||
'require_rsvp',
|
||||
)
|
||||
|
||||
list_display = (
|
||||
'name',
|
||||
'description',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'rain_date',
|
||||
'url',
|
||||
'address',
|
||||
'status',
|
||||
'price',
|
||||
'require_rsvp',
|
||||
)
|
||||
25
web/models/event_category.py
Normal file
25
web/models/event_category.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from web.models.base import BaseModel
|
||||
from web.models.event import Event
|
||||
from web.models.category import Category
|
||||
|
||||
|
||||
class EventCategory(BaseModel):
|
||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
||||
category = models.ForeignKey(Category, on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
db_table = 'event_categories'
|
||||
|
||||
|
||||
class EventCategoryAdmin(admin.ModelAdmin):
|
||||
search_fields = (
|
||||
'event',
|
||||
'category',
|
||||
)
|
||||
|
||||
list_display = (
|
||||
'event',
|
||||
'category',
|
||||
)
|
||||
25
web/models/event_tag.py
Normal file
25
web/models/event_tag.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from web.models.base import BaseModel
|
||||
from web.models.event import Event
|
||||
from web.models.tag import Tag
|
||||
|
||||
|
||||
class EventTag(BaseModel):
|
||||
event = models.ForeignKey(Event, on_delete=models.CASCADE)
|
||||
tag = models.ForeignKey(Tag, on_delete=models.CASCADE)
|
||||
|
||||
class Meta:
|
||||
db_table = 'event_tags'
|
||||
|
||||
|
||||
class EventTagAdmin(admin.ModelAdmin):
|
||||
search_fields = (
|
||||
'event',
|
||||
'tag',
|
||||
)
|
||||
|
||||
list_display = (
|
||||
'event',
|
||||
'tag',
|
||||
)
|
||||
20
web/models/tag.py
Normal file
20
web/models/tag.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from django.db import models
|
||||
from django.contrib import admin
|
||||
from web.models.base import BaseModel
|
||||
|
||||
|
||||
class Tag(BaseModel):
|
||||
name = models.CharField()
|
||||
|
||||
class Meta:
|
||||
db_table = 'tag'
|
||||
|
||||
|
||||
class TagAdmin(admin.ModelAdmin):
|
||||
search_fields = (
|
||||
'name',
|
||||
)
|
||||
|
||||
list_display = (
|
||||
'name',
|
||||
)
|
||||
3
web/tests.py
Normal file
3
web/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
web/views.py
Normal file
3
web/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Loading…
Reference in a new issue