diff --git a/CCD/__pycache__/settings.cpython-38.pyc b/CCD/__pycache__/settings.cpython-38.pyc index 70b908b..ec3bed7 100644 Binary files a/CCD/__pycache__/settings.cpython-38.pyc and b/CCD/__pycache__/settings.cpython-38.pyc differ diff --git a/CCD/__pycache__/urls.cpython-38.pyc b/CCD/__pycache__/urls.cpython-38.pyc index f0ed93c..bca3ceb 100644 Binary files a/CCD/__pycache__/urls.cpython-38.pyc and b/CCD/__pycache__/urls.cpython-38.pyc differ diff --git a/CCD/__pycache__/wsgi.cpython-38.pyc b/CCD/__pycache__/wsgi.cpython-38.pyc new file mode 100644 index 0000000..071eeb4 Binary files /dev/null and b/CCD/__pycache__/wsgi.cpython-38.pyc differ diff --git a/CCD/settings.py b/CCD/settings.py index 61780d8..9457af3 100644 --- a/CCD/settings.py +++ b/CCD/settings.py @@ -11,7 +11,7 @@ """ from pathlib import Path - +import os # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -38,6 +38,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'drf_spectacular', + 'rest_framework', 'contactus', 'student_utilities', 'lifeatiitg', @@ -80,8 +81,12 @@ DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'postgres', + 'USER': 'postgres', + 'PASSWORD': 'test123456789', + 'HOST': 'localhost', + 'PORT': '5432', } } """ diff --git a/CCD/urls.py b/CCD/urls.py index 86a44d8..994906f 100644 --- a/CCD/urls.py +++ b/CCD/urls.py @@ -1,5 +1,6 @@ from django.contrib import admin from django.urls import path +from django.urls.conf import include from drf_spectacular.views import ( SpectacularAPIView, SpectacularRedocView, @@ -22,4 +23,6 @@ name="redoc", ), path('admin/', admin.site.urls), + path("",include('home.urls')), + path("",include('lifeatiitg.urls')), ] diff --git a/home/__pycache__/models.cpython-38.pyc b/home/__pycache__/models.cpython-38.pyc index c0cb6a1..fc553bc 100644 Binary files a/home/__pycache__/models.cpython-38.pyc and b/home/__pycache__/models.cpython-38.pyc differ diff --git a/home/__pycache__/router.cpython-38.pyc b/home/__pycache__/router.cpython-38.pyc new file mode 100644 index 0000000..db97577 Binary files /dev/null and b/home/__pycache__/router.cpython-38.pyc differ diff --git a/home/__pycache__/serializers.cpython-38.pyc b/home/__pycache__/serializers.cpython-38.pyc new file mode 100644 index 0000000..31c80cf Binary files /dev/null and b/home/__pycache__/serializers.cpython-38.pyc differ diff --git a/home/__pycache__/urls.cpython-38.pyc b/home/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..006c0c6 Binary files /dev/null and b/home/__pycache__/urls.cpython-38.pyc differ diff --git a/home/__pycache__/views.cpython-38.pyc b/home/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..5ad14e3 Binary files /dev/null and b/home/__pycache__/views.cpython-38.pyc differ diff --git a/home/models.py b/home/models.py index 215eb89..678e7d2 100644 --- a/home/models.py +++ b/home/models.py @@ -3,17 +3,18 @@ # Create your models here. class About(models.Model): - about = models.CharField(max_length=100) + about = models.CharField(max_length=100,default=" ") class CampusRecuitment(models.Model): - title = models.CharField(max_length=50) - content = ArrayField(models.CharField(max_length=100),max_length=4) + title = models.CharField(max_length=50,default=" ") + content = ArrayField(models.CharField(max_length=1000,default=" "),max_length=5,default=list) + link = models.URLField(max_length=100,default=" ") # content1 = models.CharField(max_length=100) # content2 = models.CharField(max_length=100) # content3 = models.CharField(max_length=100) class Acknowledgement(models.Model): - title = models.CharField(max_length=100) + title = models.CharField(max_length=100,default=" ") image = models.ImageField(upload_to='img',max_length=100) - content = models.CharField(max_length=1000) - link = models.URLField(max_length=100) \ No newline at end of file + content = models.CharField(max_length=1000,default=" ") + link = models.URLField(max_length=100,default=" ") \ No newline at end of file diff --git a/home/router.py b/home/router.py new file mode 100644 index 0000000..3677eea --- /dev/null +++ b/home/router.py @@ -0,0 +1,9 @@ +from home.views import AboutViewSet,CampusRecuitmentViewSet,AcknowledgementViewSet +from rest_framework import routers + +router = routers.DefaultRouter() + +router.register('About',AboutViewSet) +router.register('CampusRecuitment',CampusRecuitmentViewSet) +router.register('Acknowledgement',AcknowledgementViewSet) + diff --git a/home/serializers.py b/home/serializers.py index e69de29..4e1ad43 100644 --- a/home/serializers.py +++ b/home/serializers.py @@ -0,0 +1,18 @@ +from rest_framework import serializers +from home.models import About,CampusRecuitment,Acknowledgement + +class AboutSerializer(serializers.ModelSerializer): + class Meta: + model = About + fields = ['about'] + +class CampusRecuitmentSerializer(serializers.ModelSerializer): + class Meta: + model = CampusRecuitment + fields = ['title','content'] + +class AcknowledgementSerializer(serializers.ModelSerializer): + class Meta: + model = Acknowledgement + fields = ['title','image','content','link'] + diff --git a/home/urls.py b/home/urls.py new file mode 100644 index 0000000..74ed504 --- /dev/null +++ b/home/urls.py @@ -0,0 +1,8 @@ +from django.urls.conf import include +from home.router import router +from django.urls import path +from django.urls.conf import include + +urlpatterns = [ + path('api/',include(router.urls)) +] \ No newline at end of file diff --git a/home/views.py b/home/views.py index 91ea44a..3981c8a 100644 --- a/home/views.py +++ b/home/views.py @@ -1,3 +1,23 @@ +from typing import ClassVar from django.shortcuts import render - +from rest_framework import viewsets +from home.models import About,CampusRecuitment,Acknowledgement +from home.serializers import AboutSerializer,CampusRecuitmentSerializer,AcknowledgementSerializer # Create your views here. + +class AboutViewSet(viewsets.ModelViewSet): + serializer_class = AboutSerializer + queryset = About.objects.all() + +class CampusRecuitmentViewSet(viewsets.ModelViewSet): + serializer_class = CampusRecuitmentSerializer + queryset = CampusRecuitment.objects.all() + +class AcknowledgementViewSet(viewsets.ModelViewSet): + serializer_class = AcknowledgementSerializer + queryset = Acknowledgement.objects.all() + + + + + diff --git a/lifeatiitg/__pycache__/models.cpython-38.pyc b/lifeatiitg/__pycache__/models.cpython-38.pyc index 0daa5e3..f42e86d 100644 Binary files a/lifeatiitg/__pycache__/models.cpython-38.pyc and b/lifeatiitg/__pycache__/models.cpython-38.pyc differ diff --git a/lifeatiitg/__pycache__/router.cpython-38.pyc b/lifeatiitg/__pycache__/router.cpython-38.pyc new file mode 100644 index 0000000..e536ac7 Binary files /dev/null and b/lifeatiitg/__pycache__/router.cpython-38.pyc differ diff --git a/lifeatiitg/__pycache__/serializers.cpython-38.pyc b/lifeatiitg/__pycache__/serializers.cpython-38.pyc new file mode 100644 index 0000000..8e55626 Binary files /dev/null and b/lifeatiitg/__pycache__/serializers.cpython-38.pyc differ diff --git a/lifeatiitg/__pycache__/urls.cpython-38.pyc b/lifeatiitg/__pycache__/urls.cpython-38.pyc new file mode 100644 index 0000000..6f9994c Binary files /dev/null and b/lifeatiitg/__pycache__/urls.cpython-38.pyc differ diff --git a/lifeatiitg/__pycache__/views.cpython-38.pyc b/lifeatiitg/__pycache__/views.cpython-38.pyc new file mode 100644 index 0000000..3fe441b Binary files /dev/null and b/lifeatiitg/__pycache__/views.cpython-38.pyc differ diff --git a/lifeatiitg/models.py b/lifeatiitg/models.py index 1dd966f..09309be 100644 --- a/lifeatiitg/models.py +++ b/lifeatiitg/models.py @@ -2,6 +2,6 @@ # Create your models here. class Contents(models.Model): - title = models.CharField(max_length=50) - description = models.CharField(max_length=100) - link = models.URLField(max_length=60) \ No newline at end of file + title = models.CharField(max_length=100,default=" ") + description = models.CharField(max_length=1000,default=" ") + link = models.URLField(max_length=100,default=" ") \ No newline at end of file diff --git a/lifeatiitg/router.py b/lifeatiitg/router.py new file mode 100644 index 0000000..19d59da --- /dev/null +++ b/lifeatiitg/router.py @@ -0,0 +1,6 @@ +from lifeatiitg.views import ContentsViewSet +from rest_framework import routers + +router = routers.DefaultRouter() + +router.register('Content',ContentsViewSet) \ No newline at end of file diff --git a/lifeatiitg/serializers.py b/lifeatiitg/serializers.py new file mode 100644 index 0000000..03f0a66 --- /dev/null +++ b/lifeatiitg/serializers.py @@ -0,0 +1,9 @@ +from rest_framework import serializers +from lifeatiitg.models import Contents + +class ContentsSerializer(serializers.ModelSerializer): + class Meta: + model = Contents + fields = ['title','description','link'] + + diff --git a/lifeatiitg/urls.py b/lifeatiitg/urls.py new file mode 100644 index 0000000..5affadf --- /dev/null +++ b/lifeatiitg/urls.py @@ -0,0 +1,7 @@ +from lifeatiitg.router import router +from django.urls import path +from django.urls.conf import include + +urlpatterns = [ + path('api/',include(router.urls)) +] \ No newline at end of file diff --git a/lifeatiitg/views.py b/lifeatiitg/views.py index 91ea44a..365047b 100644 --- a/lifeatiitg/views.py +++ b/lifeatiitg/views.py @@ -1,3 +1,10 @@ from django.shortcuts import render - +from rest_framework import viewsets +from lifeatiitg.models import Contents +from lifeatiitg.serializers import ContentsSerializer # Create your views here. + +class ContentsViewSet(viewsets.ModelViewSet): + serializer_class = ContentsSerializer + queryset = Contents.objects.all() +