Commits

Josh VanderLinden committed 935a5a8

#111 - Made it possible for potential affiliates to sign up for an account

Comments (0)

Files changed (1)

 +
 +admin.site.register(Affiliate, AffiliateAdmin)
 +
+diff --git a/satchmo/apps/satchmo_ext/affiliates/forms.py b/satchmo/apps/satchmo_ext/affiliates/forms.py
+new file mode 100644
+--- /dev/null
++++ b/satchmo/apps/satchmo_ext/affiliates/forms.py
+@@ -0,0 +1,9 @@
++from django import forms
++
++from models import Affiliate
++
++class AffiliateForm(forms.ModelForm):
++
++    class Meta:
++        model = Affiliate
++        fields = ('name', 'website', 'paypal_email')
 diff --git a/satchmo/apps/satchmo_ext/affiliates/listeners.py b/satchmo/apps/satchmo_ext/affiliates/listeners.py
 new file mode 100644
 --- /dev/null
 +        return self.filter(is_active=True)
 +
 +class Affiliate(models.Model):
-+    name = models.CharField(max_length=100)
-+    website = models.CharField(max_length=100, help_text="The part of a website's name that will be most recognizable.  For example, use 'google.com' instead of 'www.google.com' here.")
-+    paypal_email = models.EmailField()
++    name = models.CharField('Your Name', max_length=100)
++    website = models.CharField('Your Domain', max_length=100, help_text="The part of a website's name that will be most recognizable.  For example, use 'google.com' instead of 'www.google.com' here.")
++    paypal_email = models.EmailField('Your PayPal Email Address')
 +    percentage_of_sales = models.DecimalField(max_digits=8, decimal_places=2, default='25.00')
 +    commission_paid = models.DecimalField(max_digits=8, decimal_places=2, default='0.00')
 +    is_active = models.BooleanField(blank=True, default=True)
 +
 +<h3>Commission to date: {{ affiliate.total_commission }}</h3>
 +{% endblock %}
+diff --git a/satchmo/apps/satchmo_ext/affiliates/templates/affiliates/affiliate_form.html b/satchmo/apps/satchmo_ext/affiliates/templates/affiliates/affiliate_form.html
+new file mode 100644
+--- /dev/null
++++ b/satchmo/apps/satchmo_ext/affiliates/templates/affiliates/affiliate_form.html
+@@ -0,0 +1,19 @@
++{% extends 'base.html' %}
++
++{% block title %}Affiliate Sign-Up{% endblock %}
++
++{% block content %}
++<h1>Affiliate Sign-Up</h1>
++
++<form action="." method="post">
++{% csrf_token %}
++<table id="affiliate-form">
++{{ form }}
++    <tr>
++        <td colspan="2">
++            <input type="submit" value="Sign Up" />
++        </td>
++    </tr>
++</table>
++</form>
++{% endblock %}
 diff --git a/satchmo/apps/satchmo_ext/affiliates/templates/affiliates/masspay.txt b/satchmo/apps/satchmo_ext/affiliates/templates/affiliates/masspay.txt
 new file mode 100644
 --- /dev/null
 new file mode 100644
 --- /dev/null
 +++ b/satchmo/apps/satchmo_ext/affiliates/urls.py
-@@ -0,0 +1,7 @@
+@@ -0,0 +1,14 @@
 +from django.conf.urls.defaults import *
++
++from forms import AffiliateForm
 +import views
 +
-+urlpatterns = patterns('',
++affiliates = {
++    'form_class': AffiliateForm
++}
++
++urlpatterns = patterns('django.views.generic',
 +    url(r'^(?P<uuid>[0-9a-z]{32})/$', views.affiliate_account, name='affiliate-account'),
++    url(r'^signup/$', 'create_update.create_object', affiliates, name='affiliate-signup'),
 +    url(r'^$', views.affiliate_payout, name='affiliate-payments'),
 +)
 diff --git a/satchmo/apps/satchmo_ext/affiliates/views.py b/satchmo/apps/satchmo_ext/affiliates/views.py