nside-wefa 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nside_wefa-0.1.0/.coveragerc +4 -0
- nside_wefa-0.1.0/.gitignore +1 -0
- nside_wefa-0.1.0/.python-version +1 -0
- nside_wefa-0.1.0/CONTRIBUTE.md +357 -0
- nside_wefa-0.1.0/PKG-INFO +172 -0
- nside_wefa-0.1.0/README.md +142 -0
- nside_wefa-0.1.0/conf.py +7 -0
- nside_wefa-0.1.0/db.sqlite3 +0 -0
- nside_wefa-0.1.0/demo/__init__.py +0 -0
- nside_wefa-0.1.0/demo/asgi.py +16 -0
- nside_wefa-0.1.0/demo/settings.py +153 -0
- nside_wefa-0.1.0/demo/urls.py +25 -0
- nside_wefa-0.1.0/demo/wsgi.py +16 -0
- nside_wefa-0.1.0/docs/source/__init__.py +0 -0
- nside_wefa-0.1.0/docs/source/conf.py +67 -0
- nside_wefa-0.1.0/docs/source/index.rst +23 -0
- nside_wefa-0.1.0/manage.py +23 -0
- nside_wefa-0.1.0/mypy.ini +9 -0
- nside_wefa-0.1.0/nside_wefa/__init__.py +8 -0
- nside_wefa-0.1.0/nside_wefa/authentication/README.md +262 -0
- nside_wefa-0.1.0/nside_wefa/authentication/__init__.py +6 -0
- nside_wefa-0.1.0/nside_wefa/authentication/apps.py +25 -0
- nside_wefa-0.1.0/nside_wefa/authentication/checks.py +98 -0
- nside_wefa-0.1.0/nside_wefa/authentication/constants.py +15 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/test_apps.py +112 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/test_checks.py +198 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/test_urls.py +249 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/utils/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/utils/test_settings_initialization.py +195 -0
- nside_wefa-0.1.0/nside_wefa/authentication/tests/utils/test_utils.py +49 -0
- nside_wefa-0.1.0/nside_wefa/authentication/urls.py +37 -0
- nside_wefa-0.1.0/nside_wefa/authentication/utils/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/authentication/utils/settings_initialization.py +46 -0
- nside_wefa-0.1.0/nside_wefa/authentication/utils/utils.py +19 -0
- nside_wefa-0.1.0/nside_wefa/common/__init__.py +6 -0
- nside_wefa-0.1.0/nside_wefa/common/apps.py +21 -0
- nside_wefa-0.1.0/nside_wefa/common/checks.py +49 -0
- nside_wefa-0.1.0/nside_wefa/common/tests/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/common/tests/test_checks.py +99 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/README.md +222 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/__init__.py +6 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/apps.py +26 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/checks.py +107 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/migrations/0001_initial.py +71 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/migrations/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/models/__init__.py +1 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/models/legal_consent.py +132 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/serializers.py +57 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/templates/en/privacy_notice.md +49 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/templates/en/terms_of_use.md +29 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/templates/privacy_notice.md +49 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/templates/terms_of_use.md +29 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/test_utils/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/migrations/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/migrations/test_legal_consent_migration.py +67 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/models/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/models/test_legal_consent.py +479 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/serializers/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/serializers/test_legal_consent_serializer.py +195 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/test_checks.py +262 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/views/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/views/test_gdpr_agreement_view.py +222 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/views/test_privacy_notice_view.py +126 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/tests/views/test_terms_of_use_view.py +124 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/urls.py +34 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/views/__init__.py +9 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/views/legal_consent_view.py +105 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/views/privacy_notice_view.py +55 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/views/terms_of_use_view.py +48 -0
- nside_wefa-0.1.0/nside_wefa/legal_consent/views/utils.py +53 -0
- nside_wefa-0.1.0/nside_wefa/utils/__init__.py +0 -0
- nside_wefa-0.1.0/nside_wefa/utils/checks.py +123 -0
- nside_wefa-0.1.0/pyproject.toml +61 -0
- nside_wefa-0.1.0/pytest.ini +4 -0
- nside_wefa-0.1.0/uv.lock +1030 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.coverage
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# Contributing to N-SIDE WeFa
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to N-SIDE WeFa!
|
|
4
|
+
This document provides guidelines and instructions for setting up your development environment and contributing to the project.
|
|
5
|
+
|
|
6
|
+
## Table of Contents
|
|
7
|
+
|
|
8
|
+
- [Development Setup](#development-setup)
|
|
9
|
+
- [Project Structure](#project-structure)
|
|
10
|
+
- [Running Tests](#running-tests)
|
|
11
|
+
- [Code Standards](#code-standards)
|
|
12
|
+
- [Contributing Workflow](#contributing-workflow)
|
|
13
|
+
- [Adding New Libraries](#adding-new-libraries)
|
|
14
|
+
- [Documentation](#documentation)
|
|
15
|
+
|
|
16
|
+
## Development Setup
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
19
|
+
|
|
20
|
+
- Python >= 3.12
|
|
21
|
+
- UV package manager (recommended) or pip
|
|
22
|
+
- Git
|
|
23
|
+
|
|
24
|
+
### Local Development Environment
|
|
25
|
+
|
|
26
|
+
1. **Clone the repository:**
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/n-side-dev/wefa.git
|
|
29
|
+
cd wefa
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
2. **Set up virtual environment with UV (recommended):**
|
|
33
|
+
```bash
|
|
34
|
+
uv venv
|
|
35
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or with pip:
|
|
39
|
+
```bash
|
|
40
|
+
python -m venv .venv
|
|
41
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
3. **Install dependencies:**
|
|
45
|
+
```bash
|
|
46
|
+
uv sync --all-extras # With UV
|
|
47
|
+
# or
|
|
48
|
+
pip install -e ".[dev]" # With pip
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
4. **Set up the test Django project:**
|
|
52
|
+
```bash
|
|
53
|
+
cd django
|
|
54
|
+
python manage.py migrate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Creating a Test Django Project
|
|
58
|
+
|
|
59
|
+
To test the library in a separate Django project:
|
|
60
|
+
|
|
61
|
+
1. **Create a new Django project:**
|
|
62
|
+
```bash
|
|
63
|
+
mkdir test_project
|
|
64
|
+
cd test_project
|
|
65
|
+
django-admin startproject myproject .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
2. **Install nside-wefa in development mode:**
|
|
69
|
+
```bash
|
|
70
|
+
pip install -e /path/to/nside-demo
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. **Add to INSTALLED_APPS:**
|
|
74
|
+
```python
|
|
75
|
+
# settings.py
|
|
76
|
+
INSTALLED_APPS = [
|
|
77
|
+
'django.contrib.admin',
|
|
78
|
+
'django.contrib.auth',
|
|
79
|
+
'django.contrib.contenttypes',
|
|
80
|
+
'django.contrib.sessions',
|
|
81
|
+
'django.contrib.messages',
|
|
82
|
+
'django.contrib.staticfiles',
|
|
83
|
+
'rest_framework',
|
|
84
|
+
'rest_framework.authtoken', # Required for Token authentication
|
|
85
|
+
'rest_framework_simplejwt', # Required for JWT authentication
|
|
86
|
+
'nside_wefa.common', # Must come before other nside_wefa apps
|
|
87
|
+
'nside_wefa.authentication', # Add the Authentication app
|
|
88
|
+
'nside_wefa.legal_consent', # Add the LegalConsent app
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
# Configuration
|
|
92
|
+
NSIDE_WEFA = {
|
|
93
|
+
'APP_NAME': 'My App',
|
|
94
|
+
'AUTHENTICATION': {
|
|
95
|
+
'TYPES': ['TOKEN', 'JWT'],
|
|
96
|
+
},
|
|
97
|
+
'LEGAL_CONSENT': {
|
|
98
|
+
'VERSION': 1,
|
|
99
|
+
'EXPIRY_LIMIT': 365,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
4. **Run migrations and test:**
|
|
105
|
+
```bash
|
|
106
|
+
python manage.py migrate
|
|
107
|
+
python manage.py runserver
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Project Structure
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
nside-wefa/
|
|
114
|
+
├── nside_wefa/ # Main package
|
|
115
|
+
│ ├── __init__.py
|
|
116
|
+
│ ├── authentication/ # Authentication configuration library
|
|
117
|
+
│ │ ├── __init__.py
|
|
118
|
+
│ │ ├── apps.py
|
|
119
|
+
│ │ ├── checks.py
|
|
120
|
+
│ │ ├── constants.py
|
|
121
|
+
│ │ ├── urls.py
|
|
122
|
+
│ │ ├── utils/
|
|
123
|
+
│ │ ├── tests/
|
|
124
|
+
│ │ └── README.md
|
|
125
|
+
│ └── legal_consent/ # Legal Consent library
|
|
126
|
+
│ ├── __init__.py
|
|
127
|
+
│ ├── models/
|
|
128
|
+
│ ├── views.py
|
|
129
|
+
│ ├── serializers.py
|
|
130
|
+
│ ├── urls.py
|
|
131
|
+
│ ├── tests/
|
|
132
|
+
│ └── README.md
|
|
133
|
+
├── pyproject.toml # Package configuration
|
|
134
|
+
├── README.md # Main documentation
|
|
135
|
+
├── CONTRIBUTE.md # This file
|
|
136
|
+
└── manage.py # Django management script (for testing)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Running Tests
|
|
140
|
+
|
|
141
|
+
### Full Test Suite
|
|
142
|
+
|
|
143
|
+
Run all tests from the project root:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
cd django/nside_wefa
|
|
147
|
+
python manage.py test
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Specific App Tests
|
|
151
|
+
|
|
152
|
+
Run tests for a specific app:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
python manage.py test nside_wefa.authentication
|
|
156
|
+
python manage.py test nside_wefa.legal_consent
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Test Categories
|
|
160
|
+
|
|
161
|
+
Run specific test categories:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Authentication tests
|
|
165
|
+
python manage.py test nside_wefa.authentication.tests
|
|
166
|
+
# Model tests
|
|
167
|
+
python manage.py test nside_wefa.legal_consent.tests.models
|
|
168
|
+
|
|
169
|
+
# View tests
|
|
170
|
+
python manage.py test nside_wefa.legal_consent.tests.views
|
|
171
|
+
|
|
172
|
+
# Serializer tests
|
|
173
|
+
python manage.py test nside_wefa.legal_consent.tests.serializers
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# Migration tests
|
|
177
|
+
python manage.py test nside_wefa.legal_consent.tests.migrations
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Coverage
|
|
181
|
+
|
|
182
|
+
To run tests with coverage:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
coverage run --source='.' manage.py test
|
|
186
|
+
coverage report
|
|
187
|
+
coverage html # Generate HTML coverage report
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Code Standards
|
|
191
|
+
|
|
192
|
+
### Python Code Style
|
|
193
|
+
|
|
194
|
+
- Follow PEP 8 guidelines
|
|
195
|
+
- Use meaningful variable and function names
|
|
196
|
+
- Add docstrings to all classes and functions
|
|
197
|
+
- Maximum line length: 88 characters (Black formatter default)
|
|
198
|
+
|
|
199
|
+
### Django Conventions
|
|
200
|
+
|
|
201
|
+
- Follow Django's coding style
|
|
202
|
+
- Use Django's built-in features when possible
|
|
203
|
+
- Maintain backward compatibility
|
|
204
|
+
- Write comprehensive tests for all functionality
|
|
205
|
+
|
|
206
|
+
### Type Hints
|
|
207
|
+
|
|
208
|
+
Use type hints for all function parameters and return values:
|
|
209
|
+
|
|
210
|
+
```python
|
|
211
|
+
from typing import Optional
|
|
212
|
+
from django.contrib.auth.models import User
|
|
213
|
+
from nside_wefa.legal_consent.models import LegalConsent
|
|
214
|
+
|
|
215
|
+
def create_user_agreement(user: User, version: Optional[int] = None) -> LegalConsent:
|
|
216
|
+
"""Create a legal consent for the given user."""
|
|
217
|
+
# Implementation here
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Contributing Workflow
|
|
221
|
+
|
|
222
|
+
### 1. Fork and Branch
|
|
223
|
+
|
|
224
|
+
1. Fork the repository on GitHub
|
|
225
|
+
2. Create a branch (feature/ or bugfix/ or ...):
|
|
226
|
+
```bash
|
|
227
|
+
git checkout -b feature/your-feature-name
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 2. Development
|
|
231
|
+
|
|
232
|
+
1. Make your changes
|
|
233
|
+
2. Write or update tests
|
|
234
|
+
3. Update documentation if necessary
|
|
235
|
+
4. Ensure all tests pass
|
|
236
|
+
|
|
237
|
+
### 3. Code Quality
|
|
238
|
+
|
|
239
|
+
Run code quality checks:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Format code
|
|
243
|
+
ruff format .
|
|
244
|
+
|
|
245
|
+
# Check linting
|
|
246
|
+
ruff check .
|
|
247
|
+
|
|
248
|
+
# Type checking
|
|
249
|
+
mypy nside_wefa/
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 4. Testing
|
|
253
|
+
|
|
254
|
+
Before submitting:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Run full test suite
|
|
258
|
+
python manage.py test
|
|
259
|
+
|
|
260
|
+
# Check test coverage
|
|
261
|
+
coverage run --source='.' manage.py test
|
|
262
|
+
coverage report --fail-under=80
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### 5. Submit Pull Request
|
|
266
|
+
|
|
267
|
+
1. Push your branch to your fork
|
|
268
|
+
2. Create a pull request with:
|
|
269
|
+
- Clear description of changes
|
|
270
|
+
- Reference to any related issues
|
|
271
|
+
- Test results
|
|
272
|
+
- Updated documentation
|
|
273
|
+
|
|
274
|
+
## Adding New Libraries
|
|
275
|
+
|
|
276
|
+
When adding a new library to the nside-wefa package:
|
|
277
|
+
|
|
278
|
+
### 1. Structure
|
|
279
|
+
|
|
280
|
+
Create the library structure:
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
nside_wefa/
|
|
284
|
+
└── your_library/
|
|
285
|
+
├── __init__.py
|
|
286
|
+
├── apps.py
|
|
287
|
+
├── models/
|
|
288
|
+
├── views.py
|
|
289
|
+
├── serializers.py
|
|
290
|
+
├── urls.py
|
|
291
|
+
├── tests/
|
|
292
|
+
└── README.md
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### 2. App Configuration
|
|
296
|
+
|
|
297
|
+
Create an `apps.py` file:
|
|
298
|
+
|
|
299
|
+
```python
|
|
300
|
+
from django.apps import AppConfig
|
|
301
|
+
|
|
302
|
+
class YourLibraryConfig(AppConfig):
|
|
303
|
+
default_auto_field = "django.db.models.BigAutoField"
|
|
304
|
+
name = "nside_wefa.your_library"
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### 3. Documentation
|
|
308
|
+
|
|
309
|
+
Create a comprehensive `README.md` for your library following the LegalConsent library example.
|
|
310
|
+
|
|
311
|
+
### 4. Tests
|
|
312
|
+
|
|
313
|
+
Write comprehensive tests covering:
|
|
314
|
+
- Model functionality
|
|
315
|
+
- View behavior
|
|
316
|
+
- Serializer validation
|
|
317
|
+
- Migration operations
|
|
318
|
+
- Integration scenarios
|
|
319
|
+
|
|
320
|
+
### 5. Update Main README
|
|
321
|
+
|
|
322
|
+
Add your library to the Libraries section in the main README.md.
|
|
323
|
+
|
|
324
|
+
## Documentation
|
|
325
|
+
|
|
326
|
+
### Code Documentation
|
|
327
|
+
|
|
328
|
+
- Add docstrings to all classes, methods, and functions
|
|
329
|
+
- Use reST-style docstrings (reStructuredText format)
|
|
330
|
+
- Include type hints
|
|
331
|
+
- Document complex business logic
|
|
332
|
+
|
|
333
|
+
### README Updates
|
|
334
|
+
|
|
335
|
+
When making changes:
|
|
336
|
+
- Update the relevant library README
|
|
337
|
+
- Update the main README if adding new features
|
|
338
|
+
- Keep examples up to date
|
|
339
|
+
- Update version numbers as needed
|
|
340
|
+
|
|
341
|
+
### API Documentation
|
|
342
|
+
|
|
343
|
+
For REST API endpoints:
|
|
344
|
+
- Use DRF's built-in schema generation
|
|
345
|
+
- Add comprehensive docstrings to serializers and views
|
|
346
|
+
- Include usage examples
|
|
347
|
+
|
|
348
|
+
## Questions and Support
|
|
349
|
+
|
|
350
|
+
If you have questions or need help:
|
|
351
|
+
|
|
352
|
+
1. Check existing issues on GitHub
|
|
353
|
+
2. Review the documentation
|
|
354
|
+
3. Create a new issue with detailed information
|
|
355
|
+
4. Tag maintainers if urgent
|
|
356
|
+
|
|
357
|
+
Thank you for contributing to N-SIDE WeFa!
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nside-wefa
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Django library with Legal Consent compliance utilities and reusable apps
|
|
5
|
+
Project-URL: Homepage, https://github.com/n-side-dev/wefa
|
|
6
|
+
Project-URL: Repository, https://github.com/n-side-dev/wefa
|
|
7
|
+
Project-URL: Documentation, https://github.com/n-side-dev/wefa#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/n-side-dev/wefa/issues
|
|
9
|
+
Author-email: N-SIDE <fso@n-side.com>
|
|
10
|
+
License: Apache-2.0
|
|
11
|
+
Keywords: api,compliance,django,gdpr,web
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Classifier: Framework :: Django :: 5.2
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Requires-Dist: django-cors-headers>=4.9.0
|
|
25
|
+
Requires-Dist: django>=5.2.6
|
|
26
|
+
Requires-Dist: djangorestframework-simplejwt>=5.5.1
|
|
27
|
+
Requires-Dist: djangorestframework>=3.14.0
|
|
28
|
+
Requires-Dist: drf-spectacular>=0.28.0
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# WeFa Django Toolkit
|
|
32
|
+
|
|
33
|
+
WeFa (Web Factory) delivers a set of modular Django apps that cover recurring web platform concerns such as authentication bootstrapping and legal consent management. The toolkit focuses on convention-over-configuration so new projects can enable production-grade defaults with minimal setup.
|
|
34
|
+
|
|
35
|
+
## Table of Contents
|
|
36
|
+
|
|
37
|
+
- [Features](#features)
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [Included Apps](#included-apps)
|
|
40
|
+
- [Quick Start](#quick-start)
|
|
41
|
+
- [Configuration](#configuration)
|
|
42
|
+
- [Requirements](#requirements)
|
|
43
|
+
- [Local Development](#local-development)
|
|
44
|
+
- [Contributing](#contributing)
|
|
45
|
+
- [License](#license)
|
|
46
|
+
- [Project Status](#project-status)
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- Shared utilities that power the higher-level apps (`nside_wefa.common`)
|
|
51
|
+
- Plug-and-play Django REST Framework authentication configuration (token and JWT) (`nside_wefa.authentication`)
|
|
52
|
+
- Legal consent tracking with automatic user onboarding and templated documents (`nside_wefa.legal_consent`)
|
|
53
|
+
- System checks and sensible defaults so configuration mistakes surface early
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
Install the package from PyPI:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install nside-wefa
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or add it to your dependency file (e.g. `requirements.txt`):
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
nside-wefa>=0.1.0
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Included Apps
|
|
70
|
+
|
|
71
|
+
### Common
|
|
72
|
+
|
|
73
|
+
Foundational helpers shared across the toolkit. You rarely interact with it directly, but it must be installed before the other apps.
|
|
74
|
+
|
|
75
|
+
### Authentication
|
|
76
|
+
|
|
77
|
+
Automatically wires Django REST Framework authentication classes, URLs, and dependency checks. See `nside_wefa/authentication/README.md` for the full guide.
|
|
78
|
+
|
|
79
|
+
### Legal Consent
|
|
80
|
+
|
|
81
|
+
Tracks acceptance of privacy and terms documents with templating support and REST endpoints. See `nside_wefa/legal_consent/README.md` for details.
|
|
82
|
+
|
|
83
|
+
## Quick Start
|
|
84
|
+
|
|
85
|
+
1. Install the package.
|
|
86
|
+
2. Add the apps to `INSTALLED_APPS` (order matters):
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
INSTALLED_APPS = [
|
|
90
|
+
# Django + DRF dependencies...
|
|
91
|
+
"rest_framework",
|
|
92
|
+
"rest_framework.authtoken", # For token auth
|
|
93
|
+
"rest_framework_simplejwt", # For JWT auth
|
|
94
|
+
"nside_wefa.common",
|
|
95
|
+
"nside_wefa.authentication",
|
|
96
|
+
"nside_wefa.legal_consent",
|
|
97
|
+
]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Apply migrations:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python manage.py migrate
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
4. Expose the URLs you need:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from django.urls import include, path
|
|
110
|
+
|
|
111
|
+
urlpatterns = [
|
|
112
|
+
# ...your URLs
|
|
113
|
+
path("auth/", include("nside_wefa.authentication.urls")),
|
|
114
|
+
path("legal-consent/", include("nside_wefa.legal_consent.urls")),
|
|
115
|
+
]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Configuration
|
|
119
|
+
|
|
120
|
+
The toolkit reads from a namespaced settings dictionary. Start with the minimal configuration below and extend it as needed:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
# settings.py
|
|
124
|
+
NSIDE_WEFA = {
|
|
125
|
+
"APP_NAME": "My Product", # Used in legal consent templates
|
|
126
|
+
"AUTHENTICATION": {
|
|
127
|
+
"TYPES": ["TOKEN", "JWT"], # Enable the authentication flows you need
|
|
128
|
+
},
|
|
129
|
+
"LEGAL_CONSENT": {
|
|
130
|
+
"VERSION": 1,
|
|
131
|
+
"EXPIRY_LIMIT": 365, # days
|
|
132
|
+
# "TEMPLATES": BASE_DIR / "templates/legal_consent", # Optional overrides
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Validation happens through Django system checks. Run `python manage.py check` to surface configuration issues early.
|
|
138
|
+
|
|
139
|
+
## Requirements
|
|
140
|
+
|
|
141
|
+
- Python >= 3.12
|
|
142
|
+
- Django >= 5.2.6
|
|
143
|
+
- Django REST Framework >= 3.14.0
|
|
144
|
+
- djangorestframework-simplejwt >= 5.5.1 (if you enable JWT support)
|
|
145
|
+
|
|
146
|
+
## Local Development
|
|
147
|
+
|
|
148
|
+
Clone the repository and install the development extras:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd django
|
|
152
|
+
python -m venv .venv
|
|
153
|
+
source .venv/bin/activate
|
|
154
|
+
pip install -e .[dev]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Run the demo project:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python manage.py migrate
|
|
161
|
+
python manage.py runserver
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Execute the test suite and linters:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pytest
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
We welcome feature ideas, bug reports, and pull requests. Check [CONTRIBUTE](CONTRIBUTE.md) for the current workflow (it will be merged with the repo-wide guidelines soon). Please include documentation updates and tests when relevant.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# WeFa Django Toolkit
|
|
2
|
+
|
|
3
|
+
WeFa (Web Factory) delivers a set of modular Django apps that cover recurring web platform concerns such as authentication bootstrapping and legal consent management. The toolkit focuses on convention-over-configuration so new projects can enable production-grade defaults with minimal setup.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Features](#features)
|
|
8
|
+
- [Installation](#installation)
|
|
9
|
+
- [Included Apps](#included-apps)
|
|
10
|
+
- [Quick Start](#quick-start)
|
|
11
|
+
- [Configuration](#configuration)
|
|
12
|
+
- [Requirements](#requirements)
|
|
13
|
+
- [Local Development](#local-development)
|
|
14
|
+
- [Contributing](#contributing)
|
|
15
|
+
- [License](#license)
|
|
16
|
+
- [Project Status](#project-status)
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Shared utilities that power the higher-level apps (`nside_wefa.common`)
|
|
21
|
+
- Plug-and-play Django REST Framework authentication configuration (token and JWT) (`nside_wefa.authentication`)
|
|
22
|
+
- Legal consent tracking with automatic user onboarding and templated documents (`nside_wefa.legal_consent`)
|
|
23
|
+
- System checks and sensible defaults so configuration mistakes surface early
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
Install the package from PyPI:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install nside-wefa
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or add it to your dependency file (e.g. `requirements.txt`):
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
nside-wefa>=0.1.0
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Included Apps
|
|
40
|
+
|
|
41
|
+
### Common
|
|
42
|
+
|
|
43
|
+
Foundational helpers shared across the toolkit. You rarely interact with it directly, but it must be installed before the other apps.
|
|
44
|
+
|
|
45
|
+
### Authentication
|
|
46
|
+
|
|
47
|
+
Automatically wires Django REST Framework authentication classes, URLs, and dependency checks. See `nside_wefa/authentication/README.md` for the full guide.
|
|
48
|
+
|
|
49
|
+
### Legal Consent
|
|
50
|
+
|
|
51
|
+
Tracks acceptance of privacy and terms documents with templating support and REST endpoints. See `nside_wefa/legal_consent/README.md` for details.
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
1. Install the package.
|
|
56
|
+
2. Add the apps to `INSTALLED_APPS` (order matters):
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
INSTALLED_APPS = [
|
|
60
|
+
# Django + DRF dependencies...
|
|
61
|
+
"rest_framework",
|
|
62
|
+
"rest_framework.authtoken", # For token auth
|
|
63
|
+
"rest_framework_simplejwt", # For JWT auth
|
|
64
|
+
"nside_wefa.common",
|
|
65
|
+
"nside_wefa.authentication",
|
|
66
|
+
"nside_wefa.legal_consent",
|
|
67
|
+
]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
3. Apply migrations:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python manage.py migrate
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
4. Expose the URLs you need:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from django.urls import include, path
|
|
80
|
+
|
|
81
|
+
urlpatterns = [
|
|
82
|
+
# ...your URLs
|
|
83
|
+
path("auth/", include("nside_wefa.authentication.urls")),
|
|
84
|
+
path("legal-consent/", include("nside_wefa.legal_consent.urls")),
|
|
85
|
+
]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Configuration
|
|
89
|
+
|
|
90
|
+
The toolkit reads from a namespaced settings dictionary. Start with the minimal configuration below and extend it as needed:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
# settings.py
|
|
94
|
+
NSIDE_WEFA = {
|
|
95
|
+
"APP_NAME": "My Product", # Used in legal consent templates
|
|
96
|
+
"AUTHENTICATION": {
|
|
97
|
+
"TYPES": ["TOKEN", "JWT"], # Enable the authentication flows you need
|
|
98
|
+
},
|
|
99
|
+
"LEGAL_CONSENT": {
|
|
100
|
+
"VERSION": 1,
|
|
101
|
+
"EXPIRY_LIMIT": 365, # days
|
|
102
|
+
# "TEMPLATES": BASE_DIR / "templates/legal_consent", # Optional overrides
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Validation happens through Django system checks. Run `python manage.py check` to surface configuration issues early.
|
|
108
|
+
|
|
109
|
+
## Requirements
|
|
110
|
+
|
|
111
|
+
- Python >= 3.12
|
|
112
|
+
- Django >= 5.2.6
|
|
113
|
+
- Django REST Framework >= 3.14.0
|
|
114
|
+
- djangorestframework-simplejwt >= 5.5.1 (if you enable JWT support)
|
|
115
|
+
|
|
116
|
+
## Local Development
|
|
117
|
+
|
|
118
|
+
Clone the repository and install the development extras:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
cd django
|
|
122
|
+
python -m venv .venv
|
|
123
|
+
source .venv/bin/activate
|
|
124
|
+
pip install -e .[dev]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Run the demo project:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python manage.py migrate
|
|
131
|
+
python manage.py runserver
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Execute the test suite and linters:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pytest
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
We welcome feature ideas, bug reports, and pull requests. Check [CONTRIBUTE](CONTRIBUTE.md) for the current workflow (it will be merged with the repo-wide guidelines soon). Please include documentation updates and tests when relevant.
|
nside_wefa-0.1.0/conf.py
ADDED
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ASGI config for demo project.
|
|
3
|
+
|
|
4
|
+
It exposes the ASGI callable as a module-level variable named ``application``.
|
|
5
|
+
|
|
6
|
+
For more information on this file, see
|
|
7
|
+
https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from django.core.asgi import get_asgi_application
|
|
13
|
+
|
|
14
|
+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "demo.settings")
|
|
15
|
+
|
|
16
|
+
application = get_asgi_application()
|