Skip to content

Commit

Permalink
Set django admin user fields to autocomplete, and change password fie…
Browse files Browse the repository at this point in the history
…lds to read only.
  • Loading branch information
rsmith0717 committed Feb 8, 2022
1 parent d680197 commit 70eaea5
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ History
++++++++++++++++++

* Accommodate tenant architecture by checking for a SiteSettings model to see if previous_password_count has been set.
* Second release on PyPI.
* Second release on PyPI.


1.0.4 (2022-02-08)
++++++++++++++++++

* Set django admin user fields to autocomplete, and change password fields to read only.
* Third release on PyPI.
2 changes: 1 addition & 1 deletion django_password_history/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.3'
__version__ = '1.0.4'
7 changes: 5 additions & 2 deletions django_password_history/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
# -*- coding: utf-8 -*-

from django.contrib import admin
from djangoql.admin import DjangoQLSearchMixin


from .models import (
UserPasswordHistory,
)


@admin.register(UserPasswordHistory)
class UserPasswordHistoryAdmin(admin.ModelAdmin):
pass
class UserPasswordHistoryAdmin(DjangoQLSearchMixin, admin.ModelAdmin):
autocomplete_fields = ['user']
readonly_fields = ('password_1', 'password_2', 'password_3', 'password_4', 'password_5')



3 changes: 3 additions & 0 deletions django_password_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class UserPasswordHistory(models.Model):
password_5 = models.CharField(blank=True, null=True, max_length=128)
updated_at = models.DateTimeField(auto_now=True)

def __str__(self):
return self.user.username + "_password_history"

def password_is_used(self, password, site_id=1):
previous_passwords_count = 5
SiteSettings = None
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
django-model-utils==4.2.0
djangoql==0.15.4 # https://github.com/ivelum/djangoql
# Additional requirements go here

0 comments on commit 70eaea5

Please sign in to comment.