-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding pre-commit and fixing bugs (#66)
* adding pre-commit * update readme * fix flake --------- Co-authored-by: Ishaan Mittal <[email protected]>
- Loading branch information
1 parent
a8d941b
commit aa4daf0
Showing
71 changed files
with
2,015 additions
and
3,718 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
|
||
__pycache__ | ||
migrations | ||
db.sqlite3 | ||
db.sqlite3 |
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 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
# Remove F811 from admin.py | ||
ignore = E501, E722, W503, F811 | ||
per-file-ignores = | ||
home/models/students.py: E402 | ||
home/models/admin.py: F811 | ||
home/models/__init__.py: F401 |
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 |
---|---|---|
|
@@ -6,5 +6,3 @@ labels: '' | |
assignees: '' | ||
|
||
--- | ||
|
||
|
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
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,21 @@ | ||
exclude: .*migrations\/.* | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.10 | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
name: isort (python) | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,29 +1,33 @@ | ||
from allauth.account.adapter import DefaultAccountAdapter | ||
from django.contrib.auth import get_user_model, login | ||
from home.models import Student | ||
from django.contrib import messages | ||
from allauth.account.adapter import DefaultAccountAdapter | ||
from django.contrib.auth import get_user_model | ||
from django.forms import ValidationError | ||
|
||
from home.models import Student | ||
|
||
User = get_user_model() | ||
|
||
|
||
class CustomAccountAdapter(DefaultAccountAdapter): | ||
def should_send_confirmation_mail(self, request, email_address): | ||
return None | ||
def clean_email(self,email): | ||
RestrictedList = Student.objects.all().values_list('email') | ||
|
||
def clean_email(self, email): | ||
RestrictedList = Student.objects.all().values_list("email") | ||
# try: | ||
# Student.objects.get(email=email) | ||
# return email | ||
# except Exception as e: | ||
# ValidationError('You are not a registered student. Please contact admin.') | ||
if email.endswith('iiti.ac.in'): | ||
if email.endswith("iiti.ac.in"): | ||
print(11) | ||
raise ValidationError('Please login with your IITI email ID through google login only.') | ||
raise ValidationError( | ||
"Please login with your IITI email ID through google login only." | ||
) | ||
elif RestrictedList.filter(email=email).exists(): | ||
print(email) | ||
print(RestrictedList.filter(email=email)) | ||
else: | ||
raise ValidationError('This email ID is not registered with the Dining Facility. Please contact the Dining Wadern Office.') | ||
raise ValidationError( | ||
"This email ID is not registered with the Dining Facility. Please contact the Dining Wadern Office." | ||
) | ||
return email | ||
|
Oops, something went wrong.