Dr-scaffold

Latest version: v2.1.2

Safety actively analyzes 629994 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

2.1.2

- minor changes and support for latest python versions
- now "created" and "updated" fields will be included in generated models
- minor bug fixes

2.1.0

With v2.1.0 you get:

- we generate **factories** for your models based on factory_boy 🤖
- we generate **tests** for your factories based on Pytest ✨
- we put your core tests under **tests/core/$app_name** and your api tests under **tests/apis/$app_name** 💅

> next version will include API endpoints tests

2.0.2

With v2.0.2 you get:

- sorted & elegant imports in your generated files 🤖
- better line breaks and code formatting ✨
- nice colored outputs 💅

2.0.1

With v2.0.1 you get sorted elegant imports in your generated files out of the box, using the power of `isort` 🤖

2.0.0

With this version, we added support for **ViewSets** using **Mixins** 🥳 🎉

- Customize your ViewSets on the fly with `--mixins CRUD` ⚡ .
- Wanna only support Create, Read and Update ? pass `--mixins CRU`, customize your view in any way you like.
- **C** is for `create` **R** is for `list` and retrieve **U** is `update` and **D** is `destroy` as you might guess.
- One more thing ... we generate your actions along with everything you'd need inside and your get_queryset(), get_object() and more 🚀 🤖 .
- We still **support** ModelViewSets as well, if you want them just drop the `--mixins` option.

here is a ViewSet example generated with the help of `--mixins CR`:

python
class AuthorViewSet(
mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
viewsets.GenericViewSet
):
queryset = Author.objects.all()
serializer_class = AuthorSerializer
permission_classes = (permissions.IsAuthenticated,)

def get_queryset(self):
user = self.request.user
queryset = Author.objects.all()
insert specific queryset logic here
return queryset

def get_object(self):
insert specific get_object logic here
return super().get_object()

def create(self, request, *args, **kwargs):
serializer = AuthorSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
serializer.save()
return Response(serializer.data)

def list(self, request, *args, **kwargs):
queryset = self.get_queryset()
serializer = AuthorSerializer(queryset, many=True)
return Response(serializer.data)

def retrieve(self, request, *args, **kwargs):
instance = self.get_object()
serializer = AuthorSerializer(instance=instance)
return Response(serializer.data)

1.4.2

- Tested for different API structures 🏗️
- Code coverage at 100% again 👀
- Improvements by contributors 👍🏻

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.