Commit graph

10 commits

Author SHA1 Message Date
Denis
96f2f3d93e Fixed resource_url to work with non-id models (#147)
* Fixed resource_url to work with non-id models

* Add tests for auditlog admin
2018-01-04 11:49:39 -05:00
Rod Manning
4dee03497c Add Django 2.0 Support (#154)
* Add changes for django 2.0

Made the following changes to ensure compatibility with django 2.0:

1. Replaced function calls to `is_authenticated()` with reference to
   property `is_authenticated`.

2. Added try/except call to import `django.core.urlresolvers` (now
   called `django.urls`.

   Also added an `... as ...` statement to ensure that references in the
   code to `urlresolvers` don't need to be changed.

3. Fixed calls statement of `on_delete` arg to all ForeignKey
   fields.

   Note that previously a kwarg was acceptable, but this is now a
   positional arg, and the selected `on_delete` method has been
   retained.

* Update tox tests and consequentual changes

Updated tox.ini to also test django 2.0 on python 3+. Some changes made
to previous commits required to ensure all tests passed:

- Added `compat.py` to have a `is_authenticated()` function to check
  authentication.

  This was necessary as the property/method call for `is_authenticated`
  is no compatible between django 1.8 (LTS) and 2.0.

  Changed AuditLogMiddleware to call this compatibility function instead
  of the django built-ins as a result.

- Changes made to `auditlog/models.py` to apply kwargs to both `to=` and
  `on_delete=` for consistency of handling in all version tested.

Incorrect django version specified for tox.ini. Now fixed.

* Add 'on_delete' kwarg to initial migration

Added and re-arranged 'on_delete' and 'to' kwargs in initial migration
to ensure compatbility with later versions of Django.

Also included updated manifest with changes required due to django 2.0
work.

* Add TestCase for compat.py

Added simple test case for compat.py file.

* Changes follow code review 2017-12-21

* More changes following code review 2017-12-28

1. Added detailed commentary to `compat.py` to ensure reason why
   `is_authenticated()` compatibility function is needed

2. Changed `hasattr` to `callable` in compat.is_authenticated()

3. Fixed typo in migration 0001 to use correct `on_delete` function
2018-01-02 13:50:45 -05:00
Jan-Jelle Kester
22997ded2f Fix import error
Issue #104
2017-02-16 22:24:24 +01:00
Stavros Korokithakis
03def6cdb3
Don't crash if the linked object is not in the admin (fixes #99) 2017-02-16 05:06:12 +02:00
Jan-Jelle Kester
9bbb77bcda Merge branch 'master' into patch-1 2017-02-09 20:14:26 +01:00
Fernando Espíndola
38ec7de585 Fix the resource_url method when a model primary key is a models.UUIDField, we need to consider use the object_pk in this case. 2017-01-26 01:21:13 -02:00
Onur YALAZI
eef4a14cd3 Changed to actor's string represantation
Depending on actor's attributes is error prone, developers can extend the user model without the needed attributes.
2017-01-22 11:32:44 +02:00
Onur YALAZI
56a9ab6ab8 LogEntryAdminMixin throws Attribute error If a user misses full_name 2017-01-18 13:40:22 +02:00
Kevin Alberts
f498f740ee Updated LogEntryAdminMixin to use get_full_name() method from Django Auth.User model 2017-01-10 16:55:06 +01:00
Rob Guttman
20eb91359a enhanced admin interface closes #1 2016-09-02 15:02:42 -04:00