aboutsummaryrefslogtreecommitdiff
path: root/announcements
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-10-02 11:55:14 -0400
committerBobby <[email protected]>2022-10-02 11:55:14 -0400
commit1e624f30c11e22699e6f6933b18a7a257a2ab73b (patch)
tree2dbe7838a7ada5e1cd61339119d6b43de3e148d5 /announcements
parentfb1225d85d9291a394e9b371231b02a85272d121 (diff)
downloadthatcomputerscientist-1e624f30c11e22699e6f6933b18a7a257a2ab73b.tar.xz
thatcomputerscientist-1e624f30c11e22699e6f6933b18a7a257a2ab73b.zip
Added announcements
Diffstat (limited to 'announcements')
-rw-r--r--announcements/__init__.py0
-rw-r--r--announcements/admin.py6
-rw-r--r--announcements/apps.py6
-rw-r--r--announcements/migrations/0001_initial.py29
-rw-r--r--announcements/migrations/0002_rename_date_announcement_created_at.py18
-rw-r--r--announcements/migrations/__init__.py0
-rw-r--r--announcements/models.py18
-rw-r--r--announcements/tests.py3
-rw-r--r--announcements/views.py3
9 files changed, 83 insertions, 0 deletions
diff --git a/announcements/__init__.py b/announcements/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/announcements/__init__.py
diff --git a/announcements/admin.py b/announcements/admin.py
new file mode 100644
index 00000000..7121e093
--- /dev/null
+++ b/announcements/admin.py
@@ -0,0 +1,6 @@
+from django.contrib import admin
+
+# Register your models here.
+from .models import Announcement
+
+admin.site.register(Announcement)
diff --git a/announcements/apps.py b/announcements/apps.py
new file mode 100644
index 00000000..0fe0715d
--- /dev/null
+++ b/announcements/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class AnnouncementsConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'announcements'
diff --git a/announcements/migrations/0001_initial.py b/announcements/migrations/0001_initial.py
new file mode 100644
index 00000000..aca74adf
--- /dev/null
+++ b/announcements/migrations/0001_initial.py
@@ -0,0 +1,29 @@
+# Generated by Django 4.0.6 on 2022-10-02 15:22
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Announcement',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('title', models.CharField(max_length=100)),
+ ('body', models.TextField()),
+ ('date', models.DateTimeField(auto_now_add=True)),
+ ('is_public', models.BooleanField(default=False)),
+ ('is_new', models.BooleanField(default=True)),
+ ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ],
+ ),
+ ]
diff --git a/announcements/migrations/0002_rename_date_announcement_created_at.py b/announcements/migrations/0002_rename_date_announcement_created_at.py
new file mode 100644
index 00000000..89943636
--- /dev/null
+++ b/announcements/migrations/0002_rename_date_announcement_created_at.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.0.6 on 2022-10-02 15:23
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('announcements', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name='announcement',
+ old_name='date',
+ new_name='created_at',
+ ),
+ ]
diff --git a/announcements/migrations/__init__.py b/announcements/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/announcements/migrations/__init__.py
diff --git a/announcements/models.py b/announcements/models.py
new file mode 100644
index 00000000..06dea701
--- /dev/null
+++ b/announcements/models.py
@@ -0,0 +1,18 @@
+from django.db import models
+from django.conf import settings
+# Create your models here.
+
+class Announcement(models.Model):
+ title = models.CharField(max_length=100)
+ body = models.TextField()
+ created_at = models.DateTimeField(auto_now_add=True)
+ author = models.ForeignKey(
+ settings.AUTH_USER_MODEL,
+ on_delete=models.CASCADE,
+ )
+ is_public = models.BooleanField(default=False)
+ is_new = models.BooleanField(default=True)
+
+ def __str__(self):
+ return self.title
+
diff --git a/announcements/tests.py b/announcements/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/announcements/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/announcements/views.py b/announcements/views.py
new file mode 100644
index 00000000..91ea44a2
--- /dev/null
+++ b/announcements/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.