GithubHelp home page GithubHelp logo

Comments (4)

RadoRado avatar RadoRado commented on August 15, 2024 1

@masdot πŸ‘‹

Can you expand a little bit more - perhaps with an example of what you are trying to achieve, so I can help you better?

Cheers!

from django-styleguide.

masdot avatar masdot commented on August 15, 2024

@RadoRado 🀝

Yes, of course! Sorry if I have expressed myself inaccurately.

I need some kind of custom ID or numbering for my project. This needs to be built according to the scheme <year><ascending number>.

This numbering is based on the records, which means that the creation date of the record is the basis for generating the numbering. For example, the records in 2020 are

20200001 - 202100563.

and in 2021

20210001, 20210002, ...

However, I see it somewhat critical to solve this numbering via a
@Property since this probably affects the scalability.

from django-styleguide.

RadoRado avatar RadoRado commented on August 15, 2024

@masdot Sorry for the late answer! Catching up with the issues.

This sounds more like a database field and not a property.

And in order to generate sequential numbers, you might want to look into some kind of table locking or using F expressions ( https://docs.djangoproject.com/en/3.2/ref/models/expressions/#f-expressions )

Especially if you want to search or sort by those ids.

If you need them just for visual purposes, then a @property would do.

Hope that helps!

from django-styleguide.

masdot avatar masdot commented on August 15, 2024

Thank you! πŸ™

from django-styleguide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.