-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom User Model Breaking Profile Functionality #34
Comments
I'm 90% sure that method would have to be added since you're using a custom model. I'll double check later today. |
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. |
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:
and see if that works... |
Ok, i added that method to the WUser class and after submitting the charge form again I get this error:
|
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. |
Try You might also try |
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. |
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:
|
My bad- That should be https://github.com/GoodCloud/django-zebra/blob/master/zebra/models.py |
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 %} |
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 👍 |
With Django 1.5 the profile functionality was deprecated in favor of the new custom user model implementation. In my app, I'm using a custom user model for authentication. Currently I'm using Django 1.6.2
When trying to run the example code for stripe:
I get an exception saying my custom user model doesn't have the method "get_profile()". Do I need to add some mixins to my user class or just use a profile model anyway?
Here's a copy of my user model and it's manager just in case, note the inclusion of data that would normally be in the profile:
The text was updated successfully, but these errors were encountered: