2013/6/13 MattDale <[email protected]>

> A quick google didn't turn up any packages for your specific case, but you
> may not want to use a pre-built solution.
> Amirouche wanted some more information about how you plan on implementing
> the project.
>
> Here's a simple concept:
> It seems that you would want to customize the standard User model and add
> an integer field "Points" to it with default value=0.  When the User
> purchases these fictitious points, you would increment their associated
> Points value by whatever they paid for.
> Then when the User is on the site and logged in, you can use Javascript to
> send an asynchronous request to the server when the Play button is pressed
> on the page.  Since the user is logged in, it's instance is available in
> the context that was sent through in the AJAX request. You would then be
> able to subtract the corresponding point value from that User's Points
> field.
>
> Obviously my description has flaws: you need to be careful with the
> Javascript so the User doesn't click the Play button multiple times, you
> need to set rules in the User model to not allow negative Point values,
>  not allow the user to press the Play the button if they don't have enough
> Points, etc.
>

You don't have to use Javascript, you can come with a solutions that
doesn't involve javascript.

On Wednesday, June 12, 2013 1:38:45 PM UTC-4, coded kid wrote:
>
>> How do you mean? Please explain further.
>>
>> On Monday, 10 June 2013 14:05:56 UTC+1, Amirouche wrote:
>>>
>>>
>>>
>>> Le lundi 10 juin 2013 12:59:05 UTC+2, coded kid a écrit :
>>>>
>>>> what is the best way to implement this? Users will pay a certain fee
>>>> and get some amount of points (100points) and for every video the user
>>>> watch, like 30points will be deducted. How can I go about this? is
>>>> there a package for point system in django?
>>>
>>>
The point thing, make me think about badge applications but it's not, I
think, what you need [1]



>
>>> This is simple transaction scheme what is specific to your usecase ?
>>>
>>

Custom user class [2] has a field points that can be increased using some
form. Then there is another table that we can call Subscription that looks
like the following:

class Subscription(models.Model):

    user = models.ForeignKey(User)
    video = models.ForeignKey(Video)
    end_date = models.DateTimeField()


When the user tries to play a video you check for a valid subscription
something like Subscription.filter(end_data__gt=current_date,
user=request.current_user) depending on the result you show a pay wall or
the video.

HTH,


Amirouche


[1] https://www.djangopackages.com/grids/g/awards-badges/
[2]
https://docs.djangoproject.com/en/dev/topics/auth/customizing/#specifying-a-custom-user-model

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to