django-affiliate | Affiliate system for django | Application Framework library
kandi X-RAY | django-affiliate Summary
kandi X-RAY | django-affiliate Summary
[Pypi version] Affiliate system to reward partners with their visitors payments. Contains abstract models with basic functionality, so it is easy to subclass them and add your custom logic and relations. Note: version 0.2.0 is backwards incompatible with previous versions.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Process the request
- Return the active Affiliate instance
- Remove url from url
- Return the AffiliateModel instance for the given aid_code
- Handle login form
- Create a new Affiliate instance
- Returns success URL
- Return the Affiliate object
- Returns the associate model
- Creates a new affiliate
- Decorator to handle login required
django-affiliate Key Features
django-affiliate Examples and Code Snippets
Community Discussions
Trending Discussions on Application Framework
QUESTION
I am trying to understand various available AGL specific options that we can give in config.xml and I am referring to the link below
https://docs.automotivelinux.org/docs/en/halibut/apis_services/reference/af-main/2.2-config.xml.html
This is the sample config.xml file
...ANSWER
Answered 2020-Mar-06 at 09:48I figured out why we need this
required-api: param name="#target"
OPTIONAL(not compulsory)
It declares the name of the unit(in question it is main) requiring the listed apis. Only one instance of the param “#target” is allowed. When there is not instance of this param, it behave as if the target main was specified.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-affiliate
Install this package to your python distribution pip install django-affiliate
Add affiliate to INSTALLED_APP: INSTALLED_APPS = [ # ... 'affiliate', ]
Add affiliate.middleware.AffiliateMiddleware to MIDDLEWARE_CLASSES: MIDDLEWARE_CLASSES = ( # ... 'affiliate.middleware.AffiliateMiddleware', )
Define your custom affiliate model (similar to custom user model): # our_app/models.py from django.db import models from affiliate.models import AbstractAffiliate class Affiliate(AbstractAffiliate): pass # or add some your custom fields here # settngs.py AFFILIATE_AFFILIATE_MODEL = 'our_app.Affiliate'
Create tables # django <= 1.6 python manage.py syncdb # django <= 1.6 & south python manage.py schemamigration our_app --auto python manage.py migrate our_app # django >= 1.7 python manage.py makemigrations our_app python manage.py migrate our_app
Finally, reward affiliate from django.views.generic import FormView from affiliate.tools import get_affiliate_model Affiliate = get_affiliate_model() class SomeView(FormView): # ... def form_valid(self.form): product = self.get_product() if self.request.affiliate.exists() and self.request.affiliate.is_active: # reward affiliate here, your custom logic is here Transaction.objects.create( user=self.affiliate.user, amount=Affiliate.calc_affiliate_reward(product.price)) return super(SomeView, self).form_valid(form)
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page