Skip to content

Commit 1f5467f

Browse files
committed
updated placement announcement view permission class
2 parents 0d44821 + e1a9546 commit 1f5467f

File tree

15 files changed

+366
-0
lines changed

15 files changed

+366
-0
lines changed

backend/placement/migrations/0007_rename_archived_announcement_archive.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
# <<<<<<< HEAD
12
# Generated by Django 4.2.6 on 2024-04-22 18:29
3+
# =======
4+
# Generated by Django 4.2.6 on 2024-04-22 19:29
5+
# >>>>>>> e1a95461e4b99065c19c192056fad219777692d5
26

37
from django.db import migrations
48

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.6 on 2024-04-22 19:46
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('placement', '0007_rename_archived_announcement_archive'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='placements',
15+
name='archive',
16+
field=models.BooleanField(default=False),
17+
),
18+
]

backend/placement/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class Placements(models.Model):
1212
docs = models.FileField(upload_to='assets/' , null=True )
1313
date= models.DateTimeField(default= timezone.now)
1414
description = models.TextField()
15+
archive = models.BooleanField(default=False)
1516

1617

1718
def __str__(self) -> str:

backend/placement/views.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@
44
from .serializers import *
55
from rest_framework.viewsets import ModelViewSet
66
from rest_framework.permissions import IsAuthenticated
7+
# <<<<<<< HEAD
78
from rest_framework.authentication import SessionAuthentication
9+
# =======
10+
# from rest_framework.authentication import BasicAuthentication
11+
# >>>>>>> e1a95461e4b99065c19c192056fad219777692d5
812
from django.utils import timezone
913

1014

1115

1216
# Create your views here.
1317

1418
class AllPlacementRecords(ModelViewSet):
19+
# <<<<<<< HEAD
1520
authentication_classes =[SessionAuthentication]
1621
permission_classes =[ WriteByPlacement ]
22+
# =======
23+
# authentication_classes =[BasicAuthentication]
24+
# permission_classes =[IsAuthenticated, WriteByPlacement ]
25+
# >>>>>>> e1a95461e4b99065c19c192056fad219777692d5
1726
serializer_class = PlacementSerializer
1827
queryset = Placements.objects.all()
1928

@@ -24,6 +33,7 @@ class ViewAnnouncement(ModelViewSet):
2433
# authentication_classes = [BasicAuthentication]
2534
authentication_classes =[SessionAuthentication]
2635
permission_classes = [WriteByPlacement]
36+
# permission_classes = [IsAuthenticated, WriteByPlacement]
2737
serializer_class = AnnouncementSerializer
2838
queryset = Announcement.objects.all()
2939

@@ -36,15 +46,22 @@ class ViewAnnouncement(ModelViewSet):
3646

3747
class PastPlacementRecords(ModelViewSet):
3848
# authentication_classes = [BasicAuthentication]
49+
3950
authentication_classes =[SessionAuthentication]
4051
permission_classes = [ WriteByPlacement]
52+
# permission_classes = [IsAuthenticated, WriteByPlacement]
4153
serializer_class = PlacementSerializer
4254
queryset = Placements.objects.filter(date__lte=timezone.now())
4355

4456

4557

4658
class ActivePlacementRecords(ModelViewSet):
4759
# authentication_classes = [BasicAuthentication]
60+
# <<<<<<< HEAD
4861
permission_classes = [ WriteByPlacement]
62+
authentication_classes =[SessionAuthentication]
63+
# =======
64+
# permission_classes = [IsAuthenticated, WriteByPlacement]
65+
# >>>>>>> e1a95461e4b99065c19c192056fad219777692d5
4966
serializer_class = PlacementSerializer
5067
queryset = Placements.objects.filter(date__gt=timezone.now())

frontend/src/App.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import FeesComponentAdmin from './components/FeesAdmin/FeesComponentAdmin';
1919
import FeeHistory from './components/Fees/FeeHistory';
2020
import FeesStructure from './components/Fees/FeesStructure';
2121
import AccountsLogin from './components/FeesAdmin/AccountsLogin';
22+
import PlacementDashboard from './components/Placement/PlacementDashboard';
23+
import PlacementLogin from './components/Placement/PlacementLogin';
2224
import NotFound from './components/standard/NotFound';
2325

2426
function App() {
@@ -52,6 +54,8 @@ function App() {
5254
<Route path="/fee-comp" element={<FeesComponent />} />
5355
<Route path="/fee-comp-admin" element={<FeesComponentAdmin />} />
5456
<Route path="/fee-admin-login" element={<AccountsLogin />} />
57+
<Route path="/placement-login" element={<PlacementLogin />} />
58+
<Route path="/placement-dashboard" element={<PlacementDashboard />} />
5559
{/* Add more routes as needed */}
5660
<Route path="*" element={<NotFound />} />
5761
</Routes>

frontend/src/components/FeesAdmin/AccountsLogin.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const AccountsLogin = () => {
1414
{ name: 'Student', href: '#' },
1515
{ name: 'Infrastructure', href: '/infra-login' },
1616
{ name: 'Accounts', href: '/fee-admin-login' },
17+
{ name: 'Placement', href: '/placement-login' },
1718
{ name: 'About', href: '#' },
1819
];
1920

frontend/src/components/FeesAdmin/FeesComponentAdmin.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const FeesComponentAdmin = () => {
1717
{ name: 'Student', href: '#' },
1818
{ name: 'Infrastructure', href: '/infra-login' },
1919
{ name: 'Accounts', href: '/fee-admin-login' },
20+
{ name: 'Placement', href: '/placement-login' },
2021
{ name: 'About', href: '#' },
2122
];
2223

frontend/src/components/Infra/InfraLogin.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const InfraLogin = () => {
1212
{ name: 'Student', href: '#' },
1313
{ name: 'Infrastructure', href: '/infra-login' },
1414
{ name: 'Accounts', href: '/fee-admin-login' },
15+
{ name: 'Placement', href: '/placement-login' },
1516
{ name: 'About', href: '#' },
1617
];
1718
const [user_id, setUserId] = useState('');
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react'
2+
3+
function PlacementActive() {
4+
return (
5+
<div>PlacementActive</div>
6+
)
7+
}
8+
9+
export default PlacementActive
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
3+
function PlacementAll() {
4+
return (
5+
<>
6+
<div className="text-center">
7+
<h2 className="text-4xl font-semibold mb-4">All Placements</h2>
8+
<p className="text-lg m-5">Select an option from menu to get started.</p>
9+
</div>
10+
</>
11+
)
12+
}
13+
14+
export default PlacementAll

0 commit comments

Comments
 (0)