-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style(pre-commit): perform pre commit to style codes
- Loading branch information
1 parent
d375343
commit bcb0979
Showing
21 changed files
with
171 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .expense import ExpenseSerializer | ||
from .category import CategorySerializer | ||
from .column import ColumnSerializer | ||
from .item import ItemSerializer | ||
from .expense import ExpenseSerializer | ||
from .invoice import InvoiceSerializer | ||
from .item import ItemSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,20 @@ | ||
# serializers.py | ||
from rest_framework import serializers | ||
|
||
from sage_invoice.models import Category | ||
|
||
|
||
class CategorySerializer(serializers.HyperlinkedModelSerializer): | ||
url = serializers.HyperlinkedIdentityField( | ||
view_name='category-detail', | ||
lookup_field='slug' | ||
view_name="category-detail", lookup_field="slug" | ||
) | ||
invoices = serializers.HyperlinkedRelatedField( | ||
many=True, | ||
view_name='invoice-detail', | ||
lookup_field='slug', | ||
read_only=True | ||
many=True, view_name="invoice-detail", lookup_field="slug", read_only=True | ||
) | ||
|
||
class Meta: | ||
model = Category | ||
fields = ( | ||
"url", | ||
"title", | ||
"description", | ||
"invoices" | ||
) | ||
fields = ("url", "title", "description", "invoices") | ||
extra_kwargs = { | ||
'url': {'lookup_field': 'slug'}, | ||
} | ||
"url": {"lookup_field": "slug"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
from rest_framework import serializers | ||
|
||
from sage_invoice.models import Column | ||
|
||
|
||
class ColumnSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = Column | ||
fields = '__all__' | ||
fields = "__all__" | ||
lookup_field = "id" | ||
extra_kwargs = { | ||
'url': {'lookup_field': 'id'}, | ||
'invoice': {'lookup_field': "slug"}, | ||
'item': {'lookup_field': "id"}, | ||
} | ||
"url": {"lookup_field": "id"}, | ||
"invoice": {"lookup_field": "slug"}, | ||
"item": {"lookup_field": "id"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# serializers.py | ||
from rest_framework import serializers | ||
|
||
from sage_invoice.models import Expense | ||
|
||
|
||
class ExpenseSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = Expense | ||
fields = '__all__' | ||
fields = "__all__" | ||
lookup_field = "id" | ||
extra_kwargs = { | ||
'url': {'lookup_field': 'id'}, | ||
'invoice': {'lookup_field': "slug"} | ||
} | ||
"url": {"lookup_field": "id"}, | ||
"invoice": {"lookup_field": "slug"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
# serializers.py | ||
from rest_framework import serializers | ||
|
||
from sage_invoice.models import Item | ||
|
||
|
||
class ItemSerializer(serializers.HyperlinkedModelSerializer): | ||
class Meta: | ||
model = Item | ||
fields = '__all__' | ||
fields = "__all__" | ||
lookup_field = "id" | ||
extra_kwargs = { | ||
'url': {'lookup_field': 'id'}, | ||
'invoice': {'lookup_field': "slug"} | ||
"url": {"lookup_field": "id"}, | ||
"invoice": {"lookup_field": "slug"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
from django.urls import path, include | ||
from django.urls import include, path | ||
from rest_framework.routers import DefaultRouter | ||
|
||
from .views import ( | ||
CategoryViewSet, | ||
ColumnViewSet, | ||
ExpenseViewSet, | ||
InvoiceViewSet, | ||
ItemViewSet, | ||
CategoryViewSet, | ||
ColumnViewSet | ||
) | ||
|
||
router = DefaultRouter() | ||
router.register(r'expenses', ExpenseViewSet) | ||
router.register(r'invoices', InvoiceViewSet) | ||
router.register(r'items', ItemViewSet) | ||
router.register(r'categories', CategoryViewSet) | ||
router.register(r'columns', ColumnViewSet) | ||
router.register(r"expenses", ExpenseViewSet) | ||
router.register(r"invoices", InvoiceViewSet) | ||
router.register(r"items", ItemViewSet) | ||
router.register(r"categories", CategoryViewSet) | ||
router.register(r"columns", ColumnViewSet) | ||
|
||
urlpatterns = [ | ||
path('', include(router.urls)), | ||
path("", include(router.urls)), | ||
] |
Oops, something went wrong.