Skip to content

Commit

Permalink
Merge pull request #44 from toggle-corp/feature/organization-model
Browse files Browse the repository at this point in the history
Add organization model
  • Loading branch information
susilnem authored Dec 17, 2024
2 parents 79248d3 + 56238c1 commit 7f792fd
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 2 deletions.
1 change: 1 addition & 0 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"user",
"common",
"content",
"organization",
"rest_framework",
]

Expand Down
Empty file added organization/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions organization/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin

from .models import Organization

# Register your models here.


@admin.register(Organization)
class OrganizationAdmin(admin.ModelAdmin):
list_display = ["name", "navbar_color"]
6 changes: 6 additions & 0 deletions organization/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class OrganizationConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "organization"
49 changes: 49 additions & 0 deletions organization/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 5.1.1 on 2024-12-11 10:29

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


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name="Organization",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("created_at", models.DateTimeField(auto_now_add=True)),
("modified_at", models.DateTimeField(auto_now=True)),
("name", models.CharField(max_length=40)),
("image", models.ImageField(upload_to="organization")),
("slider_bar_color", models.CharField(default="#f56f42", max_length=10)),
("navbar_color", models.CharField(default="#f81341", max_length=10)),
(
"created_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="%(class)s_created",
to=settings.AUTH_USER_MODEL,
),
),
(
"modified_by",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
related_name="%(class)s_modified",
to=settings.AUTH_USER_MODEL,
),
),
],
options={
"ordering": ["-id"],
"abstract": False,
},
),
]
Empty file.
15 changes: 15 additions & 0 deletions organization/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.db import models

from common.models import UserResource

# Create your models here.


class Organization(UserResource):
name = models.CharField(max_length=40)
image = models.ImageField(upload_to="organization")
slider_bar_color = models.CharField(max_length=10, default="#f56f42")
navbar_color = models.CharField(max_length=10, default="#f81341")

def __str__(self):
return self.name
Empty file added organization/tests.py
Empty file.
Empty file added organization/views.py
Empty file.
95 changes: 93 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ redis = "^5.0.8"
djangorestframework = "^3.15.2"
gunicorn = "*"
django-storages = { version = "*", extras = ["s3"] }
pillow = "^11.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 7f792fd

Please sign in to comment.