django-ltree icon indicating copy to clipboard operation
django-ltree copied to clipboard

more documentation on how to use this library better?

Open simkimsia opened this issue 5 years ago • 3 comments
trafficstars

I have this exact code snippet and the migration is successful.

from core.models import PersonStampedModel
from django_ltree.fields import PathField
from model_utils.models import SoftDeletableModel, TimeStampedModel
from organizations.managers import OrganizationOwnedSoftDeletableManager
from organizations.models import OrganizationOwnedModel
from partial_index import PQ, PartialIndex


class WorkBreakdownStructure(
    TimeStampedModel, SoftDeletableModel, PersonStampedModel, OrganizationOwnedModel
):
    wbs_number = PathField(primary_key=True, editable=True)

    objects = OrganizationOwnedSoftDeletableManager()

    unique_field_in_organization = "wbs_number"

    def __str__(self):
        return str(self.wbs_number)

    class Meta:
        indexes = [
            PartialIndex(
                fields=["wbs_number", "organization"], unique=True, where=PQ(is_removed=False)
            )
        ]

I wanted to quickly bulk create the following records:

ABC20.12345.50000 - ABC20.12345.51000

I was wondering if there's some documentation on how to do this.

versions

Django: v2.2.9 Python: v3.6 postgres: v10

simkimsia avatar Jan 11 '20 03:01 simkimsia

It would be great to see at least any kind of example usind it.

anomality avatar Feb 16 '21 21:02 anomality

I certainly neglect the documentation, could you give me a list of missing points? what do you think needs to be addressed?

mariocesar avatar Feb 16 '21 21:02 mariocesar

If it's possible, could you provide an example for the model and usage information please? For example, how to import your library in the right way, how to make a model, how to get and set data. As for me, I'm making first steps learning django/python, so it's a bit difficult. Thank you!

anomality avatar Feb 23 '21 06:02 anomality