Code Monkey home page Code Monkey logo

kalinkochnev / xroads Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 11.39 MB

A webapp for students to share their ideas using Django. Features include a unique user tag system similar to discord, custom user authentication, posting, searching and page navigation. Development of this project has been discontinued but many of the features like commenting and voting are completed in the backend but not in the front end. Lots of this code would be useful for anyone undertaking a forum system using Django.

Python 35.64% HTML 0.99% CSS 0.12% JavaScript 41.83% Shell 2.89% SCSS 14.34% Dockerfile 3.17% Makefile 0.49% Batchfile 0.53%
django-application django python html-css javascript forum-site school-stuff solr local-database

xroads's Introduction

XRoads

A webapp for students to share their ideas using Django. Features include a unique user tag system similar to discord, custom user authentication, posting, searching and page navigation. Development of this project has been discontinued but many of the features like commenting and voting are completed in the backend but not in the front end. Lots of this code would be useful for anyone undertaking a forum system using Django.

This would be the first page that an unauthenticated user would see if they went to the url

landing page

The login and logout pages using custom user models

login signup

There is also a user settings page (not fully functional)

account settings

You can create posts directly from the forum home, see example post in the image on how to do so

forum home Post Example

There is post body, title and class search functionality which can just be done by using the search bar (created using solr)

Search Example


First time dev setup

  1. Create virtual environment and install pip packages in requirements.txt
  2. When in the main directory (~/XRoads) run the following scripts:
/bin/bash scripts/postgres/install.sh      (installs postgres with databases and users required)
/bin/bash scripts/solr/setup/install.sh    (installs solr with correct setup)

Management commands

There are several scripts to help reduce the amount of time doing configuration and more time coding! They're all located within the scripts folder. Heres a general overview of them:

Postgres
  • reset-db.sh In the event a terrible mistake has been made, this will reset the local database entirely. This will remove all users other than djangouser
  • create-superuser.sh This can be used to add an additional user with rights given to the local database
Solr
  • management/rebuild-index.sh Is useful for when you want to update the schema or rebuild the search indexes
  • management/ start.sh, stop.sh, restart.sh These apply to the solr server. It is pretty self explanatory

xroads's People

Contributors

akochnev avatar dependabot[bot] avatar kalinkochnev avatar rmenon1008 avatar smt5541 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

xroads's Issues

Non-admin endpoints allow un-authenticated access

This is a security issue in that it allows anyone to hit that API endpoint and retrieve the emails/names of the registered users. Repro steps:

  1. From a command line (guaranteed not to send any additional information like a cookie or a header), call the endpoint

curl -X GET "http://localhost:8000/api/user/1/" -H "accept: application/json"

It responds with :
{"id":1,"email":"[email protected]","first_name":"Kalin","last_name":"Kochnev","is_anon":false}

I can do this for all IDs in the system and pull out the registered emails and names

I do see a reason to provide some of this information to authenticated users (e.g. as a user browsing the site, I might want to be able to see the names or registered contact info for a specific user), but this seems like it shouldn't be available to unauthenticated users.

I observed this on a few different endpoints:

  • /api/user/{userId}
  • /api/district/

There are probably others as well.

Slideshow position not correct on page load

After commit akochnev@b468822862e802a213ad9280dbe54ab58b36ff3d the slideshow on the club detail page is offset from the position it should be at. It should be centered but is not.
image

Reproduce by using the latest commit and clicking on the club detail page.

Club listing endpoint doesn't return meeting times

The original mockup of the Club Browser page expected to have access to the meeting times for each club. In the initial example, the "meeting times" were return in an array , e.g. ["M","F"] below

