Arabic Django user management app with abstract user, permissions, and activity logging
Project description
Micro Users - Arabic Django User Management App
Arabic lightweight, reusable Django app providing user management with abstract user, permissions, localization, and activity logging.
Requirements
- Must be installed on a fresh database.
- Python 3.11+
- Django 5.1+
- django-crispy-forms 2.4+
- django-tables2 2.7+
- django-filter 24.3+
- pillow 11.0+
- babel 2.1+
Features
- Custom AbstractUser model
- Scope Management System (Optional)
- Custom Grouped User permissions system
- Automatic Activity logging (login/logout, CRUD for all models)
- Specific User detail and log view
- Localization support
- Admin interface integration
- CRUD views and templates
- Filtering and tabulation
Future updates are planned to support dynamic language switching between RTL and LTR.
Installation
pip install git+https://github.com/debeski/micro-users.git
# OR
pip install micro-users
Configuration
- Add to
INSTALLED_APPS:
INSTALLED_APPS = [
'users', # Preferably on top
'django.contrib.admin',
'django.contrib.auth',
...
]
- Add Middleware in
settings.py(Required for logging):
MIDDLEWARE = [
# ...
'django.contrib.auth.middleware.AuthenticationMiddleware',
# ...
'users.middleware.ActivityLogMiddleware', # Add this line
]
- Set custom user model in
settings.py:
AUTH_USER_MODEL = 'users.CustomUser'
- Include URLs in your main project folder
urls.py:
urlpatterns = [
...
path('manage/', include('users.urls')),
]
- Run migrations:
python manage.py migrate users
How to Use
Once configured, the app automatically handles user management and activity logging. Ensure your project has a base.html template in the root templates directory, as all user management templates extend it.
Activity Logging
The app provides a fully automated activity logging system. No manual configuration is required in your views.
- Login/Logout: Automatically tracked.
- Create/Update/Delete: Any change to any model in your app (including
ScopeandUser) is automatically logged via Django Signals. - Log content: Tracks the user, action type, model name, object ID, and timestamp.
- Note:
last_loginfield updates are automatically filtered out to prevent redundant "Update" logs on login.
- Note:
To view logs, navigate to manage/logs/ or use the Django Admin interface ("حركات السجل").
Available URLs
All user management URLs are prefixed with manage/ as configured above. Below is the complete list:
| URL Pattern | View/Function | Description |
|---|---|---|
manage/login/ |
auth_views.LoginView.as_view() |
User login |
manage/logout/ |
auth_views.LogoutView.as_view() |
User logout |
manage/users/ |
views.UserListView.as_view() |
List all users |
manage/users/create/ |
views.create_user |
Create new user |
manage/users/edit/<int:pk>/ |
views.edit_user |
Edit existing user |
manage/users/delete/<int:pk>/ |
views.delete_user |
Delete user |
manage/users/<int:pk>/ |
views.UserDetailView.as_view() |
View user details |
manage/profile |
views.user_profile |
View current user profile |
manage/profile/edit/ |
views.edit_profile |
Edit current profile |
manage/logs/ |
views.UserActivityLogView.as_view() |
View activity logs |
manage/reset_password/<int:pk>/ |
views.reset_password |
Reset user password |
manage/scopes/manage/ |
views.manage_scopes |
Scope Manager (Modal) |
Structure
users/
├── views.py # CRUD operations
├── urls.py # URL routing
├── tables.py # User and Activity Log tables
├── signals.py # Logging signals
├── middleware.py # Request capture for signals
├── models.py # User model, permissions, activity logs
├── forms.py # Creation, edit,. etc.
├── filter.py # Search filters
├── apps.py # Permissions Localization
├── admin.py # Admin UI integration
├── __init__.py # Python init
├── templates/ # HTML templates (includes partials)
├── static/ # CSS classes
└── migrations/ # Database migrations
Customization
Replacing Login Logo
To replace the default login logo, simply place your own login_logo.webp image in your project's static directory at static/img/login_logo.webp.
Theme Configuration
You can configure the login page colors by defining MICRO_USERS_THEME in your project's settings.py. This dictionary overrides the default CSS variables.
MICRO_USERS_THEME = {
'right_bg': '#474745',
'left_bg': 'white',
'selection_bg': '#dbdbdb',
'gradient_start': '#a2a2a7',
'gradient_end': '#474745',
# Additional keys supported:
# 'selection_moz_bg', 'left_shadow', 'right_shadow', 'right_text',
# 'label_color', 'input_text', 'submit_color', 'submit_focus', 'submit_active'
}
Version History
| Version | Changes |
|---|---|
| v1.0.0 | • Initial release as pip package |
| v1.0.1 | • Fixed a couple of new issues as a pip package |
| v1.0.2 | • Fixed the readme and building files |
| v1.0.3 | • Still getting the hang of this pip publish thing |
| v1.0.4 | • Honestly still messing with and trying settings and stuff out |
| v1.1.0 | • OK, finally a working seamless micro-users app |
| v1.1.1 | • Fixed an expolit where a staff member could disable the ADMIN user |
| v1.2.0 | • Added User Details view with specific user activity log |
| v1.2.1 | • Fixed a minor import bug |
| v1.2.2 | • Separated user detail view from table for consistency • Optimized the new detail + log view for optimal compatibiliyy with users |
| v1.2.3 | • Fixed a couple of visual inconsistencies |
| v1.3.0 | • Patched a critical security permission issue • Disabled ADMIN from being viewed/edited from all other members • Fixed a crash when sorting with full_name • Enabled Logging for all actions |
| v1.3.1 | • Corrected a misplaced code that caused a crash when editing profile |
| v1.3.2 | • Minor table modifications |
| v1.4.0 | • Redesigned Permissions UI (Grouped by App/Action) • Added Global Bulk Permission Selectors • Improved Arabic Localization for Permissions • Optimized printing (hidden forms/buttons) • Fixed various bugs and crashes |
| v1.4.1 | • Changed "Administrative User" translation to "Responsible User" (مستخدم مسؤول) • Enforced custom sorting order for Permissions (View -> Add -> Change -> Other) |
| v1.5.0 | • Department Management (Modal-based CRUD) • Department field implementation • Template refactoring (partials/, profile/, users/ for logs) • Verbose names for models |
| v1.6.0 | • Automated Activity Logging: dynamic logging for all CREATE/UPDATE/DELETE actions via Middleware & Signals • Refactor: Renamed Department model to Scope (Scope Management)• Removed manual logging requirement • Architecture: Decoupled models, forms, and tables using dynamic imports and apps.get_model • Soft Delete: Users are now marked as inactive with a timestamp instead of being permanently deleted • Activity Log: Deleted users appear with a strikethrough • CSS Refactor: Extracted and cleaned up styling with CSS variables • Login: Refactored login page with separated JS/CSS and a new modern default logo |
| v1.6.1 | • Theme Configuration: Added MICRO_USERS_THEME setting for easy color customization • Bug Fixes: Explicitly excluded unwanted columns (id, ip_address, user_agent) from Activity Log table • UI: Improved Scope Manager button visibility |
| v1.6.2 | • UI: Improved some tooltips for buttons and descriptions |
| v1.6.3 | • Bug Fixes: Fixed a crash with a table tooltip |
| v1.7.0 | • New Theme: Complete visual overhaul with modern, consistent styling • Refactor: Updated Login, Profile, and Detail templates for better UX • Feature: Added Scope filter to Activity Logs (superuser only) • UX: Clear button in filters now preserves current sort order |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file micro_users-1.7.0.tar.gz.
File metadata
- Download URL: micro_users-1.7.0.tar.gz
- Upload date:
- Size: 71.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48eecbce019693aba4d66086373ee28c4a1fce63947143d38eccc2c75e8c0a95
|
|
| MD5 |
67421ecfa98c9c264023853cd1f551cd
|
|
| BLAKE2b-256 |
5d83ff798e98f348fa6fa3d5e314fb10cd27b88c583fe8a2df9d1710355dba96
|
File details
Details for the file micro_users-1.7.0-py3-none-any.whl.
File metadata
- Download URL: micro_users-1.7.0-py3-none-any.whl
- Upload date:
- Size: 79.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4ea6461dd7a38c5e30f9d7b75992cbcddd68ad282e5679593582b2b3d759ca5
|
|
| MD5 |
fbcd4b72029abb6f2a97aeb205b8973e
|
|
| BLAKE2b-256 |
d5403f808deac57b99d04dfc4f668874317d3b6246921c063f773c6b6d94d2cd
|