Skip to main content

AX3 mixins

Mixins for use into the AX3 tech stack.

AjaxRequestMixin

Useful when you need a view only for AJAX queries:

from ax3_mixins import mixins

class AjaxView(mixins.AjaxRequestMixin, View):
    def post(self, request, *args, **kwargs):
        # Only get here if was called by an AJAX request.
        ...

SlugIdMixin

Allows a view to support smart urls with slug and ids.

At urls use:

path('leer/<slug:slugid>/', views.PageDetailView.as_view(), name='page_detail'),

At views use:

from ax3_mixins import mixins

class PageDetailView(mixins.SlugIdMixin):
    template_name = 'app/page_detail.html'
    queryset = Page.objects.filter(is_active=True)

At models use:

def get_absolute_url(self):
    return reverse('page_detail', args=[f'{self.slug}-{self.id}'])

This mixin will get the object using the id and redirect to the current object slug if is different from the URL. It will add the object to the template context.

Release files for AX3-Mixins 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AX3-Mixins 1.0.1
File Size Uploaded
AX3 Mixins-1.0.1.tar.gz 2.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for AX3-Mixins 1.0.1
File Interpreter ABI Platform
AX3_Mixins-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / AX3 Mixins-1.0.1.tar.gz

Download URL AX3 Mixins-1.0.1.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a04ae1690eb5a35771a0448368788d5f6ed2e920ea7c19b51ef662f8548b74ed
BLAKE2b-256 checksum
How to use checksums
df7bac470ff293ab59365a934025b8504e8ead20a15ad59ff4ae1c4d44654695
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release files / AX3_Mixins-1.0.1-py3-none-any.whl

Download URL AX3_Mixins-1.0.1-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b247cb08e3a9f72251b81338aab93d1aa1068e6b55ef900fb1612482138cd23
BLAKE2b-256 checksum
How to use checksums
732554a96c7d6d7b1e803085f8acbb1165de8e56263455fc602a922f5ff3c917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page