Giter VIP home page Giter VIP logo

Comments (4)

codingjoe avatar codingjoe commented on September 25, 2024

True, Widgets would have been better, or even a field using that widgets and joins all input.

But I guess this repo is dead. I might fork it an continue working on it, but I would need @mthornhill to change the license. I prefer MIT over BSD.

from django-postal.

mthornhill avatar mthornhill commented on September 25, 2024

Hi CodingJoe,
Widgets sounds like a good idea, if you can implement this, I would be happy to accept a pull request, I can change the license to MIT in the meantime.
Thanks
Michael

from django-postal.

codingjoe avatar codingjoe commented on September 25, 2024

Ok, lets talks about this a little more, shall we?

There are different approaches to solve this issue.

First would be the usage of a single models.CharField and a Widget that splits and joins the single forms.Field.
I don't really like this idea. I know it has been done this way before in many cases but it violates the ACID paradigm and 1NF for not being atomic.

Second would be to have an abstract postal super class that includes all required fields and you can just add fields. That would allow each entity to a distinct postal address.
That's nice but only meets 1NF and doesn't allow [1:N] but [1:1] entity address relations.
What about objects that have more than one address? Like a customer with a billing and shipping address?

I would go with a different approach, that doesn't even require too much change to the existing code.

I would create a base model for addresses that the address form extends. Than I would create a field that would inherit models.ForeignKey or even models.ManyToManyField and at could be attached to a Widget that would handle saving address to a different db-table and setting the foreign key or ManyToMay.
That way users could just drop a PostalField into their code and the rest would be done in the background.
This solution would be 2NF conform and allow [n:n] realtions between addresses and entities.
On the other hand this solution would require users to always include names into the address, but we could maybe pass that to the widget.

What do you think? I'd be starting working on that tomorrow.

from django-postal.

codingjoe avatar codingjoe commented on September 25, 2024

codingjoe/django-postal@7f67de5

I wrote a base for future implementation right here. It doesn't really cover all the functionality but it's a start.

from django-postal.

Related Issues (4)

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.