Git Product home page Git Product logo

Comments (9)

matthiask avatar matthiask commented on August 26, 2024

Hi,

There aren't any concrete plans yet and I haven't played around with custom user models yet, although following their implementation in Django closely.

A useful first step would be to document Plata's current expectations regarding the user model, and then start the discussion where we could remove those dependencies.

Does that sound reasonable?

from plata.

meric avatar meric commented on August 26, 2024

That sounds reasonable.

from plata.

meric avatar meric commented on August 26, 2024

Here's what I got so far:

foreign key to User:
plata/contact/models.py # Contact
plata/shop/models.py # Order

reference to User.email:
plata/contact/admin.py
plata/contact/forms.py # CheckoutForm

reference to User.first_name:
plata/contact/admin.py
plata/contact/forms.py # CheckoutForm

reference to User.last_name:
plata/contact/admin.py
plata/contact/forms.py # CheckoutForm

method to User.is_authenticated:
plata/shop/views.py # Shop.checkout, Shop.order_from_request, Shop.contact_from_user

from plata.

meric avatar meric commented on August 26, 2024

The User.first_name and User.last_name referenced by plata/contact/forms.py is used for storing the user's first and last names in the shop.BillingShippingAddress model's billing_first_name and billing_last_name attributes.

The django documentation specifies all custom user models must implement the method User.get_full_name() and User.get_short_name().

https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.CustomUser

Can those be used instead of first_name and last_name?

The User.email referenced by plata/contact/forms.py is used as a initial value for the CheckoutForm.

One simple solution to removing this dependency could simply be removing the initial value for the form.

The User.is_authenticated looks to be a compulsory method on all user models as well, so that requires no change.

Perhaps foreign keys to User can simply be replaced by settings.AUTH_USER_MODEL.

from plata.

matthiask avatar matthiask commented on August 26, 2024

Wow, thanks!

I don't like the differentiation between first_name and last_name too much, it does not work for some asian countries for example.

Maybe we should modify the order models to only save a full name (billing_full_name and shipping_full_name) -- we don't really care about the distinction between given and family name anyway.

About the email address requirement: The email address is used in many places right now, I'm not sure how we might proceed there without rewriting much code or losing functionality.

from plata.

meric avatar meric commented on August 26, 2024

Yes, I've also found there are places where it uses the users' emails to send notifications to them.

Another idea: implement a system where the developer using plata will need to provide a backend for sending notifications to a user; It could be email, or even a tweet if the developer decided to use Twitter's authentication service. It would required a lot of changes though...

from plata.

meric avatar meric commented on August 26, 2024

Anyway, it looks like the first_name, last_name can be changed to use full_name even for Django 1.4. I might have a go at it soon.

from plata.

matthiask avatar matthiask commented on August 26, 2024

Regarding the backend for emails: Some type of notification backend already exists: The code in plata/shop/notifications.py is only an example, and almost all emails are triggered by sending signals.

The real problem (I see) is the checkout form code...

from plata.

matthiask avatar matthiask commented on August 26, 2024

Can this issue be considered closed?

from plata.

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.