From 0ca4a40a33b14cd612b261f0328c8125fafdfc9c Mon Sep 17 00:00:00 2001 From: dawnwages Date: Tue, 21 Mar 2023 17:29:01 -0400 Subject: [PATCH 1/7] add pylint requirement, move dotenv requirement to dev --- accounts/views.py | 1 + requirements/requirements-dev.txt | 4 ++-- requirements/requirements.txt | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index 9b2d41b4..caf6484e 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -6,6 +6,7 @@ from django.shortcuts import render from django.contrib.auth.decorators import login_required + class SignUpView(CreateView): form_class = CustomUserCreationForm success_url = reverse_lazy("login") diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index ef477b9e..60c9d511 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -1,4 +1,4 @@ -r requirements.txt black -flake8 -python-dotenv==0.21.* \ No newline at end of file +python-dotenv==0.21.* +pylint \ No newline at end of file diff --git a/requirements/requirements.txt b/requirements/requirements.txt index b1e3bedf..080bcb33 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -6,6 +6,5 @@ psycopg2-binary django-recaptcha==3.0.* whitenoise -python-dotenv git+ssh://git@github.com/Djangonaut-Space/puput.git@3525203b25a7c2e4ddbae4f82773b060c41d5feb#egg=puput From ca5d6d71abb5c3455b60583bea5d72893c0a4fb1 Mon Sep 17 00:00:00 2001 From: dawnwages Date: Tue, 21 Mar 2023 17:38:09 -0400 Subject: [PATCH 2/7] track changes in .vscode dir --- .gitignore | 2 +- .vscode/settings.json | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index be44c73a..c7960881 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,6 @@ npm-debug.log yarn-error.log yarn.lock .yarnclean -.vscode +//.vscode .idea .env \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1ba6b359 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "appService.defaultWebAppToDeploy": "/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/AppServices/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/resourceGroups/appsvc_linux_centralus_basic/providers/Microsoft.Web/sites/djangonaut-space", + "appService.deploySubpath": "./indymeet/", +} \ No newline at end of file From 5ab1b34f1fd4901705887a1c6813ae21ccc32bd0 Mon Sep 17 00:00:00 2001 From: dawnwages Date: Mon, 27 Mar 2023 14:30:31 -0400 Subject: [PATCH 3/7] pylint --- .pylintrc | 630 ++++++++++++++++++++++++++++++++++++++++++++++ accounts/views.py | 2 +- 2 files changed, 631 insertions(+), 1 deletion(-) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 00000000..2d35649d --- /dev/null +++ b/.pylintrc @@ -0,0 +1,630 @@ +[MAIN] + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Clear in-memory caches upon conclusion of linting. Useful if running pylint +# in a server-like mode. +clear-cache-post-run=no + +# Load and enable all available extensions. Use --list-extensions to see a list +# all available extensions. +#enable-all-extensions= + +# In error mode, messages with a category besides ERROR or FATAL are +# suppressed, and no reports are done by default. Error mode is compatible with +# disabling specific errors. +#errors-only= + +# Always return a 0 (non-error) status code, even if lint errors are found. +# This is primarily useful in continuous integration scripts. +#exit-zero= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-allow-list= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. (This is an alternative name to extension-pkg-allow-list +# for backward compatibility.) +extension-pkg-whitelist= + +# Return non-zero exit code if any of these messages/categories are detected, +# even if score is above --fail-under value. Syntax same as enable. Messages +# specified are enabled, while categories only check already-enabled messages. +fail-on= + +# Specify a score threshold under which the program will exit with error. +fail-under=10 + +# Interpret the stdin as a python script, whose filename needs to be passed as +# the module_or_package argument. +#from-stdin= + +# Files or directories to be skipped. They should be base names, not paths. +ignore=CVS + +# Add files or directories matching the regular expressions patterns to the +# ignore-list. The regex matches against paths and can be in Posix or Windows +# format. Because '\\' represents the directory delimiter on Windows systems, +# it can't be used as an escape character. +ignore-paths= + +# Files or directories matching the regular expression patterns are skipped. +# The regex matches against base names, not paths. The default value ignores +# Emacs file locks +ignore-patterns=^\.# + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis). It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use, and will cap the count on Windows to +# avoid hangs. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# Minimum Python version to use for version dependent checks. Will default to +# the version used to run pylint. +py-version=3.9 + +# Discover python modules and packages in the file system subtree. +recursive=no + +# Add paths to the list of the source roots. Supports globbing patterns. The +# source root is an absolute path or a path relative to the current working +# directory used to determine a package namespace for modules located under the +# source root. +source-roots= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# In verbose mode, extra non-checker-related info will be displayed. +#verbose= + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. If left empty, argument names will be checked with the set +# naming style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. If left empty, attribute names will be checked with the set naming +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. If left empty, class attribute names will be checked +# with the set naming style. +#class-attribute-rgx= + +# Naming style matching correct class constant names. +class-const-naming-style=UPPER_CASE + +# Regular expression matching correct class constant names. Overrides class- +# const-naming-style. If left empty, class constant names will be checked with +# the set naming style. +#class-const-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. If left empty, class names will be checked with the set naming style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. If left empty, constant names will be checked with the set naming +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. If left empty, function names will be checked with the set +# naming style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. If left empty, inline iteration names will be checked +# with the set naming style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. If left empty, method names will be checked with the set naming style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. If left empty, module names will be checked with the set naming style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Regular expression matching correct type alias names. If left empty, type +# alias names will be checked with the set naming style. +#typealias-rgx= + +# Regular expression matching correct type variable names. If left empty, type +# variable names will be checked with the set naming style. +#typevar-rgx= + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. If left empty, variable names will be checked with the set +# naming style. +#variable-rgx= + + +[CLASSES] + +# Warn about protected attribute access inside special methods +check-protected-access-in-special-methods=no + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + __post_init__ + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[DESIGN] + +# List of regular expressions of class ancestor names to ignore when counting +# public methods (see R0903) +exclude-too-few-public-methods= + +# List of qualified class names to ignore when counting class parents (see +# R0901) +ignored-parents= + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when caught. +overgeneral-exceptions=builtins.BaseException,builtins.Exception + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[IMPORTS] + +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= + +# Allow explicit reexports by alias from a package __init__. +allow-reexport-from-package=no + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules= + +# Output a graph (.gv or any supported image format) of external dependencies +# to the given file (report RP0402 must not be disabled). +ext-import-graph= + +# Output a graph (.gv or any supported image format) of all (i.e. internal and +# external) dependencies to the given file (report RP0402 must not be +# disabled). +import-graph= + +# Output a graph (.gv or any supported image format) of internal dependencies +# to the given file (report RP0402 must not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= + + +[LOGGING] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +# UNDEFINED. +confidence=HIGH, + CONTROL_FLOW, + INFERENCE, + INFERENCE_FAILURE, + UNDEFINED + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then re-enable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[METHOD_ARGS] + +# List of qualified names (i.e., library.method) which require a timeout +# parameter e.g. 'requests.api.get,requests.api.post' +timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + +# Regular expression of note tags to take in consideration. +notes-rgx= + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit,argparse.parse_error + + +[REPORTS] + +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'fatal', 'error', 'warning', 'refactor', +# 'convention', and 'info' which contain the number of messages in each +# category, as well as 'statement' which is the total number of statements +# analyzed. This score is used by the global evaluation report (RP0004). +evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +#output-format= + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[SIMILARITIES] + +# Comments are removed from the similarity computation +ignore-comments=yes + +# Docstrings are removed from the similarity computation +ignore-docstrings=yes + +# Imports are removed from the similarity computation +ignore-imports=yes + +# Signatures are removed from the similarity computation +ignore-signatures=yes + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. No available dictionaries : You need to install +# both the python package and the system dependency for enchant to work.. +spelling-dict= + +# List of comma separated words that should be considered directives if they +# appear at the beginning of a comment and should not be checked. +spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of symbolic message names to ignore for Mixin members. +ignored-checks-for-mixins=no-member, + not-async-context-manager, + not-context-manager, + attribute-defined-outside-init + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# Regex pattern to define which classes are considered mixins. +mixin-class-rgx=.*[Mm]ixin + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of names allowed to shadow builtins +allowed-redefined-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/accounts/views.py b/accounts/views.py index caf6484e..bb3a58cb 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required -class SignUpView(CreateView): +class SignUpView(CreateView): # pylint: disable=C0115 form_class = CustomUserCreationForm success_url = reverse_lazy("login") template_name = "registration/signup.html" From 202d594e498c727a63703b854f64174523cf9741 Mon Sep 17 00:00:00 2001 From: dawnwages Date: Thu, 30 Mar 2023 12:49:19 +0000 Subject: [PATCH 4/7] dev containers and format on save pylint --- .gitignore | 62 +- .pylintrc | 1260 ++++++++--------- .template.env | 16 +- .vscode/settings.json | 6 +- Dockerfile | 60 - README.md | 412 +++--- accounts/admin.py | 102 +- accounts/apps.py | 12 +- accounts/forms.py | 62 +- accounts/migrations/0001_initial.py | 96 +- ...muser_bio_customuser_bio_image_and_more.py | 110 +- ...io_remove_customuser_bio_image_and_more.py | 130 +- .../0004_alter_userprofile_member_role.py | 36 +- accounts/models.py | 126 +- accounts/tests.py | 6 +- accounts/urls.py | 16 +- accounts/views.py | 36 +- docker-compose.yml | 15 + home/admin.py | 40 +- home/forms.py | 78 +- home/migrations/0001_initial.py | 64 +- home/migrations/0002_create_homepage.py | 124 +- .../migrations/0003_signuppage_signupfield.py | 100 +- home/migrations/0004_speaker_speakerlink.py | 82 +- ...kerlink_speaker_delete_speaker_and_more.py | 46 +- .../migrations/0006_category_session_event.py | 114 +- home/models.py | 170 +-- home/static/css/events.css | 38 +- home/static/css/welcome_page.css | 400 +++--- home/templates/forms/sign_up.html | 52 +- home/templates/home/calendar.html | 90 +- home/templates/home/event_detail.html | 168 +-- home/templates/home/home_page.html | 58 +- home/templates/home/includes/event_card.html | 56 +- .../home/includes/event_categories.html | 30 +- home/templates/home/includes/event_team.html | 22 +- .../home/includes/event_team_member.html | 36 +- home/templates/home/includes/events_past.html | 56 +- .../home/includes/events_upcoming.html | 56 +- .../home/includes/homepage_blade.html | 34 +- .../templates/home/includes/welcome_page.html | 26 +- home/urls.py | 14 +- home/views.py | 60 +- indymeet/settings/base.py | 382 ++--- indymeet/settings/dev.py | 92 +- indymeet/settings/production.py | 84 +- indymeet/static/css/indymeet.css | 36 +- indymeet/static/css/registration.css | 54 +- indymeet/templates/404.html | 22 +- indymeet/templates/500.html | 26 +- indymeet/templates/base.html | 158 +-- indymeet/templates/includes/breadcrumbs.html | 14 +- indymeet/templates/includes/footer.html | 48 +- indymeet/templates/includes/nav.html | 128 +- indymeet/templates/puput/base.html | 152 +- indymeet/templates/puput/blog_page.html | 208 +-- .../templates/registration/logged_out.html | 46 +- indymeet/templates/registration/login.html | 110 +- indymeet/templates/registration/profile.html | 182 +-- indymeet/templates/registration/signup.html | 88 +- .../templates/wagtailusers/users/create.html | 20 +- .../templates/wagtailusers/users/edit.html | 20 +- indymeet/urls.py | 76 +- indymeet/wsgi.py | 32 +- manage.py | 20 +- requirements.txt | 24 +- requirements/requirements-dev.txt | 6 +- requirements/requirements-test.txt | 6 +- requirements/requirements.txt | 21 +- search/templates/search/search.html | 76 +- search/views.py | 76 +- 71 files changed, 3371 insertions(+), 3413 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index c7960881..0d7d8c10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,32 +1,32 @@ -.idea/ -.temp_cache/ -db.sqlite3 -node_modules/ -venv/ -build/ -__pycache__ -*.pyc -*.db -mediafiles/* -media/* -.env -.python-version - -staticfiles/* - -# dependencies -node_modules - -# production -build - -# misc -.DS_Store - -npm-debug.log -yarn-error.log -yarn.lock -.yarnclean -//.vscode -.idea +.idea/ +.temp_cache/ +db.sqlite3 +node_modules/ +venv/ +build/ +__pycache__ +*.pyc +*.db +mediafiles/* +media/* +.env +.python-version + +staticfiles/* + +# dependencies +node_modules + +# production +build + +# misc +.DS_Store + +npm-debug.log +yarn-error.log +yarn.lock +.yarnclean +//.vscode +.idea .env \ No newline at end of file diff --git a/.pylintrc b/.pylintrc index 2d35649d..dd849573 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,630 +1,630 @@ -[MAIN] - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Clear in-memory caches upon conclusion of linting. Useful if running pylint -# in a server-like mode. -clear-cache-post-run=no - -# Load and enable all available extensions. Use --list-extensions to see a list -# all available extensions. -#enable-all-extensions= - -# In error mode, messages with a category besides ERROR or FATAL are -# suppressed, and no reports are done by default. Error mode is compatible with -# disabling specific errors. -#errors-only= - -# Always return a 0 (non-error) status code, even if lint errors are found. -# This is primarily useful in continuous integration scripts. -#exit-zero= - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. -extension-pkg-allow-list= - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code. (This is an alternative name to extension-pkg-allow-list -# for backward compatibility.) -extension-pkg-whitelist= - -# Return non-zero exit code if any of these messages/categories are detected, -# even if score is above --fail-under value. Syntax same as enable. Messages -# specified are enabled, while categories only check already-enabled messages. -fail-on= - -# Specify a score threshold under which the program will exit with error. -fail-under=10 - -# Interpret the stdin as a python script, whose filename needs to be passed as -# the module_or_package argument. -#from-stdin= - -# Files or directories to be skipped. They should be base names, not paths. -ignore=CVS - -# Add files or directories matching the regular expressions patterns to the -# ignore-list. The regex matches against paths and can be in Posix or Windows -# format. Because '\\' represents the directory delimiter on Windows systems, -# it can't be used as an escape character. -ignore-paths= - -# Files or directories matching the regular expression patterns are skipped. -# The regex matches against base names, not paths. The default value ignores -# Emacs file locks -ignore-patterns=^\.# - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis). It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use, and will cap the count on Windows to -# avoid hangs. -jobs=1 - -# Control the amount of potential inferred values when inferring a single -# object. This can help the performance when dealing with large functions or -# complex, nested conditions. -limit-inference-results=100 - -# List of plugins (as comma separated values of python module names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Minimum Python version to use for version dependent checks. Will default to -# the version used to run pylint. -py-version=3.9 - -# Discover python modules and packages in the file system subtree. -recursive=no - -# Add paths to the list of the source roots. Supports globbing patterns. The -# source root is an absolute path or a path relative to the current working -# directory used to determine a package namespace for modules located under the -# source root. -source-roots= - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - -# In verbose mode, extra non-checker-related info will be displayed. -#verbose= - - -[BASIC] - -# Naming style matching correct argument names. -argument-naming-style=snake_case - -# Regular expression matching correct argument names. Overrides argument- -# naming-style. If left empty, argument names will be checked with the set -# naming style. -#argument-rgx= - -# Naming style matching correct attribute names. -attr-naming-style=snake_case - -# Regular expression matching correct attribute names. Overrides attr-naming- -# style. If left empty, attribute names will be checked with the set naming -# style. -#attr-rgx= - -# Bad variable names which should always be refused, separated by a comma. -bad-names=foo, - bar, - baz, - toto, - tutu, - tata - -# Bad variable names regexes, separated by a comma. If names match any regex, -# they will always be refused -bad-names-rgxs= - -# Naming style matching correct class attribute names. -class-attribute-naming-style=any - -# Regular expression matching correct class attribute names. Overrides class- -# attribute-naming-style. If left empty, class attribute names will be checked -# with the set naming style. -#class-attribute-rgx= - -# Naming style matching correct class constant names. -class-const-naming-style=UPPER_CASE - -# Regular expression matching correct class constant names. Overrides class- -# const-naming-style. If left empty, class constant names will be checked with -# the set naming style. -#class-const-rgx= - -# Naming style matching correct class names. -class-naming-style=PascalCase - -# Regular expression matching correct class names. Overrides class-naming- -# style. If left empty, class names will be checked with the set naming style. -#class-rgx= - -# Naming style matching correct constant names. -const-naming-style=UPPER_CASE - -# Regular expression matching correct constant names. Overrides const-naming- -# style. If left empty, constant names will be checked with the set naming -# style. -#const-rgx= - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming style matching correct function names. -function-naming-style=snake_case - -# Regular expression matching correct function names. Overrides function- -# naming-style. If left empty, function names will be checked with the set -# naming style. -#function-rgx= - -# Good variable names which should always be accepted, separated by a comma. -good-names=i, - j, - k, - ex, - Run, - _ - -# Good variable names regexes, separated by a comma. If names match any regex, -# they will always be accepted -good-names-rgxs= - -# Include a hint for the correct naming format with invalid-name. -include-naming-hint=no - -# Naming style matching correct inline iteration names. -inlinevar-naming-style=any - -# Regular expression matching correct inline iteration names. Overrides -# inlinevar-naming-style. If left empty, inline iteration names will be checked -# with the set naming style. -#inlinevar-rgx= - -# Naming style matching correct method names. -method-naming-style=snake_case - -# Regular expression matching correct method names. Overrides method-naming- -# style. If left empty, method names will be checked with the set naming style. -#method-rgx= - -# Naming style matching correct module names. -module-naming-style=snake_case - -# Regular expression matching correct module names. Overrides module-naming- -# style. If left empty, module names will be checked with the set naming style. -#module-rgx= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -# These decorators are taken in consideration only for invalid-name. -property-classes=abc.abstractproperty - -# Regular expression matching correct type alias names. If left empty, type -# alias names will be checked with the set naming style. -#typealias-rgx= - -# Regular expression matching correct type variable names. If left empty, type -# variable names will be checked with the set naming style. -#typevar-rgx= - -# Naming style matching correct variable names. -variable-naming-style=snake_case - -# Regular expression matching correct variable names. Overrides variable- -# naming-style. If left empty, variable names will be checked with the set -# naming style. -#variable-rgx= - - -[CLASSES] - -# Warn about protected attribute access inside special methods -check-protected-access-in-special-methods=no - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp, - __post_init__ - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[DESIGN] - -# List of regular expressions of class ancestor names to ignore when counting -# public methods (see R0903) -exclude-too-few-public-methods= - -# List of qualified class names to ignore when counting class parents (see -# R0901) -ignored-parents= - -# Maximum number of arguments for function / method. -max-args=5 - -# Maximum number of attributes for a class (see R0902). -max-attributes=7 - -# Maximum number of boolean expressions in an if statement (see R0916). -max-bool-expr=5 - -# Maximum number of branch for function / method body. -max-branches=12 - -# Maximum number of locals for function / method body. -max-locals=15 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body. -max-returns=6 - -# Maximum number of statements in function / method body. -max-statements=50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=2 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when caught. -overgeneral-exceptions=builtins.BaseException,builtins.Exception - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=^\s*(# )??$ - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=100 - -# Maximum number of lines in a module. -max-module-lines=1000 - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=no - - -[IMPORTS] - -# List of modules that can be imported at any level, not just the top level -# one. -allow-any-import-level= - -# Allow explicit reexports by alias from a package __init__. -allow-reexport-from-package=no - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Deprecated modules which should not be used, separated by a comma. -deprecated-modules= - -# Output a graph (.gv or any supported image format) of external dependencies -# to the given file (report RP0402 must not be disabled). -ext-import-graph= - -# Output a graph (.gv or any supported image format) of all (i.e. internal and -# external) dependencies to the given file (report RP0402 must not be -# disabled). -import-graph= - -# Output a graph (.gv or any supported image format) of internal dependencies -# to the given file (report RP0402 must not be disabled). -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - -# Couples of modules and preferred modules, separated by a comma. -preferred-modules= - - -[LOGGING] - -# The type of string formatting that logging methods do. `old` means using % -# formatting, `new` is for `{}` formatting. -logging-format-style=old - -# Logging modules to check that the string format arguments are in logging -# function parameter format. -logging-modules=logging - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, -# UNDEFINED. -confidence=HIGH, - CONTROL_FLOW, - INFERENCE, - INFERENCE_FAILURE, - UNDEFINED - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once). You can also use "--disable=all" to -# disable everything first and then re-enable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". -disable=raw-checker-failed, - bad-inline-option, - locally-disabled, - file-ignored, - suppressed-message, - useless-suppression, - deprecated-pragma, - use-symbolic-message-instead - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable=c-extension-no-member - - -[METHOD_ARGS] - -# List of qualified names (i.e., library.method) which require a timeout -# parameter e.g. 'requests.api.get,requests.api.post' -timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=FIXME, - XXX, - TODO - -# Regular expression of note tags to take in consideration. -notes-rgx= - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - -# Complete name of functions that never returns. When checking for -# inconsistent-return-statements if a never returning function is called then -# it will be considered as an explicit return statement and no message will be -# printed. -never-returning-functions=sys.exit,argparse.parse_error - - -[REPORTS] - -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'fatal', 'error', 'warning', 'refactor', -# 'convention', and 'info' which contain the number of messages in each -# category, as well as 'statement' which is the total number of statements -# analyzed. This score is used by the global evaluation report (RP0004). -evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details. -msg-template= - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio). You can also give a reporter class, e.g. -# mypackage.mymodule.MyReporterClass. -#output-format= - -# Tells whether to display a full report or only the messages. -reports=no - -# Activate the evaluation score. -score=yes - - -[SIMILARITIES] - -# Comments are removed from the similarity computation -ignore-comments=yes - -# Docstrings are removed from the similarity computation -ignore-docstrings=yes - -# Imports are removed from the similarity computation -ignore-imports=yes - -# Signatures are removed from the similarity computation -ignore-signatures=yes - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[SPELLING] - -# Limits count of emitted suggestions for spelling mistakes. -max-spelling-suggestions=4 - -# Spelling dictionary name. No available dictionaries : You need to install -# both the python package and the system dependency for enchant to work.. -spelling-dict= - -# List of comma separated words that should be considered directives if they -# appear at the beginning of a comment and should not be checked. -spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains the private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to the private dictionary (see the -# --spelling-private-dict-file option) instead of raising a message. -spelling-store-unknown-words=no - - -[STRING] - -# This flag controls whether inconsistent-quotes generates a warning when the -# character used as a quote delimiter is used inconsistently within a module. -check-quote-consistency=no - -# This flag controls whether the implicit-str-concat should generate a warning -# on implicit string concatenation in sequences defined over several lines. -check-str-concat-over-line-jumps=no - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether to warn about missing members when the owner of the attribute -# is inferred to be None. -ignore-none=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of symbolic message names to ignore for Mixin members. -ignored-checks-for-mixins=no-member, - not-async-context-manager, - not-context-manager, - attribute-defined-outside-init - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - -# Regex pattern to define which classes are considered mixins. -mixin-class-rgx=.*[Mm]ixin - -# List of decorators that change the signature of a decorated function. -signature-mutators= - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid defining new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of names allowed to shadow builtins -allowed-redefined-builtins= - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_, - _cb - -# A regular expression matching the name of dummy variables (i.e. expected to -# not be used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io +[MAIN] + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Clear in-memory caches upon conclusion of linting. Useful if running pylint +# in a server-like mode. +clear-cache-post-run=no + +# Load and enable all available extensions. Use --list-extensions to see a list +# all available extensions. +#enable-all-extensions= + +# In error mode, messages with a category besides ERROR or FATAL are +# suppressed, and no reports are done by default. Error mode is compatible with +# disabling specific errors. +#errors-only= + +# Always return a 0 (non-error) status code, even if lint errors are found. +# This is primarily useful in continuous integration scripts. +#exit-zero= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-allow-list= + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. (This is an alternative name to extension-pkg-allow-list +# for backward compatibility.) +extension-pkg-whitelist= + +# Return non-zero exit code if any of these messages/categories are detected, +# even if score is above --fail-under value. Syntax same as enable. Messages +# specified are enabled, while categories only check already-enabled messages. +fail-on= + +# Specify a score threshold under which the program will exit with error. +fail-under=10 + +# Interpret the stdin as a python script, whose filename needs to be passed as +# the module_or_package argument. +#from-stdin= + +# Files or directories to be skipped. They should be base names, not paths. +ignore=CVS + +# Add files or directories matching the regular expressions patterns to the +# ignore-list. The regex matches against paths and can be in Posix or Windows +# format. Because '\\' represents the directory delimiter on Windows systems, +# it can't be used as an escape character. +ignore-paths= + +# Files or directories matching the regular expression patterns are skipped. +# The regex matches against base names, not paths. The default value ignores +# Emacs file locks +ignore-patterns=^\.# + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis). It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use, and will cap the count on Windows to +# avoid hangs. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# Minimum Python version to use for version dependent checks. Will default to +# the version used to run pylint. +py-version=3.9 + +# Discover python modules and packages in the file system subtree. +recursive=no + +# Add paths to the list of the source roots. Supports globbing patterns. The +# source root is an absolute path or a path relative to the current working +# directory used to determine a package namespace for modules located under the +# source root. +source-roots= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# In verbose mode, extra non-checker-related info will be displayed. +#verbose= + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. If left empty, argument names will be checked with the set +# naming style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. If left empty, attribute names will be checked with the set naming +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Bad variable names regexes, separated by a comma. If names match any regex, +# they will always be refused +bad-names-rgxs= + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. If left empty, class attribute names will be checked +# with the set naming style. +#class-attribute-rgx= + +# Naming style matching correct class constant names. +class-const-naming-style=UPPER_CASE + +# Regular expression matching correct class constant names. Overrides class- +# const-naming-style. If left empty, class constant names will be checked with +# the set naming style. +#class-const-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. If left empty, class names will be checked with the set naming style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. If left empty, constant names will be checked with the set naming +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. If left empty, function names will be checked with the set +# naming style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _ + +# Good variable names regexes, separated by a comma. If names match any regex, +# they will always be accepted +good-names-rgxs= + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. If left empty, inline iteration names will be checked +# with the set naming style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. If left empty, method names will be checked with the set naming style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. If left empty, module names will be checked with the set naming style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Regular expression matching correct type alias names. If left empty, type +# alias names will be checked with the set naming style. +#typealias-rgx= + +# Regular expression matching correct type variable names. If left empty, type +# variable names will be checked with the set naming style. +#typevar-rgx= + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. If left empty, variable names will be checked with the set +# naming style. +#variable-rgx= + + +[CLASSES] + +# Warn about protected attribute access inside special methods +check-protected-access-in-special-methods=no + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp, + __post_init__ + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=mcs + + +[DESIGN] + +# List of regular expressions of class ancestor names to ignore when counting +# public methods (see R0903) +exclude-too-few-public-methods= + +# List of qualified class names to ignore when counting class parents (see +# R0901) +ignored-parents= + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement (see R0916). +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when caught. +overgeneral-exceptions=builtins.BaseException,builtins.Exception + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[IMPORTS] + +# List of modules that can be imported at any level, not just the top level +# one. +allow-any-import-level= + +# Allow explicit reexports by alias from a package __init__. +allow-reexport-from-package=no + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules= + +# Output a graph (.gv or any supported image format) of external dependencies +# to the given file (report RP0402 must not be disabled). +ext-import-graph= + +# Output a graph (.gv or any supported image format) of all (i.e. internal and +# external) dependencies to the given file (report RP0402 must not be +# disabled). +import-graph= + +# Output a graph (.gv or any supported image format) of internal dependencies +# to the given file (report RP0402 must not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + +# Couples of modules and preferred modules, separated by a comma. +preferred-modules= + + +[LOGGING] + +# The type of string formatting that logging methods do. `old` means using % +# formatting, `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, +# UNDEFINED. +confidence=HIGH, + CONTROL_FLOW, + INFERENCE, + INFERENCE_FAILURE, + UNDEFINED + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then re-enable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=raw-checker-failed, + bad-inline-option, + locally-disabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[METHOD_ARGS] + +# List of qualified names (i.e., library.method) which require a timeout +# parameter e.g. 'requests.api.get,requests.api.post' +timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + +# Regular expression of note tags to take in consideration. +notes-rgx= + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit,argparse.parse_error + + +[REPORTS] + +# Python expression which should return a score less than or equal to 10. You +# have access to the variables 'fatal', 'error', 'warning', 'refactor', +# 'convention', and 'info' which contain the number of messages in each +# category, as well as 'statement' which is the total number of statements +# analyzed. This score is used by the global evaluation report (RP0004). +evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +#output-format= + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[SIMILARITIES] + +# Comments are removed from the similarity computation +ignore-comments=yes + +# Docstrings are removed from the similarity computation +ignore-docstrings=yes + +# Imports are removed from the similarity computation +ignore-imports=yes + +# Signatures are removed from the similarity computation +ignore-signatures=yes + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. No available dictionaries : You need to install +# both the python package and the system dependency for enchant to work.. +spelling-dict= + +# List of comma separated words that should be considered directives if they +# appear at the beginning of a comment and should not be checked. +spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains the private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to the private dictionary (see the +# --spelling-private-dict-file option) instead of raising a message. +spelling-store-unknown-words=no + + +[STRING] + +# This flag controls whether inconsistent-quotes generates a warning when the +# character used as a quote delimiter is used inconsistently within a module. +check-quote-consistency=no + +# This flag controls whether the implicit-str-concat should generate a warning +# on implicit string concatenation in sequences defined over several lines. +check-str-concat-over-line-jumps=no + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of symbolic message names to ignore for Mixin members. +ignored-checks-for-mixins=no-member, + not-async-context-manager, + not-context-manager, + attribute-defined-outside-init + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + +# Regex pattern to define which classes are considered mixins. +mixin-class-rgx=.*[Mm]ixin + +# List of decorators that change the signature of a decorated function. +signature-mutators= + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of names allowed to shadow builtins +allowed-redefined-builtins= + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io diff --git a/.template.env b/.template.env index b919a8a8..9d652a52 100644 --- a/.template.env +++ b/.template.env @@ -1,8 +1,8 @@ -DATABASE='' -PASSWORD='' -USER='@' -HOST='.postgres.database.azure.com' -SECRET_KEY= -ENVIRONMENT='production' -RECAPTCHA_PUBLIC_KEY='dummy_value' -RECAPTCHA_PRIVATE_KEY='dummy_value' +DATABASE='' +PASSWORD='' +USER='@' +HOST='.postgres.database.azure.com' +SECRET_KEY= +ENVIRONMENT='production' +RECAPTCHA_PUBLIC_KEY='dummy_value' +RECAPTCHA_PRIVATE_KEY='dummy_value' diff --git a/.vscode/settings.json b/.vscode/settings.json index 1ba6b359..b5b865f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ -{ - "appService.defaultWebAppToDeploy": "/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/AppServices/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/resourceGroups/appsvc_linux_centralus_basic/providers/Microsoft.Web/sites/djangonaut-space", - "appService.deploySubpath": "./indymeet/", +{ + "appService.defaultWebAppToDeploy": "/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/AppServices/subscriptions/0ced3c22-2e60-46c5-9c3e-82ce5cc5e930/resourceGroups/appsvc_linux_centralus_basic/providers/Microsoft.Web/sites/djangonaut-space", + "appService.deploySubpath": "./indymeet/", } \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index df309564..00000000 --- a/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Use an official Python runtime based on Debian 10 "buster" as a parent image. -FROM python:3.8.1-slim-buster - -# Add user that will be used in the container. -RUN useradd wagtail - -# Port used by this container to serve HTTP. -EXPOSE 8000 - -# Set environment variables. -# 1. Force Python stdout and stderr streams to be unbuffered. -# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE" -# command. -ENV PYTHONUNBUFFERED=1 \ - PORT=8000 - -# Install system packages required by Wagtail and Django. -RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ - build-essential \ - libpq-dev \ - libmariadbclient-dev \ - libjpeg62-turbo-dev \ - zlib1g-dev \ - libwebp-dev \ - && rm -rf /var/lib/apt/lists/* - -# Install the application server. -RUN pip install "gunicorn==20.0.4" - -# Install the project requirements. -COPY requirements.txt / -RUN pip install -r /requirements.txt - -# Use /app folder as a directory where the source code is stored. -WORKDIR /app - -# Set this directory to be owned by the "wagtail" user. This Wagtail project -# uses SQLite, the folder needs to be owned by the user that -# will be writing to the database file. -RUN chown wagtail:wagtail /app - -# Copy the source code of the project into the container. -COPY --chown=wagtail:wagtail . . - -# Use user "wagtail" to run the build commands below and the server itself. -USER wagtail - -# Collect static files. -RUN python manage.py collectstatic --noinput --clear - -# Runtime command that executes when "docker run" is called, it does the -# following: -# 1. Migrate the database. -# 2. Start the application server. -# WARNING: -# Migrating database at the same time as starting the server IS NOT THE BEST -# PRACTICE. The database should be migrated manually or using the release -# phase facilities of your hosting platform. This is used only so the -# Wagtail instance can be started with a simple "docker run" command. -CMD set -xe; python manage.py migrate --noinput; gunicorn indymeet.wsgi:application diff --git a/README.md b/README.md index 023d602a..dcec8fb7 100644 --- a/README.md +++ b/README.md @@ -1,207 +1,207 @@ - - - - - - - - - - - -
-
- - Wagtail Logo - - -

Wagtail IndyMeet

- -

- A Wagtail CMS clone of contributing today » -
-
-
- Demo - coming soon - · - Report Bug - · - Request Feature -

-
- - - - -
- Table of Contents -
    -
  1. - About The Project - -
  2. -
  3. - Getting Started - -
  4. -
  5. Usage
  6. -
  7. Roadmap
  8. -
  9. Contributing
  10. -
  11. License
  12. -
  13. Contact
  14. -
  15. Acknowledgments
  16. -
-
- - - - -## About The Project - -We want to run a light weight virtual meetup/video series. - -Here's why: -* Sometimes you want to connect with a community in real time. -* The culture of Twitch first streaming alienates as many audiences as it invites. -* Having a list of events easily shown as well as resources about speakers in the series. - -We thought contributing.today did it well, but it's build on ASP.NET so we're building it in Python! - -

(back to top)

- - - -### Built With - -This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples. - -* [![Wagtail][Wagtail]][wagtail.org] -* [![Bootstrap][Bootstrap.com]][Bootstrap-url] -* [![Django][Djangoproject.com]][Djangoproject.com] - -

(back to top)

- - - - -## Getting Started - - -### Prerequisites - -This is an example of how to list things you need to use the software and how to install them. -* Python version 3.10.5 - -### Installation - -1. Clone the repo - ```sh - git clone https://github.com/dawnwages/wagtail-indymeet.git - ``` -2. create your virtual environment - ```sh - python -m venv venv - ``` - activate in Linux: - ```sh - $ source venv/bin/activate - ``` - activate in Windows: - ```sh - > venv\Scripts\activate - ``` -5. install requirements: - ```sh - $ pip install -r requirements/requirements-dev.txt - ``` -6. Create a posgresql database **if you want to use quick and dirty SQLite db, set your `ENVIRONMENT` variable to `dev` (path not actively supported)** - ```sh - $ psql -u posgres - ``` - ```sh - postgres=# CREATE DATABASE local_djangonaut_space; - CREATE DATABASE - ``` - ```sh - postgres=# exit - ``` - -6. Run migrations and create superuser - ```python - $ python manage.py migrate - ``` - ```python - $ python manage.py createsuperuser - ``` -7. Run locally - ```python - $ python manage.py runserver - ``` - -

(back to top)

- - - - - -## Roadmap - -- [x] Add Changelog -- [x] Add back to top links -- [ ] Add Additional Templates w/ Examples -- [ ] Add "components" document to easily copy & paste sections of the readme -- [ ] Multi-language Support - - [ ] Chinese - - [ ] Spanish - -See the [open issues](https://github.com/dawnwages/wagtail-indymeet/issues) for a full list of proposed features (and known issues). - -

(back to top)

- - - - -## Contributing - -Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. - -If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". -Don't forget to give the project a star! Thanks again! - -1. Fork the Project -2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) -3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) -4. Push to the Branch (`git push origin feature/AmazingFeature`) -5. Open a Pull Request - -

(back to top)

- - - - -## License - -Distributed under the MIT License. See `LICENSE.txt` for more information. - -

(back to top)

- - - - -## Contact - -Dawn Wages - [@dawnwagessays](https://twitter.com/dawnwagessays) - [@fly00gemini8712@mastodon.online](https://mastodon.online/@fly00gemini8712) - - + + + + + + + + + + + +
+
+ + Wagtail Logo + + +

Wagtail IndyMeet

+ +

+ A Wagtail CMS clone of contributing today » +
+
+
+ Demo - coming soon + · + Report Bug + · + Request Feature +

+
+ + + + +
+ Table of Contents +
    +
  1. + About The Project + +
  2. +
  3. + Getting Started + +
  4. +
  5. Usage
  6. +
  7. Roadmap
  8. +
  9. Contributing
  10. +
  11. License
  12. +
  13. Contact
  14. +
  15. Acknowledgments
  16. +
+
+ + + + +## About The Project + +We want to run a light weight virtual meetup/video series. + +Here's why: +* Sometimes you want to connect with a community in real time. +* The culture of Twitch first streaming alienates as many audiences as it invites. +* Having a list of events easily shown as well as resources about speakers in the series. + +We thought contributing.today did it well, but it's build on ASP.NET so we're building it in Python! + +

(back to top)

+ + + +### Built With + +This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples. + +* [![Wagtail][Wagtail]][wagtail.org] +* [![Bootstrap][Bootstrap.com]][Bootstrap-url] +* [![Django][Djangoproject.com]][Djangoproject.com] + +

(back to top)

+ + + + +## Getting Started + + +### Prerequisites + +This is an example of how to list things you need to use the software and how to install them. +* Python version 3.10.5 + +### Installation + +1. Clone the repo + ```sh + git clone https://github.com/dawnwages/wagtail-indymeet.git + ``` +2. create your virtual environment + ```sh + python -m venv venv + ``` + activate in Linux: + ```sh + $ source venv/bin/activate + ``` + activate in Windows: + ```sh + > venv\Scripts\activate + ``` +5. install requirements: + ```sh + $ pip install -r requirements/requirements-dev.txt + ``` +6. Create a posgresql database **if you want to use quick and dirty SQLite db, set your `ENVIRONMENT` variable to `dev` (path not actively supported)** + ```sh + $ psql -u posgres + ``` + ```sh + postgres=# CREATE DATABASE local_djangonaut_space; + CREATE DATABASE + ``` + ```sh + postgres=# exit + ``` + +6. Run migrations and create superuser + ```python + $ python manage.py migrate + ``` + ```python + $ python manage.py createsuperuser + ``` +7. Run locally + ```python + $ python manage.py runserver + ``` + +

(back to top)

+ + + + + +## Roadmap + +- [x] Add Changelog +- [x] Add back to top links +- [ ] Add Additional Templates w/ Examples +- [ ] Add "components" document to easily copy & paste sections of the readme +- [ ] Multi-language Support + - [ ] Chinese + - [ ] Spanish + +See the [open issues](https://github.com/dawnwages/wagtail-indymeet/issues) for a full list of proposed features (and known issues). + +

(back to top)

+ + + + +## Contributing + +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. + +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". +Don't forget to give the project a star! Thanks again! + +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + +

(back to top)

+ + + + +## License + +Distributed under the MIT License. See `LICENSE.txt` for more information. + +

(back to top)

+ + + + +## Contact + +Dawn Wages - [@dawnwagessays](https://twitter.com/dawnwagessays) - [@fly00gemini8712@mastodon.online](https://mastodon.online/@fly00gemini8712) + +

(back to top)

