Skip to content

Releases: Abdenasser/dr_scaffold

v2.1.2

13 Feb 14:28
Compare
Choose a tag to compare
  • minor changes and support for the latest python versions
  • now "created" and "updated" fields will be included in generated models
  • minor bug fixes

thanks to our new contributors @aymaneMx @leogregianin πŸ₯‡

v2.1.1

19 Sep 12:46
07033e2
Compare
Choose a tag to compare

Generates model representation __str__() based on model fields.

we had the option to chose between generating the representation using only the first field and using all the fields, we've chosen the latter because we sometimes prefer to let the developer delete what he doesn't need from a scaffolded output than letting him add things manually while asking why we didn't do that for him 🎁 .

class Person(models.Model):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)

    def __str__(self):
        return '%s %s' % (self.first_name, self.last_name)

v2.1.0

12 Sep 16:24
Compare
Choose a tag to compare

With v2.1.0 you get:

  • added --tests option for generating tests
  • 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

v2.0.2

04 Sep 13:49
Compare
Choose a tag to compare

With v2.0.2 you get:

  • sorted & elegant imports in your generated files πŸ€–
  • better line breaks and code formatting ✨
  • nice colored outputs πŸ’…

v2.0.1

04 Sep 12:20
Compare
Choose a tag to compare

With v2.0.1 you get sorted elegant imports in your generated files out of the box, using the power of isort πŸ€–

v2.0.0

31 Aug 18:18
Compare
Choose a tag to compare

With this version, we added support for ViewSets using Mixins πŸ₯³ πŸŽ‰

  • Customize your ViewSets on the fly with --mixins CRUD ⚑ .
  • To only add Create, Read and Update pass --mixins CRU, generate your view with any action 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:

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)

v1.4.2

29 Aug 02:18
b82a618
Compare
Choose a tag to compare
  • Tested for different API structures πŸ—οΈ
  • Code coverage at 100% again πŸ‘€
  • Improvements by contributors πŸ‘πŸ»
    ...

V1.3.0

28 Aug 01:34
29692a9
Compare
Choose a tag to compare
  • Added CORE_FOLDER and API_FOLDER settings in order to organize code and separate concerns in our APIs:
CORE_FOLDER = "my_core_folder_path/" # you can leave them empty
API_FOLDER = "my_api_folder_path/"   # or set them to be the same
  • Core folder is for models.py admin.py and migrations
  • API folder will contain views.py serializers.py and urls.py

v1.0.1

24 Aug 22:58
Compare
Choose a tag to compare

minor typo fix with URLs

v1.0.0

24 Aug 16:24
Compare
Choose a tag to compare
  • 100 % full test coverage πŸš€
  • Major changes and improvements πŸ‘πŸ»
  • Code quality and linting with pylint βœ…
  • CI/CD with travisCI πŸ†