
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
django-splint-kovs is a tool for projects with django framework, here you will find some basic settings for your models, views, serializers and adminitrators. This package assumes you have already started a project with django framework, otherwise see Getting started with Django
pip install django-splint-kovs
SplintViewSet (Splint version of DRF GenericViewSet):
SplintModelViewSet (Splint version of DRF ModelViewSet)
This a simple class to django views, you can use it by simply inheriting it in your views.
class StudentViewSet(SplintViewSet, ...):
with this you have set some custom attributes to the class, for example:
class StudentViewSet(SplintViewSet, ...):
serializer_class = StudentSerializer # serializer default
# Custom serializers
read_serializer_class = StudentRetrieveSerializer # serializer to retrieve action
list_serializer_class = StudentListSerializer # serializer to list action
write_serializer_class = StudentWriteSerializer # serializer to create, destroy and update actions
SplintModel:
This class is an example base model, it contains some generic attributes that can be very useful, such as fields that save the creation, update and deletion date of records. With that, we don't need to worry about creating these fields manually for each of our models.
Another utility:
__original_{field_name}
in local cache before any actions (save, deleted) as also signals flow.Usage:
class StudentModel(SplintModel):
name: ..
Student.objects.create(name='first student')
# Student fields
{
id: 1,
name: 'first student',
created_at: <DateTime>,
updated_at: <DateTime>,
_deleted: False,
_deleted_at: <Datetime>
}
students = Student.objects.all()
students.delete() # this objects has not been deleted completely, it will only be invisible to objects manage default.
s_with_deleted = Student.objects_with_deleted.filter(_deleted=True) # list of "deleted" students.
SplintImageField:
This class provide image width, height (at least one dim) and quality to resize image using PIL. Vertical crop images will be applied before resizing the image, you can use it by simply seting in your models fields.
class StudentModel(SplintModel):
profile_picture = SplintImageField('Profile picture', upload_to='student', width=120, ...)
...
splint_cached_property:
This class a sample decorator for saves properties values in cache services, for details on how to configure access to topics cache in django docs https://docs.djangoproject.com/en/4.0/topics/cache/
class StudentModel(SplintModel):
...
def studentgroups_actives__cache_key(self):
return sha224(f'{self.id}'.encode()).hexdigest()
@splint_cached_property
def studentgroups_actives(self):
...
by default this class will look for a function with pattenr {property_name}__cache_key
that returns a text representing a key, this key will be used to retrieve the value later.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Distributed under the MIT License. See LICENSE
for more information.
FAQs
Simple package with utilities for projects with Django Framework
We found that django-splint-kovs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.