\ No newline at end of file diff --git a/accounts/admin.py b/accounts/admin.py index 9989e2a1..daf114b2 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -1,52 +1,52 @@ -import csv - -from django.contrib import admin -from django.contrib.auth.admin import UserAdmin as BaseUserAdmin -from django.http import HttpResponse - -from accounts.models import Link, CustomUser, UserProfile - - -class ExportCsvMixin: - def export_as_csv(self, request, queryset): - """ - Export all fields in a model via django admin - """ - ignore_fields = ['password', 'token', 'bio_image'] - meta = self.model._meta - field_names = [field.name for field in meta.fields if field.name not in ignore_fields] - response = HttpResponse(content_type='text/csv') - response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta) - writer = csv.writer(response) - - writer.writerow(field_names) - for obj in queryset: - exported = [] - for field in field_names: - if hasattr(obj, field): - val = getattr(obj, field) - else: - val = "" - exported.append(val) - writer.writerow(exported) - return response - - export_as_csv.short_description = "Export Selected" - -class LinksInline(admin.StackedInline): - model = Link - verbose_name_plural = 'links' - -class CustomUserAdmin(ExportCsvMixin, BaseUserAdmin): - - model = CustomUser - actions = ['export_as_csv'] - -admin.site.register(CustomUser, CustomUserAdmin) - -class UserProfileAdmin(ExportCsvMixin, admin.ModelAdmin): - inlines = (LinksInline, ) - model = UserProfile - actions = ['export_as_csv'] - +import csv + +from django.contrib import admin +from django.contrib.auth.admin import UserAdmin as BaseUserAdmin +from django.http import HttpResponse + +from accounts.models import Link, CustomUser, UserProfile + + +class ExportCsvMixin: + def export_as_csv(self, request, queryset): + """ + Export all fields in a model via django admin + """ + ignore_fields = ['password', 'token', 'bio_image'] + meta = self.model._meta + field_names = [field.name for field in meta.fields if field.name not in ignore_fields] + response = HttpResponse(content_type='text/csv') + response['Content-Disposition'] = 'attachment; filename={}.csv'.format(meta) + writer = csv.writer(response) + + writer.writerow(field_names) + for obj in queryset: + exported = [] + for field in field_names: + if hasattr(obj, field): + val = getattr(obj, field) + else: + val = "" + exported.append(val) + writer.writerow(exported) + return response + + export_as_csv.short_description = "Export Selected" + +class LinksInline(admin.StackedInline): + model = Link + verbose_name_plural = 'links' + +class CustomUserAdmin(ExportCsvMixin, BaseUserAdmin): + + model = CustomUser + actions = ['export_as_csv'] + +admin.site.register(CustomUser, CustomUserAdmin) + +class UserProfileAdmin(ExportCsvMixin, admin.ModelAdmin): + inlines = (LinksInline, ) + model = UserProfile + actions = ['export_as_csv'] + admin.site.register(UserProfile, UserProfileAdmin) \ No newline at end of file diff --git a/accounts/apps.py b/accounts/apps.py index 3e3c7659..d69d316c 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -1,6 +1,6 @@ -from django.apps import AppConfig - - -class AccountsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'accounts' +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'accounts' diff --git a/accounts/forms.py b/accounts/forms.py index 2b8e95f9..7b2b2102 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,31 +1,31 @@ -from django import forms -from django.contrib.auth.forms import UserCreationForm, UserChangeForm - -from captcha.fields import ReCaptchaField -from captcha.widgets import ReCaptchaV2Checkbox - -from .models import CustomUser - - -class CustomUserCreationForm(UserCreationForm): - captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox()) - - class Meta: - model = CustomUser - fields = ( - "username", - "email", - "first_name", - "last_name", - ) - -class CustomUserChangeForm(UserChangeForm): - - class Meta: - model = CustomUser - fields = ( - "username", - "email", - "first_name", - "last_name", - ) +from django import forms +from django.contrib.auth.forms import UserCreationForm, UserChangeForm + +from captcha.fields import ReCaptchaField +from captcha.widgets import ReCaptchaV2Checkbox + +from .models import CustomUser + + +class CustomUserCreationForm(UserCreationForm): + captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox()) + + class Meta: + model = CustomUser + fields = ( + "username", + "email", + "first_name", + "last_name", + ) + +class CustomUserChangeForm(UserChangeForm): + + class Meta: + model = CustomUser + fields = ( + "username", + "email", + "first_name", + "last_name", + ) diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py index 049f45f4..8ac0e1bc 100644 --- a/accounts/migrations/0001_initial.py +++ b/accounts/migrations/0001_initial.py @@ -1,48 +1,48 @@ -# Generated by Django 4.1.3 on 2022-12-27 20:41 - -import django.contrib.auth.models -import django.contrib.auth.validators -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), - ] - - operations = [ - migrations.CreateModel( - name='CustomUser', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), - ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), - ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), - ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), - ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), - ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), - ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), - ('member_status', models.CharField(choices=[(0, 'Active'), (1, 'Inactive')], default=0, max_length=50)), - ('member_role', models.CharField(choices=[('Participant', 'Participant'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50)), - ('pronouns', models.CharField(blank=True, max_length=20, null=True)), - ('receiving_newsletter', models.BooleanField(default=False)), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), - ], - options={ - 'verbose_name': 'user', - 'verbose_name_plural': 'users', - 'abstract': False, - }, - managers=[ - ('objects', django.contrib.auth.models.UserManager()), - ], - ), - ] +# Generated by Django 4.1.3 on 2022-12-27 20:41 + +import django.contrib.auth.models +import django.contrib.auth.validators +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('auth', '0012_alter_user_first_name_max_length'), + ] + + operations = [ + migrations.CreateModel( + name='CustomUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')), + ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')), + ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')), + ('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('member_status', models.CharField(choices=[(0, 'Active'), (1, 'Inactive')], default=0, max_length=50)), + ('member_role', models.CharField(choices=[('Participant', 'Participant'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50)), + ('pronouns', models.CharField(blank=True, max_length=20, null=True)), + ('receiving_newsletter', models.BooleanField(default=False)), + ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), + ], + options={ + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + 'abstract': False, + }, + managers=[ + ('objects', django.contrib.auth.models.UserManager()), + ], + ), + ] diff --git a/accounts/migrations/0002_customuser_bio_customuser_bio_image_and_more.py b/accounts/migrations/0002_customuser_bio_customuser_bio_image_and_more.py index c5c9fcdc..2b56cf77 100644 --- a/accounts/migrations/0002_customuser_bio_customuser_bio_image_and_more.py +++ b/accounts/migrations/0002_customuser_bio_customuser_bio_image_and_more.py @@ -1,55 +1,55 @@ -# Generated by Django 4.1.3 on 2022-12-27 22:25 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('accounts', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='customuser', - name='bio', - field=models.TextField(blank=True, null=True, verbose_name='bio'), - ), - migrations.AddField( - model_name='customuser', - name='bio_image', - field=models.ImageField(blank=True, null=True, upload_to=''), - ), - migrations.AlterField( - model_name='customuser', - name='member_status', - field=models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive')], default='active', max_length=50), - ), - migrations.CreateModel( - name='MemberList', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(blank=True, max_length=255, null=True)), - ('description', models.TextField(blank=True, null=True)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('is_active', models.BooleanField(default=True)), - ('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Link', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), - ('name', models.CharField(max_length=255)), - ('url', models.URLField(max_length=255)), - ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='links', to=settings.AUTH_USER_MODEL)), - ], - options={ - 'ordering': ['sort_order'], - 'abstract': False, - }, - ), - ] +# Generated by Django 4.1.3 on 2022-12-27 22:25 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='customuser', + name='bio', + field=models.TextField(blank=True, null=True, verbose_name='bio'), + ), + migrations.AddField( + model_name='customuser', + name='bio_image', + field=models.ImageField(blank=True, null=True, upload_to=''), + ), + migrations.AlterField( + model_name='customuser', + name='member_status', + field=models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive')], default='active', max_length=50), + ), + migrations.CreateModel( + name='MemberList', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(blank=True, max_length=255, null=True)), + ('description', models.TextField(blank=True, null=True)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('is_active', models.BooleanField(default=True)), + ('members', models.ManyToManyField(to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Link', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('name', models.CharField(max_length=255)), + ('url', models.URLField(max_length=255)), + ('member', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='links', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + ] diff --git a/accounts/migrations/0003_remove_customuser_bio_remove_customuser_bio_image_and_more.py b/accounts/migrations/0003_remove_customuser_bio_remove_customuser_bio_image_and_more.py index 3379c904..d3184623 100644 --- a/accounts/migrations/0003_remove_customuser_bio_remove_customuser_bio_image_and_more.py +++ b/accounts/migrations/0003_remove_customuser_bio_remove_customuser_bio_image_and_more.py @@ -1,65 +1,65 @@ -# Generated by Django 4.1.5 on 2023-01-03 23:57 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('accounts', '0002_customuser_bio_customuser_bio_image_and_more'), - ] - - operations = [ - migrations.RemoveField( - model_name='customuser', - name='bio', - ), - migrations.RemoveField( - model_name='customuser', - name='bio_image', - ), - migrations.RemoveField( - model_name='customuser', - name='member_role', - ), - migrations.RemoveField( - model_name='customuser', - name='member_status', - ), - migrations.RemoveField( - model_name='customuser', - name='pronouns', - ), - migrations.RemoveField( - model_name='customuser', - name='receiving_newsletter', - ), - migrations.AlterField( - model_name='memberlist', - name='members', - field=models.ManyToManyField(related_name='member_lists', to=settings.AUTH_USER_MODEL), - ), - migrations.CreateModel( - name='UserProfile', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('member_status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive')], default='active', max_length=50)), - ('member_role', models.CharField(choices=[('Participant', 'Participant'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50)), - ('pronouns', models.CharField(blank=True, max_length=20, null=True)), - ('receiving_newsletter', models.BooleanField(default=False)), - ('bio', models.TextField(blank=True, null=True)), - ('bio_image', models.ImageField(blank=True, null=True, upload_to='')), - ('session_participant', models.BooleanField(default=False)), - ('recruitment_interest', models.BooleanField(default=False)), - ('accepted_coc', models.BooleanField(default=False)), - ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.AlterField( - model_name='link', - name='member', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='links', to='accounts.userprofile'), - ), - ] +# Generated by Django 4.1.5 on 2023-01-03 23:57 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_customuser_bio_customuser_bio_image_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='customuser', + name='bio', + ), + migrations.RemoveField( + model_name='customuser', + name='bio_image', + ), + migrations.RemoveField( + model_name='customuser', + name='member_role', + ), + migrations.RemoveField( + model_name='customuser', + name='member_status', + ), + migrations.RemoveField( + model_name='customuser', + name='pronouns', + ), + migrations.RemoveField( + model_name='customuser', + name='receiving_newsletter', + ), + migrations.AlterField( + model_name='memberlist', + name='members', + field=models.ManyToManyField(related_name='member_lists', to=settings.AUTH_USER_MODEL), + ), + migrations.CreateModel( + name='UserProfile', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('member_status', models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive')], default='active', max_length=50)), + ('member_role', models.CharField(choices=[('Participant', 'Participant'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50)), + ('pronouns', models.CharField(blank=True, max_length=20, null=True)), + ('receiving_newsletter', models.BooleanField(default=False)), + ('bio', models.TextField(blank=True, null=True)), + ('bio_image', models.ImageField(blank=True, null=True, upload_to='')), + ('session_participant', models.BooleanField(default=False)), + ('recruitment_interest', models.BooleanField(default=False)), + ('accepted_coc', models.BooleanField(default=False)), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.AlterField( + model_name='link', + name='member', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='links', to='accounts.userprofile'), + ), + ] diff --git a/accounts/migrations/0004_alter_userprofile_member_role.py b/accounts/migrations/0004_alter_userprofile_member_role.py index 53d362a5..7e1ce57a 100644 --- a/accounts/migrations/0004_alter_userprofile_member_role.py +++ b/accounts/migrations/0004_alter_userprofile_member_role.py @@ -1,18 +1,18 @@ -# Generated by Django 4.1.5 on 2023-01-06 17:26 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('accounts', '0003_remove_customuser_bio_remove_customuser_bio_image_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='userprofile', - name='member_role', - field=models.CharField(choices=[('Participant', 'Participant'), ('Speaker', 'Speaker'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50), - ), - ] +# Generated by Django 4.1.5 on 2023-01-06 17:26 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0003_remove_customuser_bio_remove_customuser_bio_image_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='userprofile', + name='member_role', + field=models.CharField(choices=[('Participant', 'Participant'), ('Speaker', 'Speaker'), ('Mentor', 'Mentor'), ('Expert', 'Expert'), ('Project Owner', 'Project Owner'), ('Volunteer', 'Volunteer'), ('Organizer', 'Organizer')], default='Participant', max_length=50), + ), + ] diff --git a/accounts/models.py b/accounts/models.py index 20d9124b..d63c036c 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,63 +1,63 @@ -from django.db import models -from django.contrib.auth.models import AbstractUser -from django.db import models - -from wagtail.core.models import Orderable - - - -class CustomUser(AbstractUser): - pass - - -class UserProfile(models.Model): - PARTICIPANT = "Participant" - SPEAKER = "Speaker" - MENTOR = "Mentor" - EXPERT = "Expert" - PROJECT_OWNER = "Project Owner" - VOLUNTEER = "Volunteer" - ORGANIZER = "Organizer" - MEMBER_ROLES = ( - (PARTICIPANT, "Participant"), - (SPEAKER, "Speaker"), - (MENTOR, "Mentor"), - (EXPERT, "Expert"), - (PROJECT_OWNER, "Project Owner"), - (VOLUNTEER, "Volunteer"), - (ORGANIZER, "Organizer"), - ) - - ACTIVE = "active" - INACTIVE = "inactive" - - MEMBER_STATUS = ( - (ACTIVE, "Active"), - (INACTIVE, "Inactive"), - ) - user = models.OneToOneField('CustomUser', on_delete=models.CASCADE, related_name="profile") - member_status = models.CharField(choices=MEMBER_STATUS, default=ACTIVE, max_length=50) - member_role = models.CharField(choices=MEMBER_ROLES, default=PARTICIPANT, max_length=50) - pronouns = models.CharField(max_length=20, blank=True, null=True) - receiving_newsletter = models.BooleanField(default=False) - bio = models.TextField(blank=True, null=True) - bio_image = models.ImageField(blank=True, null=True) - session_participant = models.BooleanField(default=False) - recruitment_interest = models.BooleanField(default=False) - accepted_coc = models.BooleanField(default=False) - - def __str__(self): - return self.user.username - - -class Link(Orderable): - member = models.ForeignKey("UserProfile", related_name="links", on_delete=models.CASCADE) - name = models.CharField(max_length=255) - url = models.URLField(max_length=255) - -class MemberList(models.Model): - name = models.CharField(max_length=255, blank=True, null=True) - members = models.ManyToManyField("CustomUser", related_name="member_lists") - description = models.TextField(blank=True, null=True) - created_at = models.DateTimeField(auto_now_add=True) - is_active = models.BooleanField(default=True) +from django.db import models +from django.contrib.auth.models import AbstractUser +from django.db import models + +from wagtail.core.models import Orderable + + + +class CustomUser(AbstractUser): + pass + + +class UserProfile(models.Model): + PARTICIPANT = "Participant" + SPEAKER = "Speaker" + MENTOR = "Mentor" + EXPERT = "Expert" + PROJECT_OWNER = "Project Owner" + VOLUNTEER = "Volunteer" + ORGANIZER = "Organizer" + MEMBER_ROLES = ( + (PARTICIPANT, "Participant"), + (SPEAKER, "Speaker"), + (MENTOR, "Mentor"), + (EXPERT, "Expert"), + (PROJECT_OWNER, "Project Owner"), + (VOLUNTEER, "Volunteer"), + (ORGANIZER, "Organizer"), + ) + + ACTIVE = "active" + INACTIVE = "inactive" + + MEMBER_STATUS = ( + (ACTIVE, "Active"), + (INACTIVE, "Inactive"), + ) + user = models.OneToOneField('CustomUser', on_delete=models.CASCADE, related_name="profile") + member_status = models.CharField(choices=MEMBER_STATUS, default=ACTIVE, max_length=50) + member_role = models.CharField(choices=MEMBER_ROLES, default=PARTICIPANT, max_length=50) + pronouns = models.CharField(max_length=20, blank=True, null=True) + receiving_newsletter = models.BooleanField(default=False) + bio = models.TextField(blank=True, null=True) + bio_image = models.ImageField(blank=True, null=True) + session_participant = models.BooleanField(default=False) + recruitment_interest = models.BooleanField(default=False) + accepted_coc = models.BooleanField(default=False) + + def __str__(self): + return self.user.username + + +class Link(Orderable): + member = models.ForeignKey("UserProfile", related_name="links", on_delete=models.CASCADE) + name = models.CharField(max_length=255) + url = models.URLField(max_length=255) + +class MemberList(models.Model): + name = models.CharField(max_length=255, blank=True, null=True) + members = models.ManyToManyField("CustomUser", related_name="member_lists") + description = models.TextField(blank=True, null=True) + created_at = models.DateTimeField(auto_now_add=True) + is_active = models.BooleanField(default=True) diff --git a/accounts/tests.py b/accounts/tests.py index 7ce503c2..de8bdc00 100644 --- a/accounts/tests.py +++ b/accounts/tests.py @@ -1,3 +1,3 @@ -from django.test import TestCase - -# Create your tests here. +from django.test import TestCase + +# Create your tests here. diff --git a/accounts/urls.py b/accounts/urls.py index 615ae5e6..8d0aae51 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -1,9 +1,9 @@ -from django.urls import include, path - -from .views import SignUpView, profile - -urlpatterns = [ - path("", include('django.contrib.auth.urls')), - path("profile/", profile, name="profile" ), - path("signup/", SignUpView.as_view(), name="signup"), +from django.urls import include, path + +from .views import SignUpView, profile + +urlpatterns = [ + path("", include('django.contrib.auth.urls')), + path("profile/", profile, name="profile" ), + path("signup/", SignUpView.as_view(), name="signup"), ] \ No newline at end of file diff --git a/accounts/views.py b/accounts/views.py index bb3a58cb..d0146225 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,18 +1,18 @@ -# Create your views here. -from django.urls import reverse_lazy -from django.views.generic.edit import CreateView - -from .forms import CustomUserCreationForm -from django.shortcuts import render -from django.contrib.auth.decorators import login_required - - -class SignUpView(CreateView): # pylint: disable=C0115 - form_class = CustomUserCreationForm - success_url = reverse_lazy("login") - template_name = "registration/signup.html" - - -@login_required(login_url='/accounts/login') #redirect when user is not logged in -def profile(request): - return render(request, 'registration/profile.html') +# Create your views here. +from django.urls import reverse_lazy +from django.views.generic.edit import CreateView + +from .forms import CustomUserCreationForm +from django.shortcuts import render +from django.contrib.auth.decorators import login_required + + +class SignUpView(CreateView): # pylint: disable=C0115 + form_class = CustomUserCreationForm + success_url = reverse_lazy("login") + template_name = "registration/signup.html" + + +@login_required(login_url='/accounts/login') #redirect when user is not logged in +def profile(request): + return render(request, 'registration/profile.html') diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..89eeeca2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + app: + image: python:3.11 + platform: linux/amd64 + environment: + - PYTHONDONTWRITEBYTECODE=1 + - PYTHONUNBUFFERED=1 + command: python manage.py runserver 0.0.0.0:8000 + ports: + - 8000:8000 + working_dir: /demo-code + volumes: + - ./demo-code:/demo-code \ No newline at end of file diff --git a/home/admin.py b/home/admin.py index f91c1928..7bd16b45 100644 --- a/home/admin.py +++ b/home/admin.py @@ -1,20 +1,20 @@ -from django.contrib import admin - -from .models import Event, Category, Session - -class EventAdmin(admin.ModelAdmin): - model = Event - filter_horizontal = ('categories', 'speakers', 'rsvped_members', 'organizers') - -class CategoryAdmin(admin.ModelAdmin): - model = Category - - -class SessionAdmin(admin.ModelAdmin): - model = Session - filter_horizontal = ('participants',) - - -admin.site.register(Event, EventAdmin) -admin.site.register(Category, CategoryAdmin) -admin.site.register(Session, SessionAdmin) +from django.contrib import admin + +from .models import Event, Category, Session + +class EventAdmin(admin.ModelAdmin): + model = Event + filter_horizontal = ('categories', 'speakers', 'rsvped_members', 'organizers') + +class CategoryAdmin(admin.ModelAdmin): + model = Category + + +class SessionAdmin(admin.ModelAdmin): + model = Session + filter_horizontal = ('participants',) + + +admin.site.register(Event, EventAdmin) +admin.site.register(Category, CategoryAdmin) +admin.site.register(Session, SessionAdmin) diff --git a/home/forms.py b/home/forms.py index b85e60d3..dcc7cf24 100644 --- a/home/forms.py +++ b/home/forms.py @@ -1,40 +1,40 @@ -from django import forms -from django.db import models -from django.shortcuts import render -from modelcluster.fields import ParentalKey -from wagtail.admin.edit_handlers import ( - FieldPanel, FieldRowPanel, - InlinePanel, MultiFieldPanel, -) -from django.db.models.fields import EmailField, CharField -from wagtail.core.fields import RichTextField -from wagtail.contrib.forms.models import AbstractForm, AbstractFormField -from wagtail.snippets.models import register_snippet - -class TestForm(forms.Form): - test_input = forms.CharField(max_length=255) - - -class SignUpField(AbstractFormField): - page = ParentalKey('SignUpPage', on_delete=models.CASCADE, related_name='form_fields') - -@register_snippet -class SignUpPage(AbstractForm): - template_name = 'forms/sign_up.html' - name = CharField(max_length=255, blank=True) - email = EmailField(max_length=255, blank=True) - thank_you_text = RichTextField(blank=True) - - content_panels = AbstractForm.content_panels + [ - FieldPanel('name'), - InlinePanel('form_fields', label="Form fields"), - FieldPanel('thank_you_text'), - ] - - def get_template(self, request): - return self.template_name - - def get_context_data(self, request): - context = super(SignUpPage, self).get_context(request) - print(context) +from django import forms +from django.db import models +from django.shortcuts import render +from modelcluster.fields import ParentalKey +from wagtail.admin.edit_handlers import ( + FieldPanel, FieldRowPanel, + InlinePanel, MultiFieldPanel, +) +from django.db.models.fields import EmailField, CharField +from wagtail.core.fields import RichTextField +from wagtail.contrib.forms.models import AbstractForm, AbstractFormField +from wagtail.snippets.models import register_snippet + +class TestForm(forms.Form): + test_input = forms.CharField(max_length=255) + + +class SignUpField(AbstractFormField): + page = ParentalKey('SignUpPage', on_delete=models.CASCADE, related_name='form_fields') + +@register_snippet +class SignUpPage(AbstractForm): + template_name = 'forms/sign_up.html' + name = CharField(max_length=255, blank=True) + email = EmailField(max_length=255, blank=True) + thank_you_text = RichTextField(blank=True) + + content_panels = AbstractForm.content_panels + [ + FieldPanel('name'), + InlinePanel('form_fields', label="Form fields"), + FieldPanel('thank_you_text'), + ] + + def get_template(self, request): + return self.template_name + + def get_context_data(self, request): + context = super(SignUpPage, self).get_context(request) + print(context) return context \ No newline at end of file diff --git a/home/migrations/0001_initial.py b/home/migrations/0001_initial.py index 77b74b9f..4e66438e 100644 --- a/home/migrations/0001_initial.py +++ b/home/migrations/0001_initial.py @@ -1,32 +1,32 @@ -# -*- coding: utf-8 -*- -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("wagtailcore", "0040_page_draft_title"), - ] - - operations = [ - migrations.CreateModel( - name="HomePage", - fields=[ - ( - "page_ptr", - models.OneToOneField( - on_delete=models.CASCADE, - parent_link=True, - auto_created=True, - primary_key=True, - serialize=False, - to="wagtailcore.Page", - ), - ), - ], - options={ - "abstract": False, - }, - bases=("wagtailcore.page",), - ), - ] +# -*- coding: utf-8 -*- +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("wagtailcore", "0040_page_draft_title"), + ] + + operations = [ + migrations.CreateModel( + name="HomePage", + fields=[ + ( + "page_ptr", + models.OneToOneField( + on_delete=models.CASCADE, + parent_link=True, + auto_created=True, + primary_key=True, + serialize=False, + to="wagtailcore.Page", + ), + ), + ], + options={ + "abstract": False, + }, + bases=("wagtailcore.page",), + ), + ] diff --git a/home/migrations/0002_create_homepage.py b/home/migrations/0002_create_homepage.py index ca328faa..537a0961 100644 --- a/home/migrations/0002_create_homepage.py +++ b/home/migrations/0002_create_homepage.py @@ -1,62 +1,62 @@ -# -*- coding: utf-8 -*- -from django.db import migrations - - -def create_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model("contenttypes.ContentType") - Page = apps.get_model("wagtailcore.Page") - Site = apps.get_model("wagtailcore.Site") - HomePage = apps.get_model("home.HomePage") - - # Delete the default homepage - # If migration is run multiple times, it may have already been deleted - Page.objects.filter(id=2).delete() - - # Create content type for homepage model - homepage_content_type, __ = ContentType.objects.get_or_create( - model="homepage", app_label="home" - ) - - # Create a new homepage - homepage = HomePage.objects.create( - title="Home", - draft_title="Home", - slug="home", - content_type=homepage_content_type, - path="00010001", - depth=2, - numchild=0, - url_path="/home/", - ) - - # Create a site with the new homepage set as the root - Site.objects.create(hostname="localhost", root_page=homepage, is_default_site=True) - - -def remove_homepage(apps, schema_editor): - # Get models - ContentType = apps.get_model("contenttypes.ContentType") - HomePage = apps.get_model("home.HomePage") - - # Delete the default homepage - # Page and Site objects CASCADE - HomePage.objects.filter(slug="home", depth=2).delete() - - # Delete content type for homepage model - ContentType.objects.filter(model="homepage", app_label="home").delete() - - -class Migration(migrations.Migration): - - run_before = [ - ("wagtailcore", "0053_locale_model"), - ] - - dependencies = [ - ("home", "0001_initial"), - ] - - operations = [ - migrations.RunPython(create_homepage, remove_homepage), - ] +# -*- coding: utf-8 -*- +from django.db import migrations + + +def create_homepage(apps, schema_editor): + # Get models + ContentType = apps.get_model("contenttypes.ContentType") + Page = apps.get_model("wagtailcore.Page") + Site = apps.get_model("wagtailcore.Site") + HomePage = apps.get_model("home.HomePage") + + # Delete the default homepage + # If migration is run multiple times, it may have already been deleted + Page.objects.filter(id=2).delete() + + # Create content type for homepage model + homepage_content_type, __ = ContentType.objects.get_or_create( + model="homepage", app_label="home" + ) + + # Create a new homepage + homepage = HomePage.objects.create( + title="Home", + draft_title="Home", + slug="home", + content_type=homepage_content_type, + path="00010001", + depth=2, + numchild=0, + url_path="/home/", + ) + + # Create a site with the new homepage set as the root + Site.objects.create(hostname="localhost", root_page=homepage, is_default_site=True) + + +def remove_homepage(apps, schema_editor): + # Get models + ContentType = apps.get_model("contenttypes.ContentType") + HomePage = apps.get_model("home.HomePage") + + # Delete the default homepage + # Page and Site objects CASCADE + HomePage.objects.filter(slug="home", depth=2).delete() + + # Delete content type for homepage model + ContentType.objects.filter(model="homepage", app_label="home").delete() + + +class Migration(migrations.Migration): + + run_before = [ + ("wagtailcore", "0053_locale_model"), + ] + + dependencies = [ + ("home", "0001_initial"), + ] + + operations = [ + migrations.RunPython(create_homepage, remove_homepage), + ] diff --git a/home/migrations/0003_signuppage_signupfield.py b/home/migrations/0003_signuppage_signupfield.py index 80127da6..93e64896 100644 --- a/home/migrations/0003_signuppage_signupfield.py +++ b/home/migrations/0003_signuppage_signupfield.py @@ -1,50 +1,50 @@ -# Generated by Django 4.1.3 on 2022-12-27 22:23 - -from django.db import migrations, models -import django.db.models.deletion -import modelcluster.fields -import wagtail.contrib.forms.models -import wagtail.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('wagtailcore', '0078_referenceindex'), - ('home', '0002_create_homepage'), - ] - - operations = [ - migrations.CreateModel( - name='SignUpPage', - fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), - ('name', models.CharField(blank=True, max_length=255)), - ('email', models.EmailField(blank=True, max_length=255)), - ('thank_you_text', wagtail.fields.RichTextField(blank=True)), - ], - options={ - 'abstract': False, - }, - bases=(wagtail.contrib.forms.models.FormMixin, 'wagtailcore.page'), - ), - migrations.CreateModel( - name='SignUpField', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), - ('clean_name', models.CharField(blank=True, default='', help_text='Safe name of the form field, the label converted to ascii_snake_case', max_length=255, verbose_name='name')), - ('label', models.CharField(help_text='The label of the form field', max_length=255, verbose_name='label')), - ('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('multiselect', 'Multiple select'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time'), ('hidden', 'Hidden field')], max_length=16, verbose_name='field type')), - ('required', models.BooleanField(default=True, verbose_name='required')), - ('choices', models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices')), - ('default_value', models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value')), - ('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')), - ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='form_fields', to='home.signuppage')), - ], - options={ - 'ordering': ['sort_order'], - 'abstract': False, - }, - ), - ] +# Generated by Django 4.1.3 on 2022-12-27 22:23 + +from django.db import migrations, models +import django.db.models.deletion +import modelcluster.fields +import wagtail.contrib.forms.models +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0078_referenceindex'), + ('home', '0002_create_homepage'), + ] + + operations = [ + migrations.CreateModel( + name='SignUpPage', + fields=[ + ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), + ('name', models.CharField(blank=True, max_length=255)), + ('email', models.EmailField(blank=True, max_length=255)), + ('thank_you_text', wagtail.fields.RichTextField(blank=True)), + ], + options={ + 'abstract': False, + }, + bases=(wagtail.contrib.forms.models.FormMixin, 'wagtailcore.page'), + ), + migrations.CreateModel( + name='SignUpField', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('clean_name', models.CharField(blank=True, default='', help_text='Safe name of the form field, the label converted to ascii_snake_case', max_length=255, verbose_name='name')), + ('label', models.CharField(help_text='The label of the form field', max_length=255, verbose_name='label')), + ('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('multiselect', 'Multiple select'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time'), ('hidden', 'Hidden field')], max_length=16, verbose_name='field type')), + ('required', models.BooleanField(default=True, verbose_name='required')), + ('choices', models.TextField(blank=True, help_text='Comma or new line separated list of choices. Only applicable in checkboxes, radio and dropdown.', verbose_name='choices')), + ('default_value', models.TextField(blank=True, help_text='Default value. Comma or new line separated values supported for checkboxes.', verbose_name='default value')), + ('help_text', models.CharField(blank=True, max_length=255, verbose_name='help text')), + ('page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='form_fields', to='home.signuppage')), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + ] diff --git a/home/migrations/0004_speaker_speakerlink.py b/home/migrations/0004_speaker_speakerlink.py index 0011310e..12818d66 100644 --- a/home/migrations/0004_speaker_speakerlink.py +++ b/home/migrations/0004_speaker_speakerlink.py @@ -1,41 +1,41 @@ -# Generated by Django 4.1.3 on 2022-12-27 23:41 - -from django.db import migrations, models -import django.db.models.deletion -import modelcluster.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('home', '0003_signuppage_signupfield'), - ] - - operations = [ - migrations.CreateModel( - name='Speaker', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('bio', models.TextField(blank=True, null=True, verbose_name='bio')), - ('image', models.ImageField(blank=True, null=True, upload_to='')), - ('name', models.CharField(max_length=255)), - ], - options={ - 'abstract': False, - }, - ), - migrations.CreateModel( - name='SpeakerLink', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), - ('name', models.CharField(max_length=255)), - ('url', models.URLField(max_length=255)), - ('speaker', modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='speaker_links', to='home.speaker')), - ], - options={ - 'ordering': ['sort_order'], - 'abstract': False, - }, - ), - ] +# Generated by Django 4.1.3 on 2022-12-27 23:41 + +from django.db import migrations, models +import django.db.models.deletion +import modelcluster.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0003_signuppage_signupfield'), + ] + + operations = [ + migrations.CreateModel( + name='Speaker', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('bio', models.TextField(blank=True, null=True, verbose_name='bio')), + ('image', models.ImageField(blank=True, null=True, upload_to='')), + ('name', models.CharField(max_length=255)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='SpeakerLink', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('sort_order', models.IntegerField(blank=True, editable=False, null=True)), + ('name', models.CharField(max_length=255)), + ('url', models.URLField(max_length=255)), + ('speaker', modelcluster.fields.ParentalKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='speaker_links', to='home.speaker')), + ], + options={ + 'ordering': ['sort_order'], + 'abstract': False, + }, + ), + ] diff --git a/home/migrations/0005_remove_speakerlink_speaker_delete_speaker_and_more.py b/home/migrations/0005_remove_speakerlink_speaker_delete_speaker_and_more.py index 4cc73028..c2f52d59 100644 --- a/home/migrations/0005_remove_speakerlink_speaker_delete_speaker_and_more.py +++ b/home/migrations/0005_remove_speakerlink_speaker_delete_speaker_and_more.py @@ -1,23 +1,23 @@ -# Generated by Django 4.1.5 on 2023-01-06 17:26 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('home', '0004_speaker_speakerlink'), - ] - - operations = [ - migrations.RemoveField( - model_name='speakerlink', - name='speaker', - ), - migrations.DeleteModel( - name='Speaker', - ), - migrations.DeleteModel( - name='SpeakerLink', - ), - ] +# Generated by Django 4.1.5 on 2023-01-06 17:26 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0004_speaker_speakerlink'), + ] + + operations = [ + migrations.RemoveField( + model_name='speakerlink', + name='speaker', + ), + migrations.DeleteModel( + name='Speaker', + ), + migrations.DeleteModel( + name='SpeakerLink', + ), + ] diff --git a/home/migrations/0006_category_session_event.py b/home/migrations/0006_category_session_event.py index b34df41f..db9ed7da 100644 --- a/home/migrations/0006_category_session_event.py +++ b/home/migrations/0006_category_session_event.py @@ -1,57 +1,57 @@ -# Generated by Django 4.1.5 on 2023-01-06 19:24 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('home', '0005_remove_speakerlink_speaker_delete_speaker_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='Category', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=25)), - ], - ), - migrations.CreateModel( - name='Session', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('start_date', models.DateField()), - ('end_date', models.DateField()), - ('title', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('participants', models.ManyToManyField(blank=True, null=True, related_name='sessions', to=settings.AUTH_USER_MODEL)), - ], - ), - migrations.CreateModel( - name='Event', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=255)), - ('cover_image', models.ImageField(blank=True, null=True, upload_to='')), - ('start_time', models.DateTimeField()), - ('end_time', models.DateTimeField()), - ('location', models.CharField(max_length=255)), - ('description', models.TextField(blank=True, null=True)), - ('status', models.CharField(choices=[('Pending', 'Pending'), ('Scheduled', 'Scheduled'), ('Canceled', 'Canceled'), ('Rescheduled', 'Rescheduled')], default='Pending', max_length=50)), - ('created_at', models.DateTimeField(auto_now_add=True)), - ('capacity', models.IntegerField(blank=True, null=True)), - ('categories', models.ManyToManyField(blank=True, null=True, related_name='events', to='home.category')), - ('organizers', models.ManyToManyField(blank=True, null=True, to=settings.AUTH_USER_MODEL)), - ('rsvped_members', models.ManyToManyField(blank=True, null=True, related_name='rsvp_events', to=settings.AUTH_USER_MODEL)), - ('session', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='home.session')), - ('speakers', models.ManyToManyField(blank=True, null=True, related_name='speaker_events', to=settings.AUTH_USER_MODEL)), - ], - options={ - 'ordering': ('start_time',), - }, - ), - ] +# Generated by Django 4.1.5 on 2023-01-06 19:24 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('home', '0005_remove_speakerlink_speaker_delete_speaker_and_more'), + ] + + operations = [ + migrations.CreateModel( + name='Category', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=25)), + ], + ), + migrations.CreateModel( + name='Session', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('start_date', models.DateField()), + ('end_date', models.DateField()), + ('title', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('participants', models.ManyToManyField(blank=True, null=True, related_name='sessions', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Event', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255)), + ('cover_image', models.ImageField(blank=True, null=True, upload_to='')), + ('start_time', models.DateTimeField()), + ('end_time', models.DateTimeField()), + ('location', models.CharField(max_length=255)), + ('description', models.TextField(blank=True, null=True)), + ('status', models.CharField(choices=[('Pending', 'Pending'), ('Scheduled', 'Scheduled'), ('Canceled', 'Canceled'), ('Rescheduled', 'Rescheduled')], default='Pending', max_length=50)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('capacity', models.IntegerField(blank=True, null=True)), + ('categories', models.ManyToManyField(blank=True, null=True, related_name='events', to='home.category')), + ('organizers', models.ManyToManyField(blank=True, null=True, to=settings.AUTH_USER_MODEL)), + ('rsvped_members', models.ManyToManyField(blank=True, null=True, related_name='rsvp_events', to=settings.AUTH_USER_MODEL)), + ('session', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='home.session')), + ('speakers', models.ManyToManyField(blank=True, null=True, related_name='speaker_events', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ('start_time',), + }, + ), + ] diff --git a/home/models.py b/home/models.py index 4002aa41..e8ae7c16 100644 --- a/home/models.py +++ b/home/models.py @@ -1,85 +1,85 @@ -from django.utils import timezone -from django.db import models - -from modelcluster.fields import ParentalKey -from modelcluster.models import ClusterableModel - -from wagtail.models import Page -from wagtail.snippets.edit_handlers import SnippetChooserPanel -from wagtail.admin.edit_handlers import FieldPanel, InlinePanel -from wagtail.core.models import Orderable -from wagtail.snippets.models import register_snippet - -from home.forms import SignUpPage -from accounts.models import Link - -def sign_up_forms(context): - return{ - 'sign_up_forms': SignUpPage.objects.all(), - 'request': context['request'], - } - -class HomePage(Page): - content_panels = Page.content_panels + [ - - ] - - -class Category(models.Model): - name = models.CharField(max_length=25) - - def __str__(self): - return self.name - -class Event(models.Model): - PENDING = 'Pending' - SCHEDULED = 'Scheduled' - CANCELED = 'Canceled' - RESCHEDULED = 'Rescheduled' - - EVENT_STATUS = ( - (PENDING, 'Pending'), - (SCHEDULED, 'Scheduled'), - (CANCELED, 'Canceled'), - (RESCHEDULED, 'Rescheduled') - ) - title = models.CharField(max_length=255) - - cover_image = models.ImageField(blank=True, null=True) - start_time = models.DateTimeField() - end_time = models.DateTimeField() - location = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - status = models.CharField(max_length=50, choices=EVENT_STATUS, default=PENDING) - categories = models.ManyToManyField('Category', related_name="events", blank=True, null=True) - speakers = models.ManyToManyField('accounts.CustomUser', related_name="speaker_events", blank=True, null=True) - - created_at = models.DateTimeField(auto_now_add=True) - capacity = models.IntegerField(blank=True, null=True) - rsvped_members = models.ManyToManyField('accounts.CustomUser', related_name='rsvp_events', blank=True, null=True) - organizers = models.ManyToManyField('accounts.CustomUser', blank=True, null=True) - session = models.ForeignKey('Session', blank=True, null=True, related_name="events", on_delete=models.SET_NULL) - - def __str__(self): - return self.title - - class Meta: - ordering = ('start_time',) - - @property - def is_future(self): - return self.start_time.date() >= timezone.now().date() - - @property - def accepting_rsvps(self): - return self.is_future and self.status == self.SCHEDULED - -class Session(models.Model): - start_date = models.DateField() - end_date = models.DateField() - title = models.CharField(max_length=255) - description = models.TextField(blank=True, null=True) - participants = models.ManyToManyField('accounts.CustomUser', related_name='sessions', blank=True, null=True) - - def __str__(self): - return self.title +from django.utils import timezone +from django.db import models + +from modelcluster.fields import ParentalKey +from modelcluster.models import ClusterableModel + +from wagtail.models import Page +from wagtail.snippets.edit_handlers import SnippetChooserPanel +from wagtail.admin.edit_handlers import FieldPanel, InlinePanel +from wagtail.core.models import Orderable +from wagtail.snippets.models import register_snippet + +from home.forms import SignUpPage +from accounts.models import Link + +def sign_up_forms(context): + return{ + 'sign_up_forms': SignUpPage.objects.all(), + 'request': context['request'], + } + +class HomePage(Page): + content_panels = Page.content_panels + [ + + ] + + +class Category(models.Model): + name = models.CharField(max_length=25) + + def __str__(self): + return self.name + +class Event(models.Model): + PENDING = 'Pending' + SCHEDULED = 'Scheduled' + CANCELED = 'Canceled' + RESCHEDULED = 'Rescheduled' + + EVENT_STATUS = ( + (PENDING, 'Pending'), + (SCHEDULED, 'Scheduled'), + (CANCELED, 'Canceled'), + (RESCHEDULED, 'Rescheduled') + ) + title = models.CharField(max_length=255) + + cover_image = models.ImageField(blank=True, null=True) + start_time = models.DateTimeField() + end_time = models.DateTimeField() + location = models.CharField(max_length=255) + description = models.TextField(blank=True, null=True) + status = models.CharField(max_length=50, choices=EVENT_STATUS, default=PENDING) + categories = models.ManyToManyField('Category', related_name="events", blank=True, null=True) + speakers = models.ManyToManyField('accounts.CustomUser', related_name="speaker_events", blank=True, null=True) + + created_at = models.DateTimeField(auto_now_add=True) + capacity = models.IntegerField(blank=True, null=True) + rsvped_members = models.ManyToManyField('accounts.CustomUser', related_name='rsvp_events', blank=True, null=True) + organizers = models.ManyToManyField('accounts.CustomUser', blank=True, null=True) + session = models.ForeignKey('Session', blank=True, null=True, related_name="events", on_delete=models.SET_NULL) + + def __str__(self): + return self.title + + class Meta: + ordering = ('start_time',) + + @property + def is_future(self): + return self.start_time.date() >= timezone.now().date() + + @property + def accepting_rsvps(self): + return self.is_future and self.status == self.SCHEDULED + +class Session(models.Model): + start_date = models.DateField() + end_date = models.DateField() + title = models.CharField(max_length=255) + description = models.TextField(blank=True, null=True) + participants = models.ManyToManyField('accounts.CustomUser', related_name='sessions', blank=True, null=True) + + def __str__(self): + return self.title diff --git a/home/static/css/events.css b/home/static/css/events.css index a76f0b65..a14df33f 100644 --- a/home/static/css/events.css +++ b/home/static/css/events.css @@ -1,20 +1,20 @@ -/* --------------------------------------------------------------------- - EVENTS - HOME PAGE -----------------------------------------------------------------------*/ -.event-team-member-icon { - height: 2.5rem; - width: 2.5rem; - object-fit: cover; - border-radius: 50%; - margin-bottom: 1.5rem; -} - -.event-team-member { - vertical-align: middle; -} - -.event-card-img { - object-fit: cover; - width: auto; - height: 150px; +/* --------------------------------------------------------------------- + EVENTS - HOME PAGE +----------------------------------------------------------------------*/ +.event-team-member-icon { + height: 2.5rem; + width: 2.5rem; + object-fit: cover; + border-radius: 50%; + margin-bottom: 1.5rem; +} + +.event-team-member { + vertical-align: middle; +} + +.event-card-img { + object-fit: cover; + width: auto; + height: 150px; } \ No newline at end of file diff --git a/home/static/css/welcome_page.css b/home/static/css/welcome_page.css index 733dcd99..d65ef3ad 100644 --- a/home/static/css/welcome_page.css +++ b/home/static/css/welcome_page.css @@ -1,200 +1,200 @@ -html { - box-sizing: border-box; -} - -*, -*:before, -*:after { - box-sizing: inherit; -} - -body { - max-width: 100vw; - min-height: 100vh; - margin: 0 auto; - padding: 0 15px; - color: #231f20; - font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif; - line-height: 1.25; -} - -a { - background-color: transparent; - color: #308282; - text-decoration: underline; -} - -a:hover { - color: #ea1b10; -} - -h1, -h2, -h3, -h4, -h5, -p, -ul { - padding: 0; - margin: 0; - font-weight: 400; -} - -svg:not(:root) { - overflow: hidden; -} - -.header { - display: flex; - justify-content: space-between; - align-items: center; - padding-top: 20px; - padding-bottom: 10px; - border-bottom: 1px solid #e6e6e6; -} - -.logo { - width: 150px; - margin-inline-end: 20px; -} - -.logo a { - display: block; -} - -.figure-logo { - max-width: 150px; - max-height: 55.1px; -} - -.release-notes { - font-size: 14px; -} - -.main { - padding: 40px 0; - margin: 0 auto; - } - -.main-center { - text-align: center; -} - -.figure-space { - max-width: 265px; -} - -@keyframes pos { - 0%, 100% { - transform: rotate(-6deg); - } - 50% { - transform: rotate(6deg); - } -} - -.egg { - fill: #43b1b0; - animation: pos 3s ease infinite; - transform: translateY(50px); - transform-origin: 50% 80%; -} - -.main-text { - max-width: 400px; - margin: 5px auto; -} - -.main-text h1 { - font-size: 22px; -} - -.main-text p { - margin: 15px auto 0; -} - -.footer { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - border-top: 1px solid #e6e6e6; - padding: 10px; -} - -.option { - display: block; - padding: 10px 10px 10px 34px; - position: relative; - text-decoration: none; -} - -.option svg { - width: 24px; - height: 24px; - fill: gray; - border: 1px solid #d9d9d9; - padding: 5px; - border-radius: 100%; - top: 10px; - inset-inline-start: 0; - position: absolute; -} - -.option h2 { - font-size: 19px; - text-decoration: underline; -} - -.option p { - padding-top: 3px; - color: #231f20; - font-size: 15px; - font-weight: 300; -} -/* --------------------------------------------------------------------- - EVENTS - HOME PAGE -----------------------------------------------------------------------*/ -.event-team-member-icon { - height: 2.5rem; - width: 2.5rem; - object-fit: cover; - border-radius: 50%; - margin-bottom: 1.5rem; -} - -/* --------------------------------------------------------------------- - MEDIA QUERIES -----------------------------------------------------------------------*/ -@media (max-width: 996px) { - body { - max-width: 780px; - } -} - -@media (max-width: 767px) { - .option { - flex: 0 0 50%; - } -} - -@media (max-width: 599px) { - .main { - padding: 20px 0; - } - - .figure-space { - max-width: 200px; - } - - .footer { - display: block; - width: 300px; - margin: 0 auto; - } -} - -@media (max-width: 360px) { - .header-link { - max-width: 100px; - } -} +html { + box-sizing: border-box; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +body { + max-width: 100vw; + min-height: 100vh; + margin: 0 auto; + padding: 0 15px; + color: #231f20; + font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif; + line-height: 1.25; +} + +a { + background-color: transparent; + color: #308282; + text-decoration: underline; +} + +a:hover { + color: #ea1b10; +} + +h1, +h2, +h3, +h4, +h5, +p, +ul { + padding: 0; + margin: 0; + font-weight: 400; +} + +svg:not(:root) { + overflow: hidden; +} + +.header { + display: flex; + justify-content: space-between; + align-items: center; + padding-top: 20px; + padding-bottom: 10px; + border-bottom: 1px solid #e6e6e6; +} + +.logo { + width: 150px; + margin-inline-end: 20px; +} + +.logo a { + display: block; +} + +.figure-logo { + max-width: 150px; + max-height: 55.1px; +} + +.release-notes { + font-size: 14px; +} + +.main { + padding: 40px 0; + margin: 0 auto; + } + +.main-center { + text-align: center; +} + +.figure-space { + max-width: 265px; +} + +@keyframes pos { + 0%, 100% { + transform: rotate(-6deg); + } + 50% { + transform: rotate(6deg); + } +} + +.egg { + fill: #43b1b0; + animation: pos 3s ease infinite; + transform: translateY(50px); + transform-origin: 50% 80%; +} + +.main-text { + max-width: 400px; + margin: 5px auto; +} + +.main-text h1 { + font-size: 22px; +} + +.main-text p { + margin: 15px auto 0; +} + +.footer { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + border-top: 1px solid #e6e6e6; + padding: 10px; +} + +.option { + display: block; + padding: 10px 10px 10px 34px; + position: relative; + text-decoration: none; +} + +.option svg { + width: 24px; + height: 24px; + fill: gray; + border: 1px solid #d9d9d9; + padding: 5px; + border-radius: 100%; + top: 10px; + inset-inline-start: 0; + position: absolute; +} + +.option h2 { + font-size: 19px; + text-decoration: underline; +} + +.option p { + padding-top: 3px; + color: #231f20; + font-size: 15px; + font-weight: 300; +} +/* --------------------------------------------------------------------- + EVENTS - HOME PAGE +----------------------------------------------------------------------*/ +.event-team-member-icon { + height: 2.5rem; + width: 2.5rem; + object-fit: cover; + border-radius: 50%; + margin-bottom: 1.5rem; +} + +/* --------------------------------------------------------------------- + MEDIA QUERIES +----------------------------------------------------------------------*/ +@media (max-width: 996px) { + body { + max-width: 780px; + } +} + +@media (max-width: 767px) { + .option { + flex: 0 0 50%; + } +} + +@media (max-width: 599px) { + .main { + padding: 20px 0; + } + + .figure-space { + max-width: 200px; + } + + .footer { + display: block; + width: 300px; + margin: 0 auto; + } +} + +@media (max-width: 360px) { + .header-link { + max-width: 100px; + } +} diff --git a/home/templates/forms/sign_up.html b/home/templates/forms/sign_up.html index 185e7a5a..1b5ae6d9 100644 --- a/home/templates/forms/sign_up.html +++ b/home/templates/forms/sign_up.html @@ -1,27 +1,27 @@ -{% extends "base.html" %} -{% load i18n wagtailcore_tags static %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{# Load CSS and JavaScript #} -{% bootstrap_css %} -{% bootstrap_javascript %} - -{% block content %} -
-{% if user.is_authenticated and user.is_active or request.is_preview %} -
Thanks for signing up!
-{% else %} - {% if form %} -
- {% csrf_token %} - {% bootstrap_form form %} - - {% bootstrap_form_errors form layout='inline' %} -
- {% else %} -
You can fill in the from only one time.
- {% endif %} -{% endif %} -
+{% extends "base.html" %} +{% load i18n wagtailcore_tags static %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{# Load CSS and JavaScript #} +{% bootstrap_css %} +{% bootstrap_javascript %} + +{% block content %} +
+{% if user.is_authenticated and user.is_active or request.is_preview %} +
Thanks for signing up!
+{% else %} + {% if form %} +
+ {% csrf_token %} + {% bootstrap_form form %} + + {% bootstrap_form_errors form layout='inline' %} +
+ {% else %} +
You can fill in the from only one time.
+ {% endif %} +{% endif %} +
{% endblock %} \ No newline at end of file diff --git a/home/templates/home/calendar.html b/home/templates/home/calendar.html index ffae1e9f..346bcd7d 100644 --- a/home/templates/home/calendar.html +++ b/home/templates/home/calendar.html @@ -1,46 +1,46 @@ -{% extends "base.html" %} -{% load i18n wagtailcore_tags static %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{# Load CSS and JavaScript #} -{% bootstrap_css %} -{% bootstrap_javascript %} - -{% block content %} - - - -
-
- - +{% extends "base.html" %} +{% load i18n wagtailcore_tags static %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{# Load CSS and JavaScript #} +{% bootstrap_css %} +{% bootstrap_javascript %} + +{% block content %} + + + +
+
+ + {% endblock %} \ No newline at end of file diff --git a/home/templates/home/event_detail.html b/home/templates/home/event_detail.html index 3bf897be..79eb1034 100644 --- a/home/templates/home/event_detail.html +++ b/home/templates/home/event_detail.html @@ -1,84 +1,84 @@ -{% extends "base.html" %} -{% load i18n wagtailcore_tags static %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{# Load CSS and JavaScript #} -{% bootstrap_css %} -{% bootstrap_javascript %} - -{% block content %} -
- - - -
-
- Back to Calendar -
-
-

{{ event.title }}

-
- {% if event.accepting_rsvps %} - {% if user.is_authenticated %} - {% if user.profile.accepted_coc %} - {% if user not in event.rsvped_members.all %} - RSVP - {% else %} - Cancel RSVP -

You have already RSVPed

- - {% endif %} - {% else %} - RSVP -

Before RSVPing please accept the CoC on your Account Page

- {% endif %} - {% else %} - Register -

You need to register to RSVP for this event

- {% endif %} - {% endif %} -
-
-
-
-

Start: {{ event.start_time|date:"Y-m-d H:i" }}

-

End: {{ event.end_time|date:"Y-m-d H:i" }}

-

Location: {{ event.location }}

-

Status: {{ event.status }}

-

Categories:{% for cat in event.categories.all %} {{ cat }} {% endfor %}

-
- -

{{ event.description }}

-
-

Speakers:

- - {% for speaker in event.speakers.all %} - -
-

{{ speaker.get_full_name }}

-
- {% if speaker.profile and speaker.profile.bio_image %} - - {% endif %} -
-
-

{{ speaker.profile.bio }}

-
- {% if speaker.profile.links.exists %} -

Contacts:

- {% for link in speaker.profile.links.all %} - {{ link.name }} - {% endfor %} - {% endif %} -
-
- -
- {% endfor %} - - -
-
-
-{% endblock content %} +{% extends "base.html" %} +{% load i18n wagtailcore_tags static %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{# Load CSS and JavaScript #} +{% bootstrap_css %} +{% bootstrap_javascript %} + +{% block content %} +
+ + + +
+
+ Back to Calendar +
+
+

{{ event.title }}

+
+ {% if event.accepting_rsvps %} + {% if user.is_authenticated %} + {% if user.profile.accepted_coc %} + {% if user not in event.rsvped_members.all %} + RSVP + {% else %} + Cancel RSVP +

You have already RSVPed

+ + {% endif %} + {% else %} + RSVP +

Before RSVPing please accept the CoC on your Account Page

+ {% endif %} + {% else %} + Register +

You need to register to RSVP for this event

+ {% endif %} + {% endif %} +
+
+
+
+

Start: {{ event.start_time|date:"Y-m-d H:i" }}

+

End: {{ event.end_time|date:"Y-m-d H:i" }}

+

Location: {{ event.location }}

+

Status: {{ event.status }}

+

Categories:{% for cat in event.categories.all %} {{ cat }} {% endfor %}

+
+ +

{{ event.description }}

+
+

Speakers:

+ + {% for speaker in event.speakers.all %} + +
+

{{ speaker.get_full_name }}

+
+ {% if speaker.profile and speaker.profile.bio_image %} + + {% endif %} +
+
+

{{ speaker.profile.bio }}

+
+ {% if speaker.profile.links.exists %} +

Contacts:

+ {% for link in speaker.profile.links.all %} + {{ link.name }} + {% endfor %} + {% endif %} +
+
+ +
+ {% endfor %} + + +
+
+
+{% endblock content %} diff --git a/home/templates/home/home_page.html b/home/templates/home/home_page.html index b6242e7c..4c825ac4 100644 --- a/home/templates/home/home_page.html +++ b/home/templates/home/home_page.html @@ -1,29 +1,29 @@ -{% extends "base.html" %} -{% load i18n wagtailcore_tags static %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{# Load CSS and JavaScript #} -{% bootstrap_css %} -{% bootstrap_javascript %} - -{% block content %} -
- - - -
-{% include 'home/includes/welcome_page.html' %} -{% include 'home/includes/events_upcoming.html' %} -{% with content_text="Long text about Djangonaut space and what we're doing here, how we came to be" %} - {% include 'home/includes/homepage_blade.html' with title="Djangonaut Space" content=content_text color="#cccccc"%} -{% endwith %} -{% include 'home/includes/events_past.html' %} -{% with content_text="We do three session per year. This is completely free and sponsored by Django Software Foundation. You're welcome to join any session at any time but you get the full benefit of the program by starting the session with your peers." %} - {% include 'home/includes/homepage_blade.html' with title="How it works" content=content_text color="#cccccc"%} -{% endwith %} - -{% with content_text=" Sign Up Today" %} - {% include 'home/includes/homepage_blade.html' with title="What are you waiting for?" content=content_text color="#FFF"%} -{% endwith %} -{% endblock content %} +{% extends "base.html" %} +{% load i18n wagtailcore_tags static %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{# Load CSS and JavaScript #} +{% bootstrap_css %} +{% bootstrap_javascript %} + +{% block content %} +
+ + + +
+{% include 'home/includes/welcome_page.html' %} +{% include 'home/includes/events_upcoming.html' %} +{% with content_text="Long text about Djangonaut space and what we're doing here, how we came to be" %} + {% include 'home/includes/homepage_blade.html' with title="Djangonaut Space" content=content_text color="#cccccc"%} +{% endwith %} +{% include 'home/includes/events_past.html' %} +{% with content_text="We do three session per year. This is completely free and sponsored by Django Software Foundation. You're welcome to join any session at any time but you get the full benefit of the program by starting the session with your peers." %} + {% include 'home/includes/homepage_blade.html' with title="How it works" content=content_text color="#cccccc"%} +{% endwith %} + +{% with content_text=" Sign Up Today" %} + {% include 'home/includes/homepage_blade.html' with title="What are you waiting for?" content=content_text color="#FFF"%} +{% endwith %} +{% endblock content %} diff --git a/home/templates/home/includes/event_card.html b/home/templates/home/includes/event_card.html index fd7cc114..34554e57 100644 --- a/home/templates/home/includes/event_card.html +++ b/home/templates/home/includes/event_card.html @@ -1,29 +1,29 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block content %} -
-
-
-
Card title
- Event Date -
- {# TODO: Add default image when no event image is selected #} - person with brown skin and facial hair and locs wearing black tshirt sitting at table smiling at screen of mac with a white mug next to them - {# Photo by Good Faces on Unsplash #} - {# https://unsplash.com/backgrounds/apps/zoom?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText #} -
- {% include 'home/includes/event_categories.html' %} -

Some quick example text to build on the card title and make up the bulk of the card's content.

- {% include 'home/includes/event_team.html' %} -
- -
-
+{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block content %} +
+
+
+
Card title
+ Event Date +
+ {# TODO: Add default image when no event image is selected #} + person with brown skin and facial hair and locs wearing black tshirt sitting at table smiling at screen of mac with a white mug next to them + {# Photo by Good Faces on Unsplash #} + {# https://unsplash.com/backgrounds/apps/zoom?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText #} +
+ {% include 'home/includes/event_categories.html' %} +

Some quick example text to build on the card title and make up the bulk of the card's content.

+ {% include 'home/includes/event_team.html' %} +
+ +
+
{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/includes/event_categories.html b/home/templates/home/includes/event_categories.html index 4c9d3fd2..263c8942 100644 --- a/home/templates/home/includes/event_categories.html +++ b/home/templates/home/includes/event_categories.html @@ -1,16 +1,16 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block content %} -
-
- {# for cat in categories #} - New - Intro - RSVP required - DSF - PSF -
-
+{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block content %} +
+
+ {# for cat in categories #} + New + Intro + RSVP required + DSF + PSF +
+
{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/includes/event_team.html b/home/templates/home/includes/event_team.html index e8f9606a..6968d094 100644 --- a/home/templates/home/includes/event_team.html +++ b/home/templates/home/includes/event_team.html @@ -1,12 +1,12 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block content %} -
- {# for member in event_team #} - {% include 'home/includes/event_team_member.html' %} - {% include 'home/includes/event_team_member.html' %} - {% include 'home/includes/event_team_member.html' %} -
+{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block content %} +
+ {# for member in event_team #} + {% include 'home/includes/event_team_member.html' %} + {% include 'home/includes/event_team_member.html' %} + {% include 'home/includes/event_team_member.html' %} +
{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/includes/event_team_member.html b/home/templates/home/includes/event_team_member.html index 1cd45a2e..1eb85073 100644 --- a/home/templates/home/includes/event_team_member.html +++ b/home/templates/home/includes/event_team_member.html @@ -1,19 +1,19 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - - -{% block content %} -
-
- - {# Photo by Kaylyn Mok on Unsplash #} - {# https://unsplash.com/photos/K798U9eYDFU?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText #} - {# circle image of event person #} -
-
- {# name and pronouns of event person #} - FirstName LastName (pro/nouns) -
-
+{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + + +{% block content %} +
+
+ + {# Photo by Kaylyn Mok on Unsplash #} + {# https://unsplash.com/photos/K798U9eYDFU?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText #} + {# circle image of event person #} +
+
+ {# name and pronouns of event person #} + FirstName LastName (pro/nouns) +
+
{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/includes/events_past.html b/home/templates/home/includes/events_past.html index 747ff44c..3927e4c4 100644 --- a/home/templates/home/includes/events_past.html +++ b/home/templates/home/includes/events_past.html @@ -1,28 +1,28 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block extra_css %} - -{% endblock extra_css %} - -{% block content %} -
- -
-

# Past Events

-
- {# for event in events_list where "past" limit 6? #} - {% include 'home/includes/event_card.html' %} - {% include 'home/includes/event_card.html' %} - {% include 'home/includes/event_card.html' %} - {% include 'home/includes/event_card.html' %} - {# if more events then, else # nothing #} - -
- -
-
-{% endblock content %} +{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block extra_css %} + +{% endblock extra_css %} + +{% block content %} +
+ +
+

# Past Events

+
+ {# for event in events_list where "past" limit 6? #} + {% include 'home/includes/event_card.html' %} + {% include 'home/includes/event_card.html' %} + {% include 'home/includes/event_card.html' %} + {% include 'home/includes/event_card.html' %} + {# if more events then, else # nothing #} + +
+ +
+
+{% endblock content %} diff --git a/home/templates/home/includes/events_upcoming.html b/home/templates/home/includes/events_upcoming.html index 0b5e8ec4..95273dc3 100644 --- a/home/templates/home/includes/events_upcoming.html +++ b/home/templates/home/includes/events_upcoming.html @@ -1,28 +1,28 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block extra_css %} - -{% endblock extra_css %} - -{% block content %} -
- -
-

# Upcoming Events

-
- {# for event in events_list where "upcoming" limit 6? #} - {% include 'home/includes/event_card.html' with cat="upcoming" %} - {% include 'home/includes/event_card.html' with cat="upcoming" %} - {% include 'home/includes/event_card.html' with cat="upcoming" %} - {% include 'home/includes/event_card.html' with cat="upcoming" %} - {# if more events then, else # nothing #} - -
- -
-
-{% endblock content %} +{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block extra_css %} + +{% endblock extra_css %} + +{% block content %} +
+ +
+

# Upcoming Events

+
+ {# for event in events_list where "upcoming" limit 6? #} + {% include 'home/includes/event_card.html' with cat="upcoming" %} + {% include 'home/includes/event_card.html' with cat="upcoming" %} + {% include 'home/includes/event_card.html' with cat="upcoming" %} + {% include 'home/includes/event_card.html' with cat="upcoming" %} + {# if more events then, else # nothing #} + +
+ +
+
+{% endblock content %} diff --git a/home/templates/home/includes/homepage_blade.html b/home/templates/home/includes/homepage_blade.html index be0c26b4..856f3c75 100644 --- a/home/templates/home/includes/homepage_blade.html +++ b/home/templates/home/includes/homepage_blade.html @@ -1,18 +1,18 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{% block extra_css %} - -{% endblock extra_css %} - -{% block content %} -
-
-

{{ title }}

-

- {{ content }} -

-
-
+{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{% block extra_css %} + +{% endblock extra_css %} + +{% block content %} +
+
+

{{ title }}

+

+ {{ content }} +

+
+
{% endblock content %} \ No newline at end of file diff --git a/home/templates/home/includes/welcome_page.html b/home/templates/home/includes/welcome_page.html index d4e277c4..3c261da8 100644 --- a/home/templates/home/includes/welcome_page.html +++ b/home/templates/home/includes/welcome_page.html @@ -1,13 +1,13 @@ -{% load static i18n wagtailcore_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - - -{% block content %} -
- {% if not user.is_authenticated %} - {% bootstrap_button button_type="link" href='/accounts/signup' content="sign up" button_class="btn-primary" %} - {% endif %} -
-{% endblock content %} - +{% load static i18n wagtailcore_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + + +{% block content %} +
+ {% if not user.is_authenticated %} + {% bootstrap_button button_type="link" href='/accounts/signup' content="sign up" button_class="btn-primary" %} + {% endif %} +
+{% endblock content %} + diff --git a/home/urls.py b/home/urls.py index cec076a6..669af0e4 100644 --- a/home/urls.py +++ b/home/urls.py @@ -1,8 +1,8 @@ -from django.urls import path - -from .views import event_calendar, EventDetailView - -urlpatterns = [ - path('calendar/', event_calendar, name="calendar"), - path('events//', EventDetailView.as_view(), name="event_detail"), +from django.urls import path + +from .views import event_calendar, EventDetailView + +urlpatterns = [ + path('calendar/', event_calendar, name="calendar"), + path('events//', EventDetailView.as_view(), name="event_detail"), ] \ No newline at end of file diff --git a/home/views.py b/home/views.py index 5523f90e..9a06ee86 100644 --- a/home/views.py +++ b/home/views.py @@ -1,30 +1,30 @@ -from django.contrib import messages -from django.contrib.auth.decorators import login_required -from django.shortcuts import render, redirect -from django.views.generic.detail import DetailView - -from .models import Event - - -def event_calendar(request): - all_events = Event.objects.exclude(status=Event.PENDING) - - context = { - "events":all_events, - - } - return render(request,'home/calendar.html',context) - - -class EventDetailView(DetailView): - model = Event - - def get_context_data(self, **kwargs): - if self.request.GET.get('rsvp', None): - if self.request.GET.get('rsvp') == 'true'\ - and self.request.user.profile and \ - self.request.user.profile.accepted_coc: - self.object.rsvped_members.add(self.request.user) - elif self.request.GET.get('rsvp') == 'false': - self.object.rsvped_members.remove(self.request.user) - return super().get_context_data(**kwargs) +from django.contrib import messages +from django.contrib.auth.decorators import login_required +from django.shortcuts import render, redirect +from django.views.generic.detail import DetailView + +from .models import Event + + +def event_calendar(request): + all_events = Event.objects.exclude(status=Event.PENDING) + + context = { + "events":all_events, + + } + return render(request,'home/calendar.html',context) + + +class EventDetailView(DetailView): + model = Event + + def get_context_data(self, **kwargs): + if self.request.GET.get('rsvp', None): + if self.request.GET.get('rsvp') == 'true'\ + and self.request.user.profile and \ + self.request.user.profile.accepted_coc: + self.object.rsvped_members.add(self.request.user) + elif self.request.GET.get('rsvp') == 'false': + self.object.rsvped_members.remove(self.request.user) + return super().get_context_data(**kwargs) diff --git a/indymeet/settings/base.py b/indymeet/settings/base.py index 1b50714a..168c549b 100644 --- a/indymeet/settings/base.py +++ b/indymeet/settings/base.py @@ -1,191 +1,191 @@ -""" -Django settings for indymeet project. - -Generated by 'django-admin startproject' using Django 4.1.3. - -For more information on this file, see -https://docs.djangoproject.com/en/4.1/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/4.1/ref/settings/ -""" - -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) -import os - -PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -BASE_DIR = os.path.dirname(PROJECT_DIR) - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ - -from puput import PUPUT_APPS - -# Application definition -INSTALLED_APPS = [ - "accounts", - "home", - "search", - - "django_bootstrap5", - "captcha", - - "wagtail.contrib.forms", - "wagtail.contrib.redirects", - "wagtail.embeds", - "wagtail.sites", - "wagtail.users", - "wagtail.snippets", - "wagtail.documents", - "wagtail.images", - "wagtail.search", - "wagtail.admin", - "wagtail", - - # puput support - 'wagtail.contrib.sitemaps', - 'wagtail.contrib.routable_page', - 'django_social_share', - 'puput', - - "modelcluster", - "taggit", - "django.contrib.admin", - "django.contrib.auth", - "django.contrib.contenttypes", - "django.contrib.sessions", - "django.contrib.messages", - "django.contrib.staticfiles", - -] - -MIDDLEWARE = [ - "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", - "django.middleware.security.SecurityMiddleware", - "whitenoise.middleware.WhiteNoiseMiddleware", - "wagtail.contrib.redirects.middleware.RedirectMiddleware", - -] - -ROOT_URLCONF = "indymeet.urls" - -TEMPLATES = [ - { - "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [ - os.path.join(PROJECT_DIR, "templates"), - ], - "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", - ], - }, - }, -] - -WSGI_APPLICATION = "indymeet.wsgi.application" - - -# Database -# https://docs.djangoproject.com/en/4.1/ref/settings/#databases - -# Dummy local test database -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'local_djangonaut_space', # Or path to database file if using sqlite3. - 'USER': 'postgres', # Not used with sqlite3. - 'PASSWORD': 4, # Not used with sqlite3. - 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': 5432, # Set to empty string for default. Not used with sqlite3. - }, -} - - -# Password validation -# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", - }, - { - "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", - }, - { - "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", - }, - { - "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/4.1/topics/i18n/ - -LANGUAGE_CODE = "en-us" - -TIME_ZONE = "UTC" - -USE_I18N = True - -USE_L10N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.1/howto/static-files/ - -STATICFILES_FINDERS = [ - "django.contrib.staticfiles.finders.FileSystemFinder", - "django.contrib.staticfiles.finders.AppDirectoriesFinder", -] - -STATICFILES_DIRS = [ - os.path.join(PROJECT_DIR, "static"), -] - -# ManifestStaticFilesStorage is recommended in production, to prevent outdated -# JavaScript / CSS assets being served from cache (e.g. after a Wagtail upgrade). -# See https://docs.djangoproject.com/en/4.1/ref/contrib/staticfiles/#manifeststaticfilesstorage -STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" - -STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") -STATIC_URL = "/static/" - -MEDIA_ROOT = os.path.join(BASE_DIR, "media") -MEDIA_URL = "/media/" - - -# Wagtail settings - -WAGTAIL_SITE_NAME = "indymeet" - -# Search -# https://docs.wagtail.org/en/stable/topics/search/backends.html -WAGTAILSEARCH_BACKENDS = { - "default": { - "BACKEND": "wagtail.search.backends.database", - } -} - -# Base URL to use when referring to full URLs within the Wagtail admin backend - -# e.g. in notification emails. Don't include '/admin' or a trailing slash -WAGTAILADMIN_BASE_URL = "http://example.com" - -AUTH_USER_MODEL = 'accounts.CustomUser' - -LOGIN_REDIRECT_URL = "/" -LOGOUT_REDIRECT_URL = "/" +""" +Django settings for indymeet project. + +Generated by 'django-admin startproject' using Django 4.1.3. + +For more information on this file, see +https://docs.djangoproject.com/en/4.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/4.1/ref/settings/ +""" + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import os + +PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +BASE_DIR = os.path.dirname(PROJECT_DIR) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ + +from puput import PUPUT_APPS + +# Application definition +INSTALLED_APPS = [ + "accounts", + "home", + "search", + + "django_bootstrap5", + "captcha", + + "wagtail.contrib.forms", + "wagtail.contrib.redirects", + "wagtail.embeds", + "wagtail.sites", + "wagtail.users", + "wagtail.snippets", + "wagtail.documents", + "wagtail.images", + "wagtail.search", + "wagtail.admin", + "wagtail", + + # puput support + 'wagtail.contrib.sitemaps', + 'wagtail.contrib.routable_page', + 'django_social_share', + 'puput', + + "modelcluster", + "taggit", + "django.contrib.admin", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.messages", + "django.contrib.staticfiles", + +] + +MIDDLEWARE = [ + "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", + "django.middleware.security.SecurityMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", + "wagtail.contrib.redirects.middleware.RedirectMiddleware", + +] + +ROOT_URLCONF = "indymeet.urls" + +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [ + os.path.join(PROJECT_DIR, "templates"), + ], + "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", + ], + }, + }, +] + +WSGI_APPLICATION = "indymeet.wsgi.application" + + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +# Dummy local test database +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'local_djangonaut_space', # Or path to database file if using sqlite3. + 'USER': 'postgres', # Not used with sqlite3. + 'PASSWORD': 4, # Not used with sqlite3. + 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': 5432, # Set to empty string for default. Not used with sqlite3. + }, +} + + +# Password validation +# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", + }, + { + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/4.1/topics/i18n/ + +LANGUAGE_CODE = "en-us" + +TIME_ZONE = "UTC" + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/4.1/howto/static-files/ + +STATICFILES_FINDERS = [ + "django.contrib.staticfiles.finders.FileSystemFinder", + "django.contrib.staticfiles.finders.AppDirectoriesFinder", +] + +STATICFILES_DIRS = [ + os.path.join(PROJECT_DIR, "static"), +] + +# ManifestStaticFilesStorage is recommended in production, to prevent outdated +# JavaScript / CSS assets being served from cache (e.g. after a Wagtail upgrade). +# See https://docs.djangoproject.com/en/4.1/ref/contrib/staticfiles/#manifeststaticfilesstorage +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" + +STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles") +STATIC_URL = "/static/" + +MEDIA_ROOT = os.path.join(BASE_DIR, "media") +MEDIA_URL = "/media/" + + +# Wagtail settings + +WAGTAIL_SITE_NAME = "indymeet" + +# Search +# https://docs.wagtail.org/en/stable/topics/search/backends.html +WAGTAILSEARCH_BACKENDS = { + "default": { + "BACKEND": "wagtail.search.backends.database", + } +} + +# Base URL to use when referring to full URLs within the Wagtail admin backend - +# e.g. in notification emails. Don't include '/admin' or a trailing slash +WAGTAILADMIN_BASE_URL = "http://example.com" + +AUTH_USER_MODEL = 'accounts.CustomUser' + +LOGIN_REDIRECT_URL = "/" +LOGOUT_REDIRECT_URL = "/" diff --git a/indymeet/settings/dev.py b/indymeet/settings/dev.py index 8c2039cf..cdf599b3 100644 --- a/indymeet/settings/dev.py +++ b/indymeet/settings/dev.py @@ -1,46 +1,46 @@ -# ---------------------------------------------- -# For developing locally -# ---------------------------------------------- -from .base import * -from dotenv import load_dotenv - -load_dotenv() - -### SQLite (deprecated) -if os.getenv('ENVIRONMENT') == 'dev': - DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": os.path.join(BASE_DIR, "db.sqlite3"), - } - } - -print('----------------------------------') -print('----------------------------------') -print('DEV') -print('----------------------------------') -print('----------------------------------') - - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-b$)hky-=v&f&48g-dtnehezmj$w4%e+in*oe*!r=kh4n4+k0sg" - -# SECURITY WARNING: define the correct hosts in production! -ALLOWED_HOSTS = ["*"] - -EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" - - -try: - from .local import * -except ImportError: - pass - - -RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' -RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' - -SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error'] +# ---------------------------------------------- +# For developing locally +# ---------------------------------------------- +from .base import * +from dotenv import load_dotenv + +load_dotenv() + +### SQLite (deprecated) +if os.getenv('ENVIRONMENT') == 'dev': + DATABASES = { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": os.path.join(BASE_DIR, "db.sqlite3"), + } + } + +print('----------------------------------') +print('----------------------------------') +print('DEV') +print('----------------------------------') +print('----------------------------------') + + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = "django-insecure-b$)hky-=v&f&48g-dtnehezmj$w4%e+in*oe*!r=kh4n4+k0sg" + +# SECURITY WARNING: define the correct hosts in production! +ALLOWED_HOSTS = ["*"] + +EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" + + +try: + from .local import * +except ImportError: + pass + + +RECAPTCHA_PUBLIC_KEY = '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI' +RECAPTCHA_PRIVATE_KEY = '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe' + +SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error'] diff --git a/indymeet/settings/production.py b/indymeet/settings/production.py index 5a96a217..c77b41cf 100644 --- a/indymeet/settings/production.py +++ b/indymeet/settings/production.py @@ -1,43 +1,43 @@ -from .base import * - -DEBUG = os.getenv('DEBUG') - -# Deploy instructions -# https://tonybaloney.github.io/posts/django-on-azure-beyond-hello-world.html -# A staging environment running the P1V2 App Service Plan (or above) -# A production environment running one or more P2V2 (or above) App Service Plans - -# Database -# https://docs.djangoproject.com/en/4.1/ref/settings/#databases - -if os.getenv('ENVIRONMENT') == 'production': - print('----------------------------------') - print('----------------------------------') - print('PRODUCTION') - print('----------------------------------') - print('----------------------------------') - SECRET_KEY = os.environ['SECRET_KEY'] - ALLOWED_HOSTS = ['localhost', 'https://djangonaut-space.azurewebsites.net', 'djangonaut-space.azurewebsites.net', 'https://djangonaut.space', 'djangonaut.space'] - - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'djangonaut-space', # Or path to database file if using sqlite3. - 'USER': os.environ['USER'], # Not used with sqlite3. - 'PASSWORD': os.environ['PASSWORD'], # Not used with sqlite3. - 'HOST': os.environ['HOST'], # Set to empty string for localhost. Not used with sqlite3. - 'PORT': 5432, # Set to empty string for default. Not used with sqlite3. - 'OPTIONS': { - 'sslmode': 'require' - }, - }, - } - -try: - from .local import * -except ImportError: - pass - - -RECAPTCHA_PUBLIC_KEY = os.getenv('RECAPTCHA_PUBLIC_KEY') +from .base import * + +DEBUG = os.getenv('DEBUG') + +# Deploy instructions +# https://tonybaloney.github.io/posts/django-on-azure-beyond-hello-world.html +# A staging environment running the P1V2 App Service Plan (or above) +# A production environment running one or more P2V2 (or above) App Service Plans + +# Database +# https://docs.djangoproject.com/en/4.1/ref/settings/#databases + +if os.getenv('ENVIRONMENT') == 'production': + print('----------------------------------') + print('----------------------------------') + print('PRODUCTION') + print('----------------------------------') + print('----------------------------------') + SECRET_KEY = os.environ['SECRET_KEY'] + ALLOWED_HOSTS = ['localhost', 'https://djangonaut-space.azurewebsites.net', 'djangonaut-space.azurewebsites.net', 'https://djangonaut.space', 'djangonaut.space'] + + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': 'djangonaut-space', # Or path to database file if using sqlite3. + 'USER': os.environ['USER'], # Not used with sqlite3. + 'PASSWORD': os.environ['PASSWORD'], # Not used with sqlite3. + 'HOST': os.environ['HOST'], # Set to empty string for localhost. Not used with sqlite3. + 'PORT': 5432, # Set to empty string for default. Not used with sqlite3. + 'OPTIONS': { + 'sslmode': 'require' + }, + }, + } + +try: + from .local import * +except ImportError: + pass + + +RECAPTCHA_PUBLIC_KEY = os.getenv('RECAPTCHA_PUBLIC_KEY') RECAPTCHA_PRIVATE_KEY = os.getenv('RECAPTCHA_PRIVATE_KEY') \ No newline at end of file diff --git a/indymeet/static/css/indymeet.css b/indymeet/static/css/indymeet.css index d8fb3f31..90aae0ab 100644 --- a/indymeet/static/css/indymeet.css +++ b/indymeet/static/css/indymeet.css @@ -1,19 +1,19 @@ -/* --------------------------------------------------------------------- - NAVIGATION -----------------------------------------------------------------------*/ -.nav-icon { - height: 2.5rem; - width: 2.5rem; - object-fit: cover; - border-radius: 50%; - margin-bottom: 1.5rem; -} - -.img-responsive>img { - width:100%; - margin-top: 15px; -} - -article.row { - margin-left: 0; +/* --------------------------------------------------------------------- + NAVIGATION +----------------------------------------------------------------------*/ +.nav-icon { + height: 2.5rem; + width: 2.5rem; + object-fit: cover; + border-radius: 50%; + margin-bottom: 1.5rem; +} + +.img-responsive>img { + width:100%; + margin-top: 15px; +} + +article.row { + margin-left: 0; } \ No newline at end of file diff --git a/indymeet/static/css/registration.css b/indymeet/static/css/registration.css index bd9bc695..27263380 100644 --- a/indymeet/static/css/registration.css +++ b/indymeet/static/css/registration.css @@ -1,27 +1,27 @@ -/* --------------------------------------------------------------------- - REGISTRATION - LOGIN LOG OUT -----------------------------------------------------------------------*/ -.registration-form { - width: 20rem; - margin: auto; -} - -.registration-logo { - width: 100%; -} - -.profile-img { - width: 100%; -} - -table { - border:1px solid black; - padding: 10px; - } -th, td{ - border:1px solid black; - padding: .5rem; -} -td:first-child { - width: 20%; -} +/* --------------------------------------------------------------------- + REGISTRATION - LOGIN LOG OUT +----------------------------------------------------------------------*/ +.registration-form { + width: 20rem; + margin: auto; +} + +.registration-logo { + width: 100%; +} + +.profile-img { + width: 100%; +} + +table { + border:1px solid black; + padding: 10px; + } +th, td{ + border:1px solid black; + padding: .5rem; +} +td:first-child { + width: 20%; +} diff --git a/indymeet/templates/404.html b/indymeet/templates/404.html index f19ab953..9b739bb5 100644 --- a/indymeet/templates/404.html +++ b/indymeet/templates/404.html @@ -1,11 +1,11 @@ -{% extends "base.html" %} - -{% block title %}Page not found{% endblock %} - -{% block body_class %}template-404{% endblock %} - -{% block content %} -

Page not found

- -

Sorry, this page could not be found.

-{% endblock %} +{% extends "base.html" %} + +{% block title %}Page not found{% endblock %} + +{% block body_class %}template-404{% endblock %} + +{% block content %} +

Page not found

+ +

Sorry, this page could not be found.

+{% endblock %} diff --git a/indymeet/templates/500.html b/indymeet/templates/500.html index 77379e55..5be460ef 100644 --- a/indymeet/templates/500.html +++ b/indymeet/templates/500.html @@ -1,13 +1,13 @@ - - - - - Internal server error - - - -

Internal server error

- -

Sorry, there seems to be an error. Please try again soon.

- - + + + + + Internal server error + + + +

Internal server error

+ +

Sorry, there seems to be an error. Please try again soon.

+ + diff --git a/indymeet/templates/base.html b/indymeet/templates/base.html index 72ca1cf7..210aeffd 100644 --- a/indymeet/templates/base.html +++ b/indymeet/templates/base.html @@ -1,80 +1,80 @@ -{% load i18n static wagtailcore_tags wagtailuserbar wagtailimages_tags %} -{# Load the tag library #} -{% load django_bootstrap5 %} - -{# Load CSS and JavaScript #} -{% bootstrap_css %} -{% bootstrap_javascript %} - - - - - - {% block title %} - {% if blog_page %} - {{ blog_page.title }}{% if blog_page.description %} | {{ blog_page.description }}{% endif %} - {% else %} - {% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %} - {% endif %} - {% endblock %} - {% block title_suffix %} - {% wagtail_site as current_site %} - {% if current_site and current_site.site_name %}- {{ current_site.site_name }}{% endif %} - {% endblock %} - - - - - {# Force all links in the live preview panel to be opened in a new tab #} - {% if request.in_preview_panel %} - - {% endif %} - - {# Global stylesheets #} - {% block extra_css %} - - - - {% endblock extra_css %} - {% block css %} - - - {% endblock %} - - - - - {% block social_share %}{% endblock social_share %} - - - - - - {% include 'includes/nav.html' %} - {% if 'Home' not in page.title %} - {% include 'includes/breadcrumbs.html' %} - {% endif %} - - {% wagtailuserbar %} - {% block content %} - {# other page stuff goes here #} - {% endblock %} - {# Global javascript #} - - {% include 'includes/footer.html' %} - +{% load i18n static wagtailcore_tags wagtailuserbar wagtailimages_tags %} +{# Load the tag library #} +{% load django_bootstrap5 %} + +{# Load CSS and JavaScript #} +{% bootstrap_css %} +{% bootstrap_javascript %} + + + + + + {% block title %} + {% if blog_page %} + {{ blog_page.title }}{% if blog_page.description %} | {{ blog_page.description }}{% endif %} + {% else %} + {% if page.seo_title %}{{ page.seo_title }}{% else %}{{ page.title }}{% endif %} + {% endif %} + {% endblock %} + {% block title_suffix %} + {% wagtail_site as current_site %} + {% if current_site and current_site.site_name %}- {{ current_site.site_name }}{% endif %} + {% endblock %} + + + + + {# Force all links in the live preview panel to be opened in a new tab #} + {% if request.in_preview_panel %} + + {% endif %} + + {# Global stylesheets #} + {% block extra_css %} + + + + {% endblock extra_css %} + {% block css %} + + + {% endblock %} + + + + + {% block social_share %}{% endblock social_share %} + + + + + + {% include 'includes/nav.html' %} + {% if 'Home' not in page.title %} + {% include 'includes/breadcrumbs.html' %} + {% endif %} + + {% wagtailuserbar %} + {% block content %} + {# other page stuff goes here #} + {% endblock %} + {# Global javascript #} + + {% include 'includes/footer.html' %} + \ No newline at end of file diff --git a/indymeet/templates/includes/breadcrumbs.html b/indymeet/templates/includes/breadcrumbs.html index c01ef711..31eec3a8 100644 --- a/indymeet/templates/includes/breadcrumbs.html +++ b/indymeet/templates/includes/breadcrumbs.html @@ -1,8 +1,8 @@ -