-
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.
- Loading branch information
0 parents
commit 0e727b4
Showing
311 changed files
with
123,275 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,9 @@ | ||
from django.contrib import admin | ||
from .models import Profile,Complaint,Grievance | ||
|
||
class CAdmin(admin.ModelAdmin): | ||
list_display = ('user','Subject','Type_of_complaint','Description','Time','status') | ||
|
||
admin.site.register(Profile) | ||
admin.site.register(Complaint,CAdmin) | ||
admin.site.register(Grievance) |
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 @@ | ||
from django.apps import AppConfig | ||
from suit.apps import DjangoSuitConfig | ||
|
||
class SuitConfig(DjangoSuitConfig): | ||
layout='vertical' | ||
class ComplaintMSConfig(AppConfig): | ||
name = 'ComplaintMS' | ||
|
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,93 @@ | ||
from django import forms | ||
from django.contrib.auth.models import User | ||
from django.contrib.auth.forms import UserCreationForm | ||
from django.forms.widgets import DateInput | ||
from django.shortcuts import render, redirect | ||
from .models import Profile,Complaint | ||
from crispy_forms.helper import FormHelper | ||
from crispy_forms.layout import Submit | ||
import requests | ||
|
||
class ComplaintForm(forms.ModelForm): | ||
class Meta: | ||
model=Complaint | ||
fields=('Subject','Type_of_complaint','Description') | ||
|
||
|
||
class UserProfileform(forms.ModelForm): | ||
class Meta: | ||
model=Profile | ||
fields=('contactnumber','Branch') | ||
|
||
|
||
class UserRegisterForm(UserCreationForm): | ||
first_name = forms.CharField(max_length=30, required=True) | ||
last_name = forms.CharField(max_length=30, required=True) | ||
|
||
class Meta: | ||
model = User | ||
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2', ) | ||
|
||
def clean_email(self): | ||
# Get the email | ||
email = self.cleaned_data.get('email') | ||
|
||
# Check to see if any users already exist with this email as a username. | ||
try: | ||
match = User.objects.get(email=email) | ||
except User.DoesNotExist: | ||
# Unable to find a user, this is fine | ||
return email | ||
|
||
# A user was found with this as a username, raise an error. | ||
raise forms.ValidationError('This email address is already in use.') | ||
|
||
'''class ProfileForm(forms.ModelForm): | ||
class Meta: | ||
model = Profile | ||
fields = ('bio', 'location',)''' | ||
|
||
class ProfileUpdateForm(forms.ModelForm): | ||
email =forms.EmailField(widget = forms.TextInput(attrs={'readonly':'readonly'})) | ||
first_name=forms.CharField( max_length=30, required=True) | ||
last_name=forms.CharField( max_length=30, required=True) | ||
|
||
|
||
class Meta: | ||
model = User | ||
fields = ['username','email','first_name','last_name'] | ||
|
||
def clean_email(self): | ||
# Get the email | ||
username = self.cleaned_data.get('email') | ||
|
||
# Check to see if any users already exist with this email as a username. | ||
try: | ||
match = User.objects.exclude(pk=self.instance.pk).get(username=username) | ||
|
||
|
||
except User.DoesNotExist: | ||
# Unable to find a user, this is fine | ||
return username | ||
|
||
# A user was found with this as a username, raise an error. | ||
raise forms.ValidationError('This email address is already in use.') | ||
|
||
|
||
class UserProfileUpdateform(forms.ModelForm): | ||
|
||
|
||
Branch=forms.CharField(widget = forms.TextInput(attrs={'readonly':'readonly'})) | ||
|
||
class Meta: | ||
model=Profile | ||
fields=('contactnumber','Branch') | ||
|
||
class statusupdate(forms.ModelForm): | ||
class Meta: | ||
model=Complaint | ||
fields=('status',) | ||
help_texts = { | ||
'status': None, | ||
|
||
} |
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,48 @@ | ||
# Generated by Django 3.1.2 on 2020-10-12 15:28 | ||
|
||
from django.conf import settings | ||
import django.core.validators | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('auth', '0012_alter_user_first_name_max_length'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Profile', | ||
fields=[ | ||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='auth.user')), | ||
('collegename', models.CharField(choices=[('College1', 'College1'), ('College2', 'College2')], max_length=29)), | ||
('contactnumber', models.CharField(blank=True, max_length=10, validators=[django.core.validators.RegexValidator(message='Phone number must be entered in the format:Up to 10 digits allowed.', regex='^\\d{10,10}$')])), | ||
('type_user', models.CharField(choices=[('student', 'student'), ('grievance', 'grievance')], default='student', max_length=20)), | ||
('Branch', models.CharField(choices=[('ComputerScience', 'ComputerScience'), ('InformationScience', 'InformationScience'), ('Electronics and Communication', 'Electronics and Communication'), ('Mechanical', 'Mechanical')], default='ComputerScience', max_length=29)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Grievance', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('guser', models.OneToOneField(default=None, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='Complaint', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('Subject', models.CharField(max_length=200, null=True)), | ||
('Type_of_complaint', models.CharField(choices=[('ClassRoom', 'ClassRoom'), ('Teacher', 'Teacher'), ('Management', 'Management'), ('College', 'College'), ('Other', 'Other')], max_length=200, null=True)), | ||
('Description', models.TextField(max_length=4000, null=True)), | ||
('Time', models.DateField(auto_now=True)), | ||
('status', models.IntegerField(choices=[(1, 'Solved'), (2, 'InProgress'), (3, 'Pending')], default=3)), | ||
('user', models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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 3.2.2 on 2022-12-15 06:38 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ComplaintMS', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='profile', | ||
name='Branch', | ||
field=models.CharField(choices=[('InformationTechnology', 'InformationTechnology'), ('ComputerScience', 'ComputerScience'), ('InformationScience', 'InformationScience'), ('Electronics and Communication', 'Electronics and Communication'), ('Mechanical', 'Mechanical')], default='InformationTechnology', max_length=29), | ||
), | ||
] |
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,17 @@ | ||
# Generated by Django 4.2.2 on 2023-07-02 13:57 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('ComplaintMS', '0002_alter_profile_branch'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='profile', | ||
name='collegename', | ||
), | ||
] |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.04 KB
ComplaintMS/migrations/__pycache__/0002_alter_profile_branch.cpython-311.pyc
Binary file not shown.
Binary file added
BIN
+794 Bytes
ComplaintMS/migrations/__pycache__/0002_alter_profile_branch.cpython-39.pyc
Binary file not shown.
Binary file added
BIN
+759 Bytes
ComplaintMS/migrations/__pycache__/0003_remove_profile_collegename.cpython-311.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,68 @@ | ||
from django.db import models | ||
from django import forms | ||
from django.contrib.auth.models import User | ||
from django.dispatch import receiver | ||
from django.db.models.signals import post_save | ||
|
||
from django.core.validators import RegexValidator | ||
from datetime import datetime | ||
|
||
class Meta: | ||
|
||
app_label = 'ComplaintMS' | ||
class Profile(models.Model): | ||
typeuser =(('student','student'),('grievance', 'grievance')) | ||
user =models.OneToOneField(User, on_delete=models.CASCADE,primary_key=True) | ||
phone_regex =RegexValidator(regex=r'^\d{10,10}$', message="Phone number must be entered in the format:Up to 10 digits allowed.") | ||
contactnumber = models.CharField(validators=[phone_regex], max_length=10, blank=True) | ||
type_user=models.CharField(max_length=20,default='student',choices=typeuser) | ||
CB=(('InformationTechnology',"InformationTechnology"),('ComputerScience',"ComputerScience"),('InformationScience',"InformationScience"),('Electronics and Communication',"Electronics and Communication"),('Mechanical',"Mechanical")) | ||
Branch=models.CharField(choices=CB,max_length=29,default='InformationTechnology') | ||
def __str__(self): | ||
return self.user.username | ||
|
||
|
||
|
||
@receiver(post_save, sender=User) | ||
def create_user_profile(sender, instance, created, **kwargs): | ||
if created: | ||
Profile.objects.create(user=instance) | ||
|
||
'''@receiver(post_save, sender=User) | ||
def save_user_profile(sender, instance, **kwargs): | ||
instance.profile.save()''' | ||
|
||
|
||
class Complaint(models.Model): | ||
STATUS =((1,'Solved'),(2, 'InProgress'),(3,'Pending')) | ||
TYPE=(('ClassRoom',"ClassRoom"),('Teacher',"Teacher"),('Management',"Management"),('College',"College"),('Other',"Other")) | ||
|
||
Subject=models.CharField(max_length=200,blank=False,null=True) | ||
user=models.ForeignKey(User, on_delete=models.CASCADE,default=None) | ||
|
||
Type_of_complaint=models.CharField(choices=TYPE,null=True,max_length=200) | ||
Description=models.TextField(max_length=4000,blank=False,null=True) | ||
Time = models.DateField(auto_now=True) | ||
status=models.IntegerField(choices=STATUS,default=3) | ||
|
||
|
||
def __init__(self, *args, **kwargs): | ||
super(Complaint, self).__init__(*args, **kwargs) | ||
self.__status = self.status | ||
|
||
def save(self, *args, **kwargs): | ||
if self.status and not self.__status: | ||
self.active_from = datetime.now() | ||
super(Complaint, self).save(*args, **kwargs) | ||
|
||
def __str__(self): | ||
return self.get_Type_of_complaint_display() | ||
|
||
def __str__(self): | ||
return str(self.user) | ||
|
||
class Grievance(models.Model): | ||
guser=models.OneToOneField(User,on_delete=models.CASCADE,default=None) | ||
|
||
def __str__(self): | ||
return self.guser |
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,19 @@ | ||
from django.db.models.signals import post_save | ||
from django.contrib.auth.models import User | ||
from django.dispatch import receiver | ||
|
||
from .models import Profile,Complaint | ||
|
||
@receiver(post_save, sender=User, dispatch_uid='save_new_user_profile') | ||
def save_profile(sender, instance, created, **kwargs): | ||
user = instance | ||
if created: | ||
profile = Profile(user=user) | ||
profile.save() | ||
|
||
#@receiver(post_save, sender=User, dispatch_uid='save_new_user_profile') | ||
#def save_profile(sender, instance, created, **kwargs): | ||
#user = instance | ||
#if created: | ||
#complaint = Complaint(user=user) | ||
#complaint.save() |
Oops, something went wrong.