Giter Club home page Giter Club logo

Comments (11)

leetrout avatar leetrout commented on July 28, 2024

I'm 90% sure that method would have to be added since you're using a custom model. I'll double check later today.

from django-zebra.

zetas avatar zetas commented on July 28, 2024

Thanks, I really appreciate you getting back to me, i have a deadline to get this billing module completed by this weekend and I'm running into a brick wall. Already spent 4 days with django-stripe-payments just to toss it for lack of docs and move onto this.

from django-zebra.

leetrout avatar leetrout commented on July 28, 2024

https://docs.djangoproject.com/en/1.5/ref/settings/#std:setting-AUTH_PROFILE_MODULE

Looks like you can just toss it on there- django isn't going to use it internally.

Try something like:

def get_profile(self):
    return self

and see if that works...

from django-zebra.

zetas avatar zetas commented on July 28, 2024

Ok, i added that method to the WUser class and after submitting the charge form again I get this error:

AttributeError at /account/upgrade/
'WUser' object has no attribute 'stripe_customer_id'

from django-zebra.

zetas avatar zetas commented on July 28, 2024

Should I just add the attributes as they error out or use a mixin? I'm still a new django dev so I'm a little shaky on the best practice here.

Thanks again for your time.

from django-zebra.

leetrout avatar leetrout commented on July 28, 2024

Try class WUser(AbstractBaseUser, StripeMixin) where StripeMixin is from zebra.mixins import StripeMixin.

You might also try class WUser(AbstractBaseUser, ZebraMixin) which is the "kitchen sink".

from django-zebra.

leetrout avatar leetrout commented on July 28, 2024

And look through https://github.com/GoodCloud/django-zebra/blob/master/zebra/mixins.py

I don't know why our autodocs didn't pick up all the docstrings but they're there.

from django-zebra.

zetas avatar zetas commented on July 28, 2024

Ok, I tried both mixins, nothing changed, still complaining about a lack of stripe_customer_id. The StripeMixin says it provides a stripe attribute but it doesn't provide stripe_customer_id which seems to be needed at the profile level.

I went ahead and added it with the following settings to the WUser class:

class WUser(AbstractBaseUser, StripeMixin):
    #...
    stripe_customer_id = models.PositiveIntegerField(null=True, blank=True)

Now I get this error when trying to post the credit card form:

InvalidRequestError at /account/upgrade/
Could not determine which URL to request: Customer instance has invalid ID: None

from django-zebra.

leetrout avatar leetrout commented on July 28, 2024

My bad- That should be WUser(AbstractBaseUser, StripeCustomer) using from zebra.models import StripeCustomer

https://github.com/GoodCloud/django-zebra/blob/master/zebra/models.py

from django-zebra.

zetas avatar zetas commented on July 28, 2024

I removed the stripe_customer_id i put in the WUser class and changed to subclass StripeCustomer as you suggest. I still get the same error as before, the "Customer instance has invalid ID: None".

I feel like I'm doing something wrong, maybe I didn't set it up right. Also, this is my first attempt to get Zebra working with a brand new billing system, here's the template contents just in case it helps:

{% extends 'base.html' %}
{% load zebra_tags %}

{% block static_content %}
    {{ block.super }}
    {% zebra_head_and_stripe_key %}
{% endblock %}

{% block content %}
    <div class="body_container_info">
        <div class="body">
                    {% zebra_card_form %}
                <div id="checkout_confirm">
                </div>
            </div>
        </div>
    </div>
{% endblock %}

from django-zebra.

zetas avatar zetas commented on July 28, 2024

As I've been digging into this, I started looking at the Stripe Python Library and it looks like it may be easier to implement the library by itself rather than using an abstraction layer like zebra. The two I've tried so far have been extremely uncooperative in my setup which tells me either they are pretty fragile libraries or I'm using some weird edge case environment, what with the custom user model.

I'll leave this issue open for a bit to see if anyone has any thoughts as to how to get it working with my environment, if it's even possible; just to provide an answer to others that may be having or have this issue in the future.

I want to personally thank @leetrout for helping me work through this 👍

from django-zebra.

Related Issues (17)

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.