Skip to content

Commit 3c1ed3a

Browse files
committed
update
1 parent 413ce84 commit 3c1ed3a

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ INSTALLED_APPS = [
5050
---
5151

5252
## Usage
53-
TODO
53+
(TODO)
5454

5555
---
5656

@@ -68,7 +68,7 @@ TODO
6868
- Ownership-based object access control
6969
- Field-level validation before save/update
7070
- Built-in file handling for `ArrayField`-based file storage
71-
- Easy integration with both local and S3-based file systems
71+
- Built-in integration with both local and S3-based file systems
7272

7373

7474
### Full Model Example Using `SwiftBaseModel`
@@ -337,7 +337,7 @@ urlpatterns = [
337337
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
338338
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
339339
```
340-
That's it! Thanks to [ninja](https://django-ninja.dev/) & [ninja-extra](https://eadwincode.github.io/django-ninja-extra/), now you can see the auto-generated documentation in http://127.0.0.1:8000/api/docs.
340+
That's it! Thanks to [ninja](https://django-ninja.dev/) & [ninja-extra](https://eadwincode.github.io/django-ninja-extra/), now you can see the auto-generated documentation at http://127.0.0.1:8000/api/docs.
341341

342342
---
343343

@@ -346,7 +346,7 @@ Easier than ever!
346346

347347
### File Configuration
348348

349-
Configure file-handling from inside your [model's file configuaration](#file-handling-example), specify a few attributes in setings.py and that's it! No extra work, no nothing. All CRUD functionalities (uploads, downloads, deletiions etc) including authentications, permissions, individual-accesses are handled automatically by `django-swiftapi`.
349+
Configure file-handling from inside your [model's file configuration](#file-handling-example), specify a few attributes in setings.py and that's it! No extra work, no nothing. All CRUD functionalities (uploads, downloads, deletions etc) including authentications, permissions, individual-accesses are handled automatically by `django-swiftapi`.
350350

351351
In settings.py, just specify according to your needs. `django-swiftapi` will use these directories to write or remove files:
352352
```
@@ -378,7 +378,7 @@ The system automatically provides these file operations:
378378
### File Access Control
379379

380380
- **Public files**: Accessible without authentication
381-
- **Private files**: Require authentication and ownership verification
381+
- **Private files**: Require authentication and if specified, ownership verification
382382

383383
### Using Your Own Validation
384384
It's super easy. Just define a function (`django-swiftapi` supports both sync & async) and put it into the dictionary variable `validator_funcs` like this:
@@ -475,6 +475,8 @@ class custom_storage_class(BaseStorage):
475475
### Using Built-in Authentication Classes
476476

477477
```python
478+
from ninja_extra import api_controller
479+
from django_swiftapi.modelcontrol.modelcontrollers.base import SwiftBaseModelController
478480
from django_swiftapi.modelcontrol.authenticators.django_allauth import djangoallauth_userauthentication
479481

480482
# Using allauth authentication
@@ -487,6 +489,8 @@ class MyController(SwiftBaseModelController):
487489

488490
```python
489491
from ninja_extra import api_controller, permissions
492+
from django_swiftapi.modelcontrol.modelcontrollers.base import SwiftBaseModelController
493+
from django_swiftapi.modelcontrol.authenticators.django_allauth import djangoallauth_userauthentication
490494

491495
@api_controller("/api", permissions=[djangoallauth_userauthentication()])
492496
class MyController(SwiftBaseModelController):
@@ -495,7 +499,7 @@ class MyController(SwiftBaseModelController):
495499
create_custom_permissions_list = [permissions.AllowAny]
496500
```
497501

498-
As simple as that! You can enable this functionality for others too or you can incorporate your own authentication classes for each operation, using:
502+
As simple as that! You can enable this functionality for others too or you can incorporate your own customized authentication classes for each operation, using:
499503
```python
500504
retrieve_one_custom_permissions_list: list = []
501505
filter_custom_permissions_list: list = []
@@ -505,9 +509,9 @@ files_remove_custom_permissions_list: list = []
505509
delete_custom_permissions_list: list = []
506510
```
507511

508-
### Enable object-level permissions
512+
### Enabling Object-Level Permissions
509513

510-
If you wish to give specific object permissions like only the creator of that object can `rerieve`, `filter`, `update`, `remove` or `delete` that object, you can do so like this:
514+
If you wish to give object-specific permissions like only the creator of that object can `rerieve`, `filter`, `update`, `remove` or `delete` that object, you can do so like this:
511515
```python
512516
retrieve_one_obj_permission_check = True
513517
filter_obj_permission_check = True
@@ -520,6 +524,8 @@ delete_obj_permission_check = True
520524
Example:
521525

522526
```python
527+
from django_swiftapi.modelcontrol.modelcontrollers.base import SwiftBaseModelController
528+
523529
class DocumentController(SwiftBaseModelController):
524530
retrieve_one_obj_permission_check = True # Only owner can retrieve
525531
update_obj_permission_check = True # Only owner can update

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='django_swiftapi',
5-
version='0.1.8',
5+
version='0.1.9',
66
description='Easy to use django package for building APIs quicker than ever, built on top of django-ninja-extra',
77
long_description=open('README.md').read(),
88
long_description_content_type='text/markdown',
@@ -16,7 +16,6 @@
1616
'ninja-schema',
1717
'django-ninja-extra',
1818
'django-allauth',
19-
'phonenumbers',
2019
'boto3',
2120
'asgiref',
2221
'Pillow',

0 commit comments

Comments
 (0)