Skip to main content

Django Query View

Django view for querying data

Installation

To get the latest stable release from PyPi

pip install django-query-view

Usage

Set up models

from django.db import models
from taggit.managers import TaggableManager
from taggit.models import TaggedItemBase
from query_view.models import TypedTag
from query_view.models import make_typed_tag_tagged_model

class TaggedThing(TaggedItemBase):
    content_object = models.ForeignKey('Thing', on_delete=models.CASCADE)


class Thing(models.Model):
    name = models.CharField(max_length=200)
    is_good = models.BooleanField()

    tags = TaggableManager(through=TaggedThing, blank=True)

    def __str__(self):
        return self.name

# Subclass TypedTag
class ActorTypedTag(TypedTag):
    pass

# Create your tagged model like this
ActorTaggedThing = make_typed_tag_tagged_model('ActorTaggedThing', ActorTypedTag, Thing, app_label='testproject')

# Or like this
class ActorTaggedThing(TaggedItemBase):
    typed_tag = models.ForeignKey(
        ActorTypedTag,
        related_name="%(app_label)s_%(class)s_items",
        on_delete=models.CASCADE,
    )
    content_object = models.ForeignKey(Thing, on_delete=models.CASCADE)

    class Meta:
        unique_together = ['typed_tag', 'content_object']

Create a typed tagged item

t = Tag.objects.get(name='clint eastwood')
ActorTaggedThing.objects.create(content_object=thing, typed_tag=t.actortypedtag)

Run the test project

python manage.py migrate
python manage.py loaddata testproject/fixtures/tag_thing.json
python manage.py runserver

Dump fixture

python manage.py dumpdata --indent 4 testproject.Thing testproject.TaggedThing taggit.Tag testproject.LanguageTypedTag testproject.LanguageTaggedThing testproject.DirectorTypedTag testproject.DirectorTaggedThing testproject.ActorTypedTag testproject.ActorTaggedThing --output testproject/fixtures/tag_thing.json

Metadata

Release files for django-query-view 0.1.6

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

Source distribution (sdist)

Source distribution for django-query-view 0.1.6
File Size Uploaded Provenance Actions
django_query_view-0.1.6.tar.gz 4.5 kB Without provenance Details for django_query_view-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-query-view 0.1.6
File Interpreter ABI Platform Actions
django_query_view-0.1.6-py3-none-any.whl Python 3 none any Details for django_query_view-0.1.6-py3-none-any.whl

Total release size: 10.6 kB

Release files / django_query_view-0.1.6.tar.gz

Download URL django_query_view-0.1.6.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0e92b0217b1cfc77ed0cbaa99ef027523657d20640fd31eece100a14c976cd24
BLAKE2b-256 checksum
How to use checksums
17459899551628be000fa9a23f0f502df500b54f51f445cf1a5526b2045ba991
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.18 Darwin/22.6.0

Release files / django_query_view-0.1.6-py3-none-any.whl

Download URL django_query_view-0.1.6-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bae9f82c58ef9d7f5560954958b3a34391530dd2f5b11ffca2dbfb3569c4662c
BLAKE2b-256 checksum
How to use checksums
1f50a49f17a4ae8df9b6c89ed9f9751327f1a386dbef451042e757dbdbab6c13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.9.18 Darwin/22.6.0

Security for django-query-view 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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