-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/6 product types api #14
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
70037f0
move CategoryAdminFormSet super().clean call
Floris272 e56ee40
fix api workflows
Floris272 eb7ddaa
Fix api spec errors
Floris272 8ca1f13
Fix migrations
Floris272 ce1df7f
Switch to nested routers and add patch request back
Floris272 ae0e249
Update product type api tests
Floris272 a5d751f
Add category api tests
Floris272 a67256e
Lint
Floris272 5a1042a
Add Condition, tag & tag type endpoints
Floris272 b52b65f
Add condition, tag & tag type api tests
Floris272 34a7c74
Add feedback
Floris272 3a7b8f0
fix and rename check_for_duplicates_in_array
Floris272 e8af619
Update src/open_producten/utils/tests/test_serializer_utils.py
Floris272 be49dd2
rebase
Floris272 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
39 changes: 37 additions & 2 deletions
39
...types/migrations/0003_alter_field_type.py → ...y_alter_question_product_type_and_more.py
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
29 changes: 29 additions & 0 deletions
29
src/open_producten/producttypes/migrations/0004_alter_priceoption_amount.py
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.13 on 2024-08-30 13:33 | ||
|
||
from decimal import Decimal | ||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
( | ||
"producttypes", | ||
"0003_alter_question_category_alter_question_product_type_and_more", | ||
), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="priceoption", | ||
name="amount", | ||
field=models.DecimalField( | ||
decimal_places=2, | ||
help_text="The amount of the price option", | ||
max_digits=8, | ||
validators=[django.core.validators.MinValueValidator(Decimal("0.01"))], | ||
verbose_name="Price", | ||
), | ||
), | ||
] |
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
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from django.urls import include, path | ||
|
||
from rest_framework_nested.routers import DefaultRouter, NestedSimpleRouter | ||
|
||
from open_producten.producttypes.views import ( | ||
CategoryQuestionViewSet, | ||
CategoryViewSet, | ||
ConditionViewSet, | ||
ProductTypeFieldViewSet, | ||
ProductTypeLinkViewSet, | ||
ProductTypePriceViewSet, | ||
ProductTypeQuestionViewSet, | ||
ProductTypeViewSet, | ||
TagTypeViewSet, | ||
TagViewSet, | ||
) | ||
|
||
ProductTypesRouter = DefaultRouter() | ||
ProductTypesRouter.register("producttypes", ProductTypeViewSet, basename="producttype") | ||
|
||
ProductTypesLinkRouter = NestedSimpleRouter( | ||
ProductTypesRouter, "producttypes", lookup="product_type" | ||
) | ||
ProductTypesLinkRouter.register( | ||
r"links", ProductTypeLinkViewSet, basename="producttype-link" | ||
) | ||
|
||
ProductTypesPriceRouter = NestedSimpleRouter( | ||
ProductTypesRouter, "producttypes", lookup="product_type" | ||
) | ||
ProductTypesPriceRouter.register( | ||
r"prices", ProductTypePriceViewSet, basename="producttype-price" | ||
) | ||
|
||
ProductTypesQuestionRouter = NestedSimpleRouter( | ||
ProductTypesRouter, "producttypes", lookup="product_type" | ||
) | ||
ProductTypesQuestionRouter.register( | ||
r"questions", ProductTypeQuestionViewSet, basename="producttype-question" | ||
) | ||
|
||
ProductTypesFieldRouter = NestedSimpleRouter( | ||
ProductTypesRouter, "producttypes", lookup="product_type" | ||
) | ||
ProductTypesFieldRouter.register( | ||
r"fields", ProductTypeFieldViewSet, basename="producttype-field" | ||
) | ||
|
||
ProductTypesRouter.register("categories", CategoryViewSet, basename="category") | ||
|
||
CategoriesQuestionRouter = NestedSimpleRouter( | ||
ProductTypesRouter, "categories", lookup="category" | ||
) | ||
CategoriesQuestionRouter.register( | ||
r"questions", CategoryQuestionViewSet, basename="category-question" | ||
) | ||
|
||
ProductTypesRouter.register("conditions", ConditionViewSet, basename="condition") | ||
ProductTypesRouter.register("tags", TagViewSet, basename="tag") | ||
ProductTypesRouter.register("tagtypes", TagTypeViewSet, basename="tagtype") | ||
|
||
product_type_urlpatterns = [ | ||
path("", include(ProductTypesRouter.urls)), | ||
path("", include(ProductTypesLinkRouter.urls)), | ||
path("", include(ProductTypesPriceRouter.urls)), | ||
path("", include(ProductTypesQuestionRouter.urls)), | ||
path("", include(ProductTypesFieldRouter.urls)), | ||
path("", include(CategoriesQuestionRouter.urls)), | ||
] |
File renamed without changes.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nog heel even voor mijn begrip: wat moet ik me voorstellen bij een
TagType
? Voelt een beetje als een tag op een tag, was even benieuwd naar de use-case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ja klopt dat is het eigenlijk ook. Het komt vanuit Open Inwoner omdat het mij handig leek om de modellen zo veel mogelijk overeen te laten komen voor de integratie straks. Maar er zou ook gewoon één type aan alle tags vanuit Open producten worden gelinkt waardoor het hier weg zou kunnen.