[1, "Robotics Club", "https://lh3.googleusercontent.com/pw/ACtC-3fIUy1uUAK3OgwH7h4WURxF4I6vpu1K35iwDZqzBpy_hII4ySNfhqLy7yeFC5Twv9a83Rn4UvdKeZar5dhtLbRjfTsQVNhczKUy4s-CtymhzR2D19tugouYi30BX0i954NKISlQh9qYhSaq27G9JV0kNQ=w1291-h970-no?authuser=0", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", ["M","F"]]

While the ClubBrowser page could technically try to pull that detail from the Club details endpoint, this would be useful to add on the club listing endpoint to avoid a cascading number of API calls to pull out all the details from the backend.

Message not clearing after pressing delete button

Once a status message is sent to the user i.e. telling the user "You have successfully logged in" or any other message, they do not get cleared when pressing the x button. However once the page is refreshed it no longer appears

Probable causes:

Club listing endpoint throws exception

The club list endpoint throws an exception. I thought for a minute that this might be an issue with me not properly providing the auth token, but this fails when called as the super-admin user, which should always work.

This is the main endpoint that I will be using to start putting together the integration with the frontend, so this is a blocker on progress.


KeyError at /api/district/1/school/1/club/
'is_anon'

Request Method: GET
Request URL: http://localhost:8000/api/district/1/school/1/club/
Django Version: 3.0.8
Python Executable: /home/polrtex/projects/XRoads/xroads_django/venv/bin/python3
Python Version: 3.8.2
Python Path: ['/home/polrtex/projects/XRoads/xroads_django', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages']
Server time: Tue, 18 Aug 2020 02:33:49 +0000
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'XroadsAPI.apps.XroadsapiConfig',
'XroadsAuth.apps.XroadsauthConfig',
'rest_framework',
'rest_framework.authtoken',
'dj_rest_auth',
'rest_framework_nested',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'dj_rest_auth.registration',
'drf_yasg']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/viewsets.py", line 114, in view
return self.dispatch(request, *args, **kwargs)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/views.py", line 505, in dispatch
response = self.handle_exception(exc)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/views.py", line 465, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
raise exc
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/views.py", line 502, in dispatch
response = handler(request, *args, **kwargs)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/mixins.py", line 46, in list
return Response(serializer.data)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 760, in data
ret = super().data
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 260, in data
self._data = self.to_representation(self.instance)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 677, in to_representation
return [
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 678, in
self.child.to_representation(item) for item in iterable
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 529, in to_representation
ret[field.field_name] = field.to_representation(attribute)
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 677, in to_representation
return [
File "/home/polrtex/projects/XRoads/xroads_django/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 678, in
self.child.to_representation(item) for item in iterable
File "/home/polrtex/projects/XRoads/xroads_django/XroadsAPI/serializers.py", line 45, in to_representation
if rep['is_anon']:

Exception Type: KeyError at /api/district/1/school/1/club/
Exception Value: 'is_anon'
Request information:
USER: [email protected]

GET: No GET data

POST: No POST data

FILES: No FILES data

COOKIES:
csrftoken = 'VNIKt6an0vfuriIHqXPEuJmSYFQzUSKAfJfFmhsIJjsA4oSOPyVcZMklEBsJOBTy'
sessionid = 'szzqw5e5lyb9ml17wlzzm2j4dzg7v3xa'

META:
CLUTTER_IM_MODULE = 'ibus'
COLORTERM = 'truecolor'
CONTENT_LENGTH = ''
CONTENT_TYPE = 'text/plain'
CSRF_COOKIE = 'VNIKt6an0vfuriIHqXPEuJmSYFQzUSKAfJfFmhsIJjsA4oSOPyVcZMklEBsJOBTy'
DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus'
DEFAULTS_PATH = '/usr/share/gconf/ubuntu.default.path'
DERBY_HOME = '/usr/lib/jvm/java-10-oracle/db'
DESKTOP_SESSION = 'ubuntu'
DISPLAY = ':1'
DJANGO_SETTINGS_MODULE = 'xroads_django.settings'
GATEWAY_INTERFACE = 'CGI/1.1'
GDMSESSION = 'ubuntu'
GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated'
GNOME_SHELL_SESSION_MODE = 'ubuntu'
GNOME_TERMINAL_SCREEN = '/org/gnome/Terminal/screen/c2b19327_4dd0_4ffd_980c_d170088855a8'
GNOME_TERMINAL_SERVICE = ':1.135'
GOPATH = '/usr/local/opt/golang/'
GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1'
GRADLE_HOME = '/home/polrtex/.sdkman/candidates/gradle/current'
GRAILS_HOME = '/home/polrtex/.sdkman/candidates/grails/current'
GTK2_MODULES = 'overlay-scrollbar'
GTK_IM_MODULE = 'ibus'
GTK_MODULES = 'gail:atk-bridge'
HOME = '/home/polrtex'
HTTP_ACCEPT = 'application/json'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.9,bg;q=0.8'
HTTP_CONNECTION = 'keep-alive'
HTTP_COOKIE = 'csrftoken=VNIKt6an0vfuriIHqXPEuJmSYFQzUSKAfJfFmhsIJjsA4oSOPyVcZMklEBsJOBTy; sessionid=szzqw5e5lyb9ml17wlzzm2j4dzg7v3xa'
HTTP_DNT = '1'
HTTP_HOST = 'localhost:8000'
HTTP_REFERER = 'http://localhost:8000/swagger/'
HTTP_SEC_FETCH_DEST = 'empty'
HTTP_SEC_FETCH_MODE = 'cors'
HTTP_SEC_FETCH_SITE = 'same-origin'
HTTP_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36'
HTTP_X_CSRFTOKEN = 'mqQwIJcEo50oZoGMlwlYAVafbZwIfCjuGmnrBUuZ7TduCuQTK7rw5Y8IRV8S9lss'
IM_CONFIG_PHASE = '1'
INVOCATION_ID = '973de86b855f43288f131302576a35c1'
J2REDIR = '/usr/lib/jvm/java-10-oracle'
J2SDKDIR = '/usr/lib/jvm/java-10-oracle'
JAVA_HOME = '/home/polrtex/.sdkman/candidates/java/current'
JOURNAL_STREAM = '9:51854'
LANG = 'en_US.UTF-8'
LESSCLOSE = '/usr/bin/lesspipe %s %s'
LESSOPEN = '| /usr/bin/lesspipe %s'
LOGNAME = 'polrtex'
LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:*.xspf=00;36:'
MANAGERPID = '1441'
MANDATORY_PATH = '/usr/share/gconf/ubuntu.mandatory.path'
MAVEN_HOME = '/home/polrtex/.sdkman/candidates/maven/current'
PATH = '/home/polrtex/projects/XRoads/xroads_django/venv/bin:/home/polrtex/.sdkman/candidates/vertx/current/bin:/home/polrtex/.sdkman/candidates/sbt/current/bin:/home/polrtex/.sdkman/candidates/maven/current/bin:/home/polrtex/.sdkman/candidates/java/current/bin:/home/polrtex/.sdkman/candidates/grails/current/bin:/home/polrtex/.sdkman/candidates/gradle/current/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-10-oracle/bin:/usr/lib/jvm/java-10-oracle/db/bin:/usr/lib/jvm/java-10-oracle/bin:/usr/local/opt/golang//bin'
PATH_INFO = '/api/district/1/school/1/club/'
PS1 = '(venv) \[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PWD = '/home/polrtex/projects/XRoads/xroads_django'
QT4_IM_MODULE = 'ibus'
QT_ACCESSIBILITY = '1'
QT_IM_MODULE = 'ibus'
QUERY_STRING = ''
REMOTE_ADDR = '127.0.0.1'
REMOTE_HOST = ''
REQUEST_METHOD = 'GET'
RUN_MAIN = 'true'
SBT_HOME = '/home/polrtex/.sdkman/candidates/sbt/current'
SCRIPT_NAME = ''
SDKMAN_CANDIDATES_API = 'https://api.sdkman.io/2'
SDKMAN_CANDIDATES_DIR = '/home/polrtex/.sdkman/candidates'
SDKMAN_DIR = '/home/polrtex/.sdkman'
SDKMAN_PLATFORM = 'Linux64'
SDKMAN_VERSION = '5.7.4+362'
SERVER_NAME = 'localhost'
SERVER_PORT = '8000'
SERVER_PROTOCOL = 'HTTP/1.1'
SERVER_SOFTWARE = 'WSGIServer/0.2'
SESSION_MANAGER = 'local/bunmonster3:@/tmp/.ICE-unix/3123,unix/bunmonster3:/tmp/.ICE-unix/3123'
SHELL = '/bin/bash'
SHLVL = '1'
SSH_AGENT_PID = '2986'
SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh'
TERM = 'xterm-256color'
TZ = 'UTC'
USER = 'polrtex'
USERNAME = 'polrtex'
VERTX_HOME = '/home/polrtex/.sdkman/candidates/vertx/current'
VIRTUAL_ENV = '/home/polrtex/projects/XRoads/xroads_django/venv'
VTE_VERSION = '6003'
WINDOWPATH = '2'
XAUTHORITY = '/run/user/1000/gdm/Xauthority'
XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg'
XDG_CURRENT_DESKTOP = 'ubuntu:GNOME'
XDG_DATA_DIRS = '/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop:/var/lib/snapd/desktop'
XDG_MENU_PREFIX = 'gnome-'
XDG_RUNTIME_DIR = '/run/user/1000'
XDG_SESSION_CLASS = 'user'
XDG_SESSION_DESKTOP = 'ubuntu'
XDG_SESSION_TYPE = 'x11'
XMODIFIERS = '@im=ibus'
_ = '/home/polrtex/projects/XRoads/xroads_django/venv/bin/python3'
wsgi.errors = <_io.TextIOWrapper name='' mode='w' encoding='utf-8'>
wsgi.file_wrapper = ''
wsgi.input = <django.core.handlers.wsgi.LimitedStream object at 0x7f2e681d1d60>
wsgi.multiprocess = False
wsgi.multithread = True
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = '(1, 0)'

Settings:
Using settings module xroads_django.settings
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL = '/auth/registration/success/'
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 7
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = False
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ADMINS = []
ALLOWED_HOSTS = []
APPEND_SLASH = True
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend', 'allauth.account.auth_backends.AuthenticationBackend']
AUTH_PASSWORD_VALIDATORS = ''
AUTH_USER_MODEL = 'XroadsAuth.Profile'
BASE_DIR = '/home/polrtex/projects/XRoads/xroads_django'
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '
'
CACHE_MIDDLEWARE_SECONDS = 600
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
CSRF_USE_SESSIONS = False
DATABASES = {'default': {'ENGINE': 'django.db.backends.postgresql', 'NAME': 'xroadsdb', 'USER': 'djangouser', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': '5432', 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'OPTIONS': {}, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'NAME': None, 'MIRROR': None}}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
DEBUG = True
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'webmaster@localhost'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_HOST_PASSWORD = '
'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = ''
EMAIL_SUBJECT_PREFIX = '[Django] '
EMAIL_TIMEOUT = None
EMAIL_USE_LOCALTIME = False
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = 420
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = []
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'XroadsAPI.apps.XroadsapiConfig', 'XroadsAuth.apps.XroadsauthConfig', 'rest_framework', 'rest_framework.authtoken', 'dj_rest_auth', 'rest_framework_nested', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'dj_rest_auth.registration', 'drf_yasg']
INTERNAL_IPS = []
LANGUAGES = [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE = 'en-us'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_HTTPONLY = False
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LANGUAGE_COOKIE_SAMESITE = None
LANGUAGE_COOKIE_SECURE = False
LOCALE_PATHS = []
LOGGING = {}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/accounts/profile/'
LOGIN_URL = '/auth/registration/success/'
LOGOUT_REDIRECT_URL = None
MANAGERS = []
MEDIA_ROOT = '/home/polrtex/projects/XRoads/xroads_django/media/'
MEDIA_URL = '/media/'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE = ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '
'
PASSWORD_RESET_TIMEOUT_DAYS = ''
PREPEND_WWW = False
ROOT_URLCONF = 'xroads_django.urls'
SECRET_KEY = '
'
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False
SECURE_HSTS_SECONDS = 0
SECURE_PROXY_SSL_HEADER = None
SECURE_REDIRECT_EXEMPT = []
SECURE_REFERRER_POLICY = None
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SERVER_EMAIL = 'root@localhost'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SAMESITE = 'Lax'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'xroads_django.settings'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 1
STATICFILES_DIRS = []
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = None
STATIC_URL = '/static/'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': {'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages']}}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = 'xroads_django.wsgi.application'
X_FRAME_OPTIONS = 'DENY'
YEAR_MONTH_FORMAT = 'F Y'

You're seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.

Register validation fails with "Ensure this field has no more than 0 characters."

I am unable to use the /auth/register endpoint because no possible value can satisfy the validation requirements.
Repro steps:

  1. Navigate to the Swagger UI - http://localhost:8000/swagger/
  2. Use the /auth/registration endpoint
  3. Provide data in the body
    {
    "username": "xruser1",
    "email": "[email protected]",
    "password1": "nimda123!",
    "password2": "nimda123!"
    }

Result : the validation fails with an error:
{
"username": [
"Ensure this field has no more than 0 characters."
]
}

It appears that the validation is missing a maxLength validator which defaults to 0 length and always fails.

SchoolClass post dropdown not querying properly after back button

If you submit a post (successfully or unsuccessfully) and press the back button to see your post with the filled in data, the class field will be automatically set blank. Even if you change one of the fields like the grade or subject it will not update the dropdown.

Possible solution:

  • store value of queried class in js
  • store a cookie in the browser

Database not migrating as a result of form query

In the forms.py of the forums app the database will not migrate because of a statement such as:
tuple_var = [ (forum, str(forum)) for forum in SubForum.objects.all() ]
form_choices = forms.CharField(widget=forms.Select(choices=tuple_var)

The reason being is because the form queries the database while it is migrating which ends up being problematic and prevent it from doing so. No solution has been found yet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.