Commit 9ef9682d authored by Ross Batacan's avatar Ross Batacan

Created application named announcements. Created models under said...

Created application named announcements. Created models under said application. Kindly add foreignkey for models.py line 10
parent 6d06d3c0
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<component name="libraryTable">
<library name="Django Lib">
<CLASSES>
<root url="file://$PROJECT_DIR$/venv/Lib/site-packages" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Django Lib" level="project" />
</component>
<component name="PyDocumentationSettings">
<option name="format" value="PLAIN" />
<option name="myDocStringFormat" value="Plain" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (midterm_mgabolanimav)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/midterm_mgabolanimav.iml" filepath="$PROJECT_DIR$/.idea/midterm_mgabolanimav.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class AnnouncementsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'announcements'
from django.db import models
# Create your models here.
# please insert foreign key from dashboard application on announcement_author
class Announcement(models.Model):
announcement_title = models.CharField(max_length=50, unique=True, null=True,)
announcement_body = models.CharField(max_length=250, unique=True, null=True,)
# announcement_author = models.ForeignKey(on_delete=models.CASCADE, null=True)
announcement_pub_datetime = models.DateTimeField(null=True)
# def __str__(self):
# return self.announcement_title
class Reaction(models.Model):
reaction_name = models.CharField(max_length=50, null=True,)
reaction_tally = models.IntegerField(null=True)
reaction_announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE, null=True)
def __str__(self):
return self.reaction_name
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
path('', views.announcements, name="announcements")
]
from django.http import HttpResponse
# Create your views here.
def announcements(request):
return HttpResponse("testing")
\ No newline at end of file
...@@ -31,6 +31,7 @@ ALLOWED_HOSTS = [] ...@@ -31,6 +31,7 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'announcements',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
......
...@@ -14,8 +14,9 @@ Including another URLconf ...@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('announcements/', include("announcements.urls"))
] ]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment