Update README and add requirements.txt
This commit is contained in:
parent
76339dc65a
commit
768fc04533
15
README.md
15
README.md
@ -1,5 +1,16 @@
|
||||
# BTech Time Tracker
|
||||
|
||||
### To-Do
|
||||
### Getting started
|
||||
|
||||
Requirements
|
||||
|
||||
- install pipenv and run `pipenv install` to install dependencies
|
||||
- run `pipenv shell` to activate the virtual environment
|
||||
|
||||
Django
|
||||
|
||||
- `python manage.py makemigrations`
|
||||
- `python manage.py migrate`
|
||||
- `python manage.py createsuperuser`
|
||||
- `python manage.py runserver`
|
||||
|
||||
- Add a "current_period" field to student that stores the fk of their current period.
|
||||
|
||||
24
attendance/signals.py
Normal file
24
attendance/signals.py
Normal file
@ -0,0 +1,24 @@
|
||||
from django.db.models.signals import post_save, post_delete
|
||||
from django.dispatch import receiver
|
||||
from .models import Period
|
||||
|
||||
@receiver(post_save, sender=Period)
|
||||
def student_period_created_updated(sender, instance, created, **kwargs):
|
||||
if created and not instance.clocked_out:
|
||||
instance.student.is_clocked_in = True
|
||||
instance.student.current_period_id = instance.pk
|
||||
instance.student.save()
|
||||
elif not created and not instance.clocked_out:
|
||||
instance.student.is_clocked_in = True
|
||||
instance.student.current_period_id = instance.pk
|
||||
instance.student.save()
|
||||
elif instance.clocked_out and not created:
|
||||
instance.student.is_clocked_in = False
|
||||
instance.student.save()
|
||||
|
||||
@receiver(post_delete, sender=Period)
|
||||
def student_period_deleted(sender, instance, **kwargs):
|
||||
if instance.student.current_period_id == instance.pk:
|
||||
instance.student.is_clocked_in = False
|
||||
instance.student.current_period_id = None
|
||||
instance.student.save()
|
||||
27
requirements.txt
Normal file
27
requirements.txt
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# These requirements were autogenerated by pipenv
|
||||
# To regenerate from the project's Pipfile, run:
|
||||
#
|
||||
# pipenv lock --requirements
|
||||
#
|
||||
|
||||
-i https://pypi.org/simple
|
||||
asgiref==3.3.1; python_version >= '3.5'
|
||||
django-appconf==1.0.4
|
||||
django-compressor==2.4
|
||||
django-easy-timezones==0.8.0
|
||||
django-libsass==0.8
|
||||
django-qr-code==2.1.0
|
||||
django==3.1.6
|
||||
ipaddress==1.0.16
|
||||
libsass==0.20.1
|
||||
pillow==8.1.0
|
||||
pygeoip==0.3.2
|
||||
pytz==2016.6
|
||||
qrcode==6.1
|
||||
rcssmin==1.0.6
|
||||
rjsmin==1.1.0
|
||||
segno==1.3.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'
|
||||
six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
|
||||
sqlparse==0.4.1; python_version >= '3.5'
|
||||
wheel==0.29.0
|
||||
Loading…
x
Reference in New Issue
Block a user