Skip to content

Commit

Permalink
Add organization model
Browse files Browse the repository at this point in the history
  • Loading branch information
sudan45 committed Dec 17, 2024
1 parent 79248d3 commit ee35987
Show file tree
Hide file tree
Showing 11 changed files with 164 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.
9 changes: 9 additions & 0 deletions organization/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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'
35 changes: 35 additions & 0 deletions organization/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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.
13 changes: 13 additions & 0 deletions organization/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
3 changes: 3 additions & 0 deletions organization/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions organization/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
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 ee35987

Please sign in to comment.