-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all production features and updates added
- Loading branch information
Showing
38 changed files
with
1,806 additions
and
453 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# For more information, please refer to https://aka.ms/vscode-docker-python | ||
FROM python:3.8.16 | ||
|
||
# Install cron | ||
RUN apt-get update && apt-get install -y cron | ||
|
||
# Keeps Python from generating .pyc files in the container | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
|
||
# Turns off buffering for easier container logging | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Install pip requirements | ||
COPY requirements.txt . | ||
RUN python -m pip install -r requirements.txt | ||
|
||
WORKDIR /app | ||
COPY . /app | ||
|
||
# Copy cron job file | ||
COPY cronjob /etc/cron.d/cronjob | ||
|
||
# Give execution rights on the cron job | ||
RUN chmod 0644 /etc/cron.d/cronjob | ||
|
||
# Create the log file to be able to run tail | ||
RUN touch /var/log/cron.log | ||
|
||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder | ||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers | ||
# RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app | ||
USER root | ||
|
||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug | ||
CMD ["sh", "run.sh"] |
Empty file.
Empty file.
10 changes: 10 additions & 0 deletions
10
apps/nightpass/management/commands/reset_campus_resources.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.core.management.base import BaseCommand | ||
from ...models import CampusResource | ||
|
||
class Command(BaseCommand): | ||
help = 'Reset all campus resources' | ||
|
||
def handle(self, *args, **options): | ||
self.stdout.write(self.style.SUCCESS('Running your cron job...')) | ||
CampusResource.objects.all().update(slots_booked=0, booking_complete=False, is_booking = False) | ||
self.stdout.write(self.style.SUCCESS('Cron job completed successfully')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.core.management.base import BaseCommand | ||
from ...models import CampusResource | ||
|
||
class Command(BaseCommand): | ||
help = 'Stop booking for all campus resources' | ||
|
||
def handle(self, *args, **options): | ||
self.stdout.write(self.style.SUCCESS('Running your cron job...')) | ||
CampusResource.objects.all().update(is_booking=False, booking_complete=True) | ||
self.stdout.write(self.style.SUCCESS('Cron job completed successfully')) |
18 changes: 18 additions & 0 deletions
18
apps/nightpass/migrations/0002_alter_campusresource_slots_booked.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.7 on 2023-12-03 06:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('nightpass', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='campusresource', | ||
name='slots_booked', | ||
field=models.IntegerField(default=0, editable=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
background-color: #f5f5f5; | ||
margin: 0; | ||
padding: 0; | ||
line-height: 1.6; | ||
} | ||
|
||
.header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
background-color: #eb1b23; | ||
color: #fff; | ||
text-align: center; | ||
padding: 2px; /* Reduced header padding */ | ||
} | ||
|
||
.header-logo { | ||
width: 100px; /* Set the width of your college logo */ | ||
height: auto; /* Maintain aspect ratio */ | ||
} | ||
|
||
.logout-button { | ||
background-color: #fff; | ||
color: #eb1b23; | ||
border: none; | ||
padding: 5px 10px; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.2s; | ||
margin-right: 20px; | ||
} | ||
|
||
.logout-button:hover { | ||
background-color: #ccc; | ||
} | ||
|
||
.container { | ||
display: flex; | ||
flex-wrap: nowrap; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
|
||
.profile-card, .resource-card { | ||
background-color: #fff; | ||
border-radius: 10px; | ||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); | ||
margin: 20px; | ||
width: 300px; | ||
text-align: center; | ||
padding: 20px; | ||
transition: transform 0.2s; | ||
} | ||
|
||
.profile-card:hover, .resource-card:hover { | ||
transform: scale(1.05); | ||
} | ||
|
||
.profile-img { | ||
width: 100px; | ||
border-radius: 50%; | ||
object-fit: cover; | ||
margin-bottom: 20px; | ||
} | ||
|
||
.qr-code { | ||
width: 100px; | ||
height: 100px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
.profile-details { | ||
font-size: 18px; | ||
margin-bottom: 20px; | ||
text-align: left; | ||
} | ||
|
||
.profile-details p { | ||
margin-bottom: 10px; | ||
} | ||
|
||
.safe { | ||
color: green; | ||
} | ||
|
||
.unsafe { | ||
color: red; | ||
} | ||
|
||
.book-button { | ||
background-color: #eb1b23; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
border-radius: 10px; | ||
cursor: pointer; | ||
transition: background-color 0.2s; | ||
} | ||
|
||
.booked { | ||
background-color: grey; | ||
} | ||
|
||
.book-button:hover { | ||
background-color: #ff3336; | ||
} | ||
|
||
.modal { | ||
display: none; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
} | ||
|
||
.modal-content { | ||
background-color: #fff; | ||
width: 80%; | ||
max-width: 400px; | ||
margin: 20% auto; | ||
padding: 20px; | ||
border-radius: 5px; | ||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); | ||
text-align: center; | ||
position: relative; | ||
display: flex; | ||
} | ||
|
||
.modal-image { | ||
flex: 1; | ||
} | ||
|
||
.modal-image img { | ||
width: 100%; | ||
height: auto; | ||
object-fit: cover; | ||
} | ||
|
||
.modal-details { | ||
flex: 2; | ||
padding: 10px; | ||
text-align: left; | ||
} | ||
|
||
/* Close button for the modal */ | ||
.close { | ||
position: absolute; | ||
top: 10px; | ||
right: 10px; | ||
cursor: pointer; | ||
} | ||
|
||
.modal-button { | ||
background-color: #eb1b23; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
border-radius: 10px; | ||
cursor: pointer; | ||
transition: background-color 0.2s; | ||
} | ||
|
||
.modal-button:hover { | ||
background-color: #ff3336; | ||
} | ||
|
||
select { | ||
width: 100%; | ||
padding: 10px; | ||
margin: 10px 0; | ||
} | ||
.resource-card { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: space-between; | ||
} | ||
.resource-card img { | ||
width: 100px; | ||
height: 100px; | ||
object-fit: cover; | ||
border-radius: 5px; | ||
margin-right: 5px; | ||
} | ||
.resource-details { | ||
flex: 1; | ||
padding: 10px; | ||
text-align: left; | ||
} | ||
.resource-details h2 { | ||
margin: 0; | ||
} | ||
.resource-details p { | ||
margin: 0; | ||
} | ||
.location-cards | ||
{ | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.table-section { | ||
margin-top: 10px; | ||
overflow-x: auto; | ||
/* Add horizontal scroll for small screens */ | ||
} | ||
|
||
.activity-table { | ||
width: 100%; | ||
max-width: 100%; /* Set a maximum width for the table */ | ||
border-collapse: collapse; | ||
margin-top: 20px; | ||
white-space: nowrap; /* Prevent text wrapping */ | ||
overflow: hidden; | ||
} | ||
|
||
.activity-table th, .activity-table td { | ||
border: 1px solid #ddd; | ||
padding: 8px; | ||
text-align: left; | ||
overflow: hidden; | ||
text-overflow: ellipsis; /* Display ellipsis for overflowed text */ | ||
white-space: wrap; | ||
} | ||
|
||
.activity-table th { | ||
background-color: #eb1b23; | ||
color: #fff; | ||
} | ||
|
||
|
||
|
||
@media (max-width: 768px) { | ||
.profile-card, .resource-card { | ||
width: 90%; | ||
} | ||
.container { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.activity-table { | ||
font-size: 14px; | ||
} | ||
|
||
.activity-table th, .activity-table td { | ||
padding: 5px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends "admin/change_list.html" %} | ||
|
||
{% block object-tools %} | ||
{{ block.super }} | ||
<div class="actions"> | ||
<a href="{% url 'admin:your_app_name_your_model_name_custom_action' %}" class="button">Refresh Slot Count</a> | ||
</div> | ||
{% endblock %} |
Oops, something went wrong.