Skip to content

Commit

Permalink
now i start to work on the action functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
ruixia committed Dec 24, 2011
1 parent 96b9e8c commit e5e416c
Show file tree
Hide file tree
Showing 18 changed files with 121 additions and 13 deletions.
Binary file modified .DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions competitor-analysis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
referralcandy

pros:
- good ui
- branding
- logo along with email

- the email that includes referral message/code, facebook, twitter buttons is deliveried after purchase. we could have sending email api after certain action is triggered.
- it also sends email to reward referrals once his referral code has been used.



cons:
- it's an ecommerce based service. all clients are online sellers and associated with some online shopping platforms.
- it takes a big cut of sales plus monthly fee
Binary file modified templates/.DS_Store
Binary file not shown.
6 changes: 5 additions & 1 deletion templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@
{% for l in ls%}
<tr>
<td>{{ l.identifier }}</td>
<td>{{ l.num }} <span class="label notice" id="{{l.id}}">detail</span></td>
<td>{{ l.num }}
{% if l.num > 0 %}
<span class="label notice" id="{{l.id}}">detail</span>
{% endif %}
</td>
<td>
<div><a href="http://wordout.me/{{l.code}}">wordout.me/{{ l.code }}</a></div>
<div>{{ l.redirect_link }}</div>
Expand Down
61 changes: 61 additions & 0 deletions todo.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
new features and implementation
- click is the higher level of all the actions
- I will send click_id along with the redirect link. i.e. textyard.com/?woclickid=xxxxxxx
- the customer will store this id and eventually send it along with the actions

DB change
- Action_type table: my client defines all the actions along with points
- id
- Customer_id
- action_name
- description
- enabled
- created

- Actions: the actual api request sent by my client
- id
- click_id
- actions_id
- description
- created

- Customer table will have two keys. client_key and api_key. client key is used for the iframe. api key is used for the api request.

- the request is like: api.wordout.me/?
api_key=XXXXXXXX&
woclickid=XXXXXXX&
action=STRING&
description=XXXXXXXXX&
code=XXXXXX
{response: {Status: ok/fail, Message: SUCCESS OR ERROR MESSAGE}}

- "Compose codes" is going to be "Add users"
- "Edit links" is going to be "Edit"
- "Disable" button
- check box at the front of User ID (version 2)
- select all method (version 2)


- pages
- dashboard page is the anaylisis table that includes "ADD USERS", "CHANGE LINKS", "DISABLE", user_id, link, clicks, other actions, enable, pagination
- page plugin
- instruction on how to implement the iframe. basically, give client key along with user id
- api
- first define actions
- give instruction on how to send http request to our server

- other statistics page, includes clicks by referrer
- my keys
- client key
- api key

- user_id 0 should be a test code


- show action tables on the iframe. no need to record any points






- we don't want to store proxy ip
- fix my parse http issue if there is
- need write the api page.
Expand Down
Binary file added wordout/.models.py.swp
Binary file not shown.
Binary file removed wordout/.views.py.swp
Binary file not shown.
10 changes: 8 additions & 2 deletions wordout/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

#question: do I need a form to validate all inputs from my redirect_page?

class NumericIdenForm(forms.Form):
class NumericIdentForm(forms.Form):
start = forms.IntegerField()
end = forms.IntegerField()
redirect_link = forms.URLField()

def __init__(self, user=None, *args, **kwargs):
super(NumericIdenForm, self).__init__(*args, **kwargs)
super(NumericIdentForm, self).__init__(*args, **kwargs)
self._user = user

def clean_start(self):
Expand Down Expand Up @@ -84,3 +84,9 @@ def clean_email(self):
return email
raise forms.ValidationError('Email is already taken')


class ValidateReferrer(forms.Form):
referrer = forms.URLField()

class ValidateIP(forms.Form):
ip = forms.IPAddressField()
Binary file modified wordout/forms.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified wordout/migrations/0009_auto__add_unique_customer_client_id.pyc
Binary file not shown.
Binary file not shown.
33 changes: 25 additions & 8 deletions wordout/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ class Customergroups(models.Model):
def __unicode__(self):
return str(self.id)

def get_default_customergroup():
return Customergroups.objects.get(id=1) #set default customergroup for new customer

def get_or_create_link(url):
result = urlparse(url)

Expand All @@ -65,10 +68,11 @@ def get_or_create_link(url):

class Customer(models.Model):
user = models.OneToOneField(User)
client_id = models.CharField(max_length = 9, unique=True)
client_key = models.CharField(max_length = 9, unique=True)
api_key = models.CharField(max_length = 9, unique=True)
message_title = models.CharField(max_length = 200, null=True, blank=True)
message_body = models.TextField(null=True, blank=True)
customergroup = models.ForeignKey(Customergroups)
customergroup = models.ForeignKey(Customergroups, default=get_default_customergroup())

def __unicode__(self):
return str(self.user)
Expand Down Expand Up @@ -181,23 +185,36 @@ def display_path(self, host_id):
''', (self.id, host_id))
return dictfetchall(cursor)

class Identifiers(models.Model):
class Sharers(models.Model):
customer = models.ForeignKey(Customer)
identifier = models.IntegerField(max_length = 10)
sharerid = models.IntegerField(max_length = 10)
code = models.CharField(max_length = 8, unique = True, db_index = True)
redirect_link = models.ForeignKey(Full_Link, related_name='identifier_redirect_link')
redirect_link = models.ForeignKey(Full_Link, related_name='sharer_redirect_link')
enabled = models.BooleanField(default = True)
modified = models.DateTimeField(auto_now = True)
created = models.DateTimeField(auto_now_add = True)

def __unicode__(self):
return self.code

class Request(models.Model):
referral_code = models.ForeignKey(Identifiers)
redirect_link = models.ForeignKey(Full_Link, related_name='request_redirect_link')
class Clicks(models.Model):
sharer = models.ForeignKey(Sharers)
redirect_link = models.ForeignKey(Full_Link, related_name='click_redirect_link') # it could be different from sharers' redirect link because sharer's link can be changed.
referrer = models.ForeignKey(Full_Link, blank=True, null=True)
IP = models.ForeignKey(IP, blank=True, null=True)
Agent = models.ForeignKey(User_Agent, blank=True, null=True)
created = models.DateTimeField(auto_now_add = True)

class Action_Type(models.Model):
customer = models.ForeignKey(Customer)
action_name = models.CharField(max_length=20)
description = models.CharField(max_length=250, blank=True, null=True)
enabled = models.BooleanField(default = True)
created = models.DateTimeField(auto_now_add=True)


class Actions(models.Model):
click = models.ForeignKey(Clicks)
action = models.ForeignKey(Action_Type)
description = models.CharField(max_length=250, blank=True, null=True)
created = models.DateTimeField(auto_now_add=True)
Binary file modified wordout/models.pyc
Binary file not shown.
9 changes: 7 additions & 2 deletions wordout/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main_page(request):
last = Identifiers.objects.filter(customer = customer).order_by('-created')[0]
last = last.identifier
except IndexError:
last = 0
last = -1 # give -1 so that default start could be 0 which is the test code for admin

default_start = last + 1

Expand All @@ -54,6 +54,11 @@ def show_referrer_by_ident(request, ident_id):

@login_required
def create_numeric_page(request):
'''
if the request is post, i go into form, validate it and the customer will save those identifiers and redirect into the main page
if not,
we display the form. start should be a default
'''
if request.method == 'POST':
form = NumericIdenForm(user=request.user, data=request.POST)
if form.is_valid():
Expand Down Expand Up @@ -144,7 +149,7 @@ def register_page(request):
Customer.objects.get(client_id = client_id)
except Customer.DoesNotExist:
loop = False
Customer.objects.create(user = user, client_id = client_id)
Customer.objects.create(user=user, client_id=client_id)

new_user = authenticate(username=request.POST['username'], password=request.POST['password1'])
auth_login(request, new_user)
Expand Down
Binary file modified wordout/views.pyc
Binary file not shown.
Binary file modified wordoutdb
Binary file not shown.

0 comments on commit e5e416c

Please sign in to comment.