Commit Graph

232 Commits

Author SHA1 Message Date
Arnav Choudhury
352232f617 Fixed Formatting Issues. 2021-02-05 09:55:30 +05:30
Arnav Choudhury
47768d495f Refactored test_views to test only the required characteristics of the UserCreationForm. 2021-02-05 09:47:06 +05:30
areski
002b3eaf41 Update Django 3.0.11 to 3.1.6 2021-02-04 16:52:45 +01:00
Arnav Choudhury
3cf7e74a77 Removed unused Http404 import. 2021-02-04 15:54:26 +05:30
Arnav Choudhury
fc8e2ea8a2 Removed unnecessary test for username case sensitivity since django usernames are case sensitive by default. Also made the redirecting to the login url more dynamic by fetching the defined login_url from settings 2021-02-04 15:28:08 +05:30
Arnav Choudhury
08334ba979 Fixed the Middleware deprecation warnings by creating a dummy response function. 2021-02-02 13:19:27 +05:30
Arnav Choudhury
e8996ef281 Updated the test_clean_username test to also test for the custom validation message raised in case username already exists in the db 2021-01-30 11:41:16 +05:30
Arnav Choudhury
0a241a8f75 Updated test_forms.py to not check whether UserCreationForm has a clean_username() method 2021-01-29 22:16:11 +05:30
Arnav Choudhury
e0cf956fe2 Refactored users.forms to make the code more readeable 2021-01-29 17:55:10 +05:30
Bruno Alla
d62ad403a4
Merge pull request #3018 from Andrew-Chen-Wang/patch-6 2021-01-26 18:51:00 +00:00
Arnav Choudhury
125f1a8afe Fixing Formatting issues 2021-01-26 10:34:18 +05:30
Arnav Choudhury
d358fc948d Using SuccessMessageMixin to pass the message to django template instead of overriding form_valid 2021-01-26 09:56:24 +05:30
Bruno Alla
d12d01d325 Fix mypy error 2021-01-25 22:13:19 +00:00
Bruno Alla
37e0d6ae04 Add test for the UserAdmin 2021-01-25 21:55:14 +00:00
Bruno Alla
d1409e2fb3 Missing import 2021-01-25 21:08:33 +00:00
Andrew Chen Wang
cbb3cdb2b1
Update admin to ignore *_name User attributes
Fixes #3016
2021-01-25 11:20:34 -05:00
Bruno Alla
6a4a9ba6ee Merge branch 'master' into defer-js 2021-01-24 15:42:12 +00:00
Bruno Alla
42f33527c5 Refactor test 2021-01-24 15:17:01 +00:00
Bruno Alla
e293d8c00e
Merge pull request #2949 from thorrak/add_test 2021-01-24 15:08:22 +00:00
Bruno Alla
aee2559d4f
Merge pull request #2998 from Andrew-Chen-Wang/patch-6 2021-01-24 14:26:23 +00:00
Bruno Alla
23c7616bd4
Merge pull request #2986 from pydanny/pyup-update-factory-boy-3.1.0-to-3.2.0 2021-01-24 14:25:16 +00:00
Bruno Alla
b7c95f6eed Update factory-boy's .generate to evaluate
Co-Authored-By: Timo Halbesma <timo@halbesma.com>
2021-01-24 14:20:39 +00:00
Andrew Chen Wang
3cbd840a96
Use self.request.user instead of second query 2021-01-21 19:02:01 -05:00
Andrew Chen Wang
5809eabb31
Ignore typing override in name removals 2021-01-07 22:39:18 -05:00
Andrew Chen Wang
2f416f9057
Remove first_name and last_name from migrations 2021-01-07 22:30:27 -05:00
Andrew Chen Wang
dce3144b39
Omit first_name and last_name in User model 2021-01-07 22:27:50 -05:00
Andrew Chen Wang
ac0af4c178
Use exception var in 404.html if available 2021-01-01 22:44:02 -05:00
Andrew Chen Wang
3a1e94f41c
Use exception var in 403.html if available 2021-01-01 22:40:30 -05:00
Thorrak
ed69df4403 Change test to iterate through messages instead of accessing _queued_messages directly 2020-11-26 11:23:46 -05:00
Thorrak
894dbce645 Add test for users.form_valid
Ensures that the message is added to the request when a form is submitted
2020-11-26 10:17:20 -05:00
Thorrak
d2ec1eca12 Fix typo in message 2020-11-26 10:15:04 -05:00
Andrew Chen Wang
1fa5d79813
Add "defer" for inline Javascript
* Also utilize ECMAScript 6, 2015 syntax
2020-11-14 10:27:14 -05:00
umgelurgel
9f3117c615 Upgrade factory-boy to 3.1.0 2020-11-12 18:53:29 +01:00
Andrew-Chen-Wang
607c9676f5 Use defer for script tags (Fix #2922)
* This way, scripts from external URLs are loaded asynchronously. By putting it at the top of the file, the browser parses it first, downloads it while continuing to parse the HTML, and then executes on parsing finish
* Additionally, developers will not need to use $(window).ready() or the like in their files anymore.
* Added inline_javascript tag in case anyone wants to use the bottom of the HTML page to execute some Javascript. Using defer here has no effect as inline scripts defer by default

Signed-off-by: Andrew-Chen-Wang <acwangpython@gmail.com>
2020-11-04 11:54:21 -05:00
Bruno Alla
26f2a3d7ba Fix mypy error
my_awesome_project/users/admin.py:15: error: No overload variant of "__add__" of "tuple" matches argument type "List[Tuple[Optional[str], _FieldOpts]]"
my_awesome_project/users/admin.py:15: note: Possible overload variants:
my_awesome_project/users/admin.py:15: note:     def __add__(self, Tuple[Tuple[str, Dict[str, Tuple[str]]], ...]) -> Tuple[Tuple[str, Dict[str, Tuple[str]]], ...]
my_awesome_project/users/admin.py:15: note:     def __add__(self, Tuple[Any, ...]) -> Tuple[Any, ...]
my_awesome_project/users/admin.py:15: note: Right operand is of type "Union[Tuple[Tuple[Optional[str], _FieldOpts], ...], List[Tuple[Optional[str], _FieldOpts]]]"
2020-10-01 20:01:26 +01:00
Bruno Alla
689c768abf Fix mypy error
users/tests/test_views.py:67: error: unused 'type: ignore' comment
2020-10-01 19:16:22 +01:00
Bruno Alla
a2c4453cf5 Fix isort errors 2020-09-16 09:39:02 +01:00
Daniel Feldroy
ec3922cfe6
Give admin_forms the forms namespace
This will make extending various signup and registration forms easier.
2020-09-14 11:36:47 -07:00
Bruno Alla
e21869c1d4 Fix black formatting issues 2020-08-27 09:41:28 +02:00
Bruno Alla
0ebd35dd83 Update deprecated imports 2020-08-14 12:19:42 +01:00
Bruno Alla
e2910a3222
Merge pull request #2694 from Andrew-Chen-Wang/patch-7 2020-07-24 17:40:23 +01:00
Bruno Alla
6903daeddd
Merge pull request #2648 from Andrew-Chen-Wang/patch-3 2020-07-24 17:11:19 +01:00
Andrew Chen Wang
c57b8976b0
Update {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/utils/context_processors.py
Co-authored-by: Bruno Alla <browniebroke@users.noreply.github.com>
2020-07-24 11:29:11 -04:00
Andrew Chen Wang
689e22f5b0
Be explicit in context processor 2020-07-23 22:47:20 -04:00
Andrew Chen Wang
fee9402e44
Use raw Jinja2 for cookiecutter template context
Co-authored-by: Bruno Alla <browniebroke@users.noreply.github.com>
2020-07-21 00:02:14 -04:00
Bruno Alla
19c151ba55
Merge pull request #2555 from hanhanhan/docs 2020-07-04 14:27:21 +01:00
Andrew Chen Wang
53e2ba2a66
Update ugettext_lazy to gettext_lazy in models.py 2020-06-30 10:13:51 -04:00
Andrew Chen Wang
21c5b78714
Update ugettext_lazy to gettext_lazy in views.py 2020-06-30 10:12:53 -04:00
Andrew Chen Wang
69611313c9
Add author name and description to HTML meta 2020-06-30 10:01:50 -04:00
Bruno Alla
196167490d Merge branch 'master' into docs
# Conflicts:
#	{{cookiecutter.project_slug}}/requirements/local.txt
2020-06-29 21:48:17 +01:00
Andrew Chen Wang
a9688adc0e
Update ugettext_lazy to gettext_lazy 2020-06-29 15:27:53 -04:00
Gil
88f9a6c289 Replace User by get_user_model 2020-06-21 16:13:42 +09:00
Bruno Alla
09790ee8fb Resolve new flake8 error 2020-05-12 10:18:15 +01:00
Bruno Alla
bcfcd384f8 Test user detail view 2020-05-01 17:55:32 +01:00
Hannah Lazarus
3152bdaeb3 Add sphinx defaults for cookiecutter'd project
-serve, watch + live reload for docs + code file changes
-update project makefile + make.bat
-separate _source and _build
-add packages and paths to use autodoc
-edit/add documentation with examples (both at django-cookiecutter and inside generated project)
-add formatted comments in User model for pickup by Sphinx apidoc
-serve docs from a separate docs container for docker build
2020-04-30 13:23:24 -04:00
Bruno Alla
01b8412805 Fix expected value 2020-04-29 09:23:27 +01:00
Pilhwan Kim
29fea6efa3 remove import UserSerializer in tesf_drf_views.py 2020-04-29 08:54:32 +09:00
Leon Kim
5a9648fa90
Update {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_drf_views.py
OK. I agree with your idea. Even to me, this code is more explicit to check result.

Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2020-04-29 08:41:33 +09:00
Bruno Alla
672be773a3
Fix formatting 2020-04-28 23:18:52 +01:00
Pilhwan Kim
f13f3dc2bf add use drf tests 2020-04-28 12:41:51 +09:00
Bruno Alla
1e612c4cfb Remove request_factory fixture, use the rf one from pytest-django 2020-03-26 18:21:11 +00:00
Bruno Alla
7e1cb599af Remove flake noqa exception 2020-03-23 21:46:14 +00:00
Bruno Alla
c4b1666707 Move storages classes into their own module 2020-03-23 21:46:14 +00:00
Bruno Alla
92bbddc290 Change style for pytest marker
Update pytest.mark.django_db to be more consistent with rest of the project
2020-03-17 18:41:27 +00:00
Bruno Alla
fab6b8724a Test isort flake8-isort & fix issues
fixes #2123
2020-03-03 20:04:31 +00:00
Bruno Alla
3d58ffd4e7 Merge branch 'master' into drf-option-with-tests 2020-01-24 17:23:07 +00:00
Bruno Alla
fa9a8cfe7b Fix code formatting 2020-01-23 18:10:30 +00:00
Bruno Alla
fd43059e28 Update formatting 2020-01-23 17:52:17 +00:00
Bruno Alla
949d8b684c Merge branch 'master' into drf-option-with-tests
# Conflicts:
#	hooks/post_gen_project.py
2020-01-23 14:41:42 +00:00
Bo Peng
3f6562c7fe
Honor passed password for UserFactory 2020-01-19 16:21:27 -06:00
Daniel Hillier
0872982245 Fix failing mypy tests in users app with django-stubs (#2395)
Adds django-stubs as a requirement for local virtualenv. This is
required now that the User Model type is being resolved properly.
2020-01-13 01:57:20 +11:00
Harry Moreno
82c8b51272
Make update form button look like a button
without `ban-primary` the button looks like some floating text.
2019-11-25 16:43:30 -05:00
Jerome Caisip
548417612f Additonal option to setup DRF. 2019-09-17 23:24:09 +08:00
Dani Hodovic
69566f5456
Add context processor for settings variables
This allows for usage of settings variables in templates, e.g

```
{% if settings.USE_ANALYTICS %}
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ settings.GOOGLE_TAG_MANAGER_ID }}" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{% endif %}
```
2019-09-05 13:24:47 +02:00
Bruno Alla
6efb18bcea
Merge pull request #2160 from 2O4/message_on_user_update
Message when user update his info
2019-07-17 21:11:43 +01:00
2O4
566cc3f3e4
Update {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-07-17 19:31:53 +02:00
step21
c085345253
Rename 403_csrf.html to 403.html
403.html is the name that django expects, unless it is overriden. 403_csrf is a separate case, which according to django docs and mailing list should get a separate view/template. Fixes #2163 
Docs: https://docs.djangoproject.com/en/2.1/ref/csrf/#rejected-requests
Mailing list: https://groups.google.com/forum/#!msg/django-developers/O2raF0RVGA0/44-3Jz0jCwAJ
Stackoverflow: https://stackoverflow.com/questions/31981239/django-custom-403-template
2019-07-17 15:14:16 +02:00
2O4
a41c841613
Update views.py 2019-07-15 18:19:07 +02:00
2O4
9da2a19367
Update {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-07-15 18:10:33 +02:00
2O4
e99d27c127
Update {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/views.py
Co-Authored-By: Bruno Alla <browniebroke@users.noreply.github.com>
2019-07-15 18:10:27 +02:00
Bruno Alla
2e32f1ff67
Added a button to close the message pop-up (#2162)
Added a button to close the message pop-up
2019-07-15 10:13:01 +01:00
2O4
5312d9b914
Added a button to close the message 2019-07-14 16:37:37 +02:00
2O4
3aa7181a46
Delete user_list.html
Following on Remove user list view #2062
2019-07-14 15:55:50 +02:00
2O4
c49acc64f9 Update views.py
added message wich will be shown when a user update his infos
2019-07-14 15:22:36 +02:00
2O4
3abf0fec3a fixed buttons 2019-07-11 13:44:38 +02:00
Bruno Alla
872204527f Remove user list view 2019-05-17 22:33:30 +01:00
Bruno Alla
b039e24130
Refactor Celery integration according to current best practices (#2016)
Refactor Celery integration according to current best practices
2019-05-17 21:38:00 +01:00
Tano Abeleyra
d00517252c UsersAppConfig improvements
+ Rename to UsersConfig to follow Django naming convention
+ Translate verbose_name
2019-05-15 20:10:55 -03:00
shireenrao
8933aa17c0
The signal should be imported from project_slug
I am getting an error if I create a signal.py file under users model. Here is the stacktrace
Tracking file by folder pattern:  migrations
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000002663A074048>
Traceback (most recent call last):
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
    autoreload.raise_last_exception()
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception
    raise _exception[1]
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\core\management\__init__.py", line 337, in execute
    autoreload.check_errors(django.setup)()
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\apps\registry.py", line 120, in populate
    app_config.ready()
  File "C:\Users\srao\projects\kbs\kbs\users\apps.py", line 11, in ready
    import users.signals  # noqa F401
  File "C:\Users\srao\projects\kbs\kbs\users\signals.py", line 3, in <module>
    from .models import User
  File "C:\Users\srao\projects\kbs\kbs\users\models.py", line 8, in <module>
    class User(AbstractUser):
  File "C:\Apps\Anaconda3\envs\registration\lib\site-packages\django\db\models\base.py", line 95, in __new__
    "INSTALLED_APPS." % (module, name)
RuntimeError: Model class users.models.User doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Having the signal be imported from project_slug.users.signal fixes the issue.
2019-05-10 11:42:07 -04:00
Bruno Alla
895298c28f Refactor Celery integration according to current best practices
- Change celery app to not be a Django app, more like a WSGI app
- Define a Celery task in the Django users app
- Write a test to execute the task
- Update scripts to use the new app to start workers
- Update documentation

Fix #865
2019-04-02 15:40:32 +01:00
Bruno Alla
b91c70d755
Add a node image to run Gulp when selecting it with Docker (#1687)
## Description

Following up on @webyneter attempt in #1205, which is now getting outdated, I've tried to make Gulp task runner work with Docker. There is no documentation yet, but this seems to work locally with the custom bootstrap compilation...

- [x] Add a node image for local developement
- [x] Proxy the django image rather than localhost in Browser sync, pass header to keep hostname
- [x] Don't call the runserver command from Gulp, let docker-compose handle
- [x] Update package.json & gulpfile.js templates to reduce the number of unwanted empty lines
- [x] Use [multi-stage build](https://docs.docker.com/develop/develop-images/multistage-build/) in production to make sure the static assets are produced
- [x] Update documentation
- [x] Verify that the previous issue with static assets missing from production isn't there 

## Rationale

Currently, the static build isn't working nicely with Docker, extra manual setup is required.

Fixes #1762
2019-03-25 12:10:55 +00:00
Guilherme Fabrizio
7d1e90bdf5 Migrate to unified Sentry SDK (#1820)
The raven library is deprecated. Replace it by the new sentry-sdk library:

https://docs.sentry.io/error-reporting/quickstart/?platform=python

fixes #1818
2019-03-20 10:04:44 +00:00
Bruno Alla
68f7268770
Run Black on Travis (#1957)
* Create a test matrix on Travis CI to help testing multiple options

* Change test_docker.sh to fail if any command in it fails

* Run black on the CI with --check option

* Fix formatting of project files using black

* Install black in the docker container

* Exclude migrations in black checks

* Fix Black formatting violations

* Run black on the whole generated project & fix issues
2019-03-18 17:49:43 +00:00
Tubo Shi
a1508f2600 updated spacing utility class name 2018-11-30 18:12:08 +13:00
Leo Zhou
8217ea439b Config celery app immediately after the app being created, otherwise it is too late. 2018-11-12 17:59:26 +08:00
Bruno Alla
95ee1f159d
Merge pull request #1717 from hendrikschneider/master
removed default action from project.js #1716
2018-07-17 15:47:22 +01:00
Mateusz Ostaszewski
80f6b1958e Update bootstrap to 4.1.1 (#1697)
* Update Bootstrap to 4.1.1

* Add myself to contributors
2018-07-12 12:35:28 +03:00
Hendrik Schneider
9932ea3b18
Update project.js 2018-07-11 10:43:19 +00:00
Hendrik Schneider
27bc27e634
Update project.js 2018-07-10 22:22:10 +00:00
Nikita Shupeyko
8ad7adb11a
Re-write users app tests in pytest style & perform minor refactoring (#1680) 2018-06-27 19:33:38 +03:00