-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from toggle-corp/feature/organization-model
Add organization model
- Loading branch information
Showing
11 changed files
with
175 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -149,6 +149,7 @@ | |
"user", | ||
"common", | ||
"content", | ||
"organization", | ||
"rest_framework", | ||
] | ||
|
||
|
Empty file.
This file contains 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,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"] |
This file contains 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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class OrganizationConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "organization" |
This file contains 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,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.
This file contains 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 @@ | ||
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.
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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