Projet

Général

Profil

Bug #7150

Get authentic2 working with Django 1.8

Ajouté par Nickolas Grigoriadis il y a presque 9 ans. Mis à jour il y a plus de 6 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
05 mai 2015
Echéance:
% réalisé:

100%

Temps estimé:
Patch proposed:
Oui
Planning:

Description

Since Django 1.8 is a long-term-support release, with a promise of security updates for 2 years, and this being a very security concious application, it seems prudent to support 1.8 as soon as able.

On a quick glance, custom_user and sekizai seems to be pain points.


Fichiers

Révisions associées

Révision 6b1977f2 (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

custom_user: fix initial migration

fixes #7150

Révision 43270b86 (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

auth_migrations: prevent collision with related names

Groups and permissions field had the same related names on auth.User and
custom_user.User.

fixes #7150

Révision cc99b61a (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

tox.ini: prepare environment for testing on Django 1.8 (#7150)

Révision a753ba25 (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

setup.py: raise requirement on django-tables to >1.0 for Django 1.7 and 1.8 support (#7150)

Révision a8ee65d8 (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

Django 1.8 compatibility (fixes #7150)

Révision 293ff36b (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

Django 1.8 compatibility (again, fixes #7150)

Révision eda129d7 (diff)
Ajouté par Benjamin Dauvergne il y a presque 9 ans

custom_user: add missing migration (fixes #7150)

Révision c481e99a (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

copy AbstractUser from django.contrib.auth for Django 1.8 compatibility (#7150)

AbstractUser.last_login was modified between Django 1.7 and 1.8. To stay
compatible with both, we have to copy AbstractUser into authentic2. In the
future we should follow evolution of user models on Django side or move back to
the shared AbstractUser model if we ever dump compatibility with Django 1.7.

Révision 74e7446e (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

override pre-Django 1.8 PasswordResetTokenGenerator (#7150)

It supposes that user.last_login is always a datetime, which is not true anymore.

Révision dd5a6289 (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

completely remove transient user support (#7150)

Transient LDAP user has never really worked, and transient SAML user do not
exist anymore since remove of authsaml2. Since Django 1.8 transient user are not
compatible with django.contrib.auth anymore as it enforces that the stored
_auth_user_id is a real model primary key.

Révision 573f2bb0 (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

ldap: factorize keep_password initialization (#7150)

Révision 756cac56 (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

ldap: directly call LDAPUser.keep_password in return_django_user (#7150)

Révision 2daf8908 (diff)
Ajouté par Benjamin Dauvergne il y a environ 8 ans

store LDAP data in session instead of replacing LDAPUser.pk by a pickle object (#7150)

Django > 1.8 does not allow anymore to store anything in the _auth_user_id
key in the session as it checks it can be converted to an user model pk.

Historique

#1

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

For sekizai we have to wait for their release, what is the pain point with custom user exactly ?

#2

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

  • Statut changé de Nouveau à Information nécessaire

Currently all our unit tests (including login, registration and SAML tests) run under Django 1.8 (but none of them need django-sekizai I think), I change status to more informations needed.

#3

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

  • Version cible mis à 2.2.0
#4

Mis à jour par Nickolas Grigoriadis il y a presque 9 ans

When I did a quick test on Django1.8, the custom_user migrations failed.

Also, what is sekizai used for? I know it crops up as a pain point far too often for my liking.

#5

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

Try again and report the traceback on the custom user migration. Thanks. Sekizai is used to include static files from templates which are rendered before the rendering of the final template. It's the same use case as in django-cms for example. Please to propose patches with another solution to this problem if you want a change on this point.

#6

Mis à jour par Nickolas Grigoriadis il y a presque 9 ans

The custom_user traceback:

Applying custom_user.0001_initial...Traceback (most recent call last):
File "./authentic2-ctl", line 20, in <module>
execute_from_command_line(sys.argv[:1] + argv)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
super(Command, self).execute(*args, **options)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
failures = test_runner.run_tests(test_labels)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
old_config = self.setup_databases()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
**kwargs
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
test_flush=not keepdb,
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
return command.execute(*args, **defaults)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
output = self.handle(*args, **options)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 221, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 110, in migrate
self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 147, in apply_migration
state = migration.apply(state, schema_editor)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/migrations/migration.py", line 115, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 183, in database_forwards
self.code(from_state.apps, schema_editor)
File "/home/grigi/work/a2/src/authentic2/custom_user/migrations/0001_initial.py", line 20, in copy_old_users_to_custom_user_model
for old_user in old_users:
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/query.py", line 162, in iter
self._fetch_all()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/query.py", line 965, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/query.py", line 238, in iterator
results = compiler.execute_sql()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 826, in execute_sql
sql, params = self.as_sql()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 375, in as_sql
extra_select, order_by, group_by = self.pre_sql_setup()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 48, in pre_sql_setup
self.setup_query()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 39, in setup_query
self.select, self.klass_info, self.annotation_col_map = self.get_select()
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 203, in get_select
related_klass_infos = self.get_related_selections(select)
File "/home/grigi/work/a2/.pyenv/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 751, in get_related_selections
', '.join(_get_field_choices()) or '(none)',
django.core.exceptions.FieldError: Invalid field name(s) given in select_related: 'user_permissions', 'groups'. Choices are: (none)

Seems the issue is somewhere in "copy_old_users_to_custom_user_model". When I disable calling that function it passes.

#7

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

#8

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

  • Assigné à mis à Benjamin Dauvergne
#9

Mis à jour par Benjamin Dauvergne il y a presque 9 ans

  • Statut changé de Nouveau à Résolu (à déployer)
  • % réalisé changé de 0 à 100
#14

Mis à jour par Benjamin Dauvergne il y a environ 8 ans

  • Statut changé de Résolu (à déployer) à Solution déployée
#15

Mis à jour par Benjamin Dauvergne il y a plus de 6 ans

  • Statut changé de Solution déployée à Fermé

Formats disponibles : Atom PDF