Coder Social home page Coder Social logo

django-referral-system's Introduction

A Referral system using Django and Django Rest Framework

  • A user can signup and generate their own referral code.
  • A user can share their referral code with others via email
  • If the other user accepts and signs up using the same referral code, 100 credits will be given to both the users.

Fork or Clone

git clone https://github.com/Kiru13/Django-Referral-System.git 
cd Django-Referral-System

Installation

For windows

python -m venv venv
venv/Scripts/activate

For Linux

python3 -m venv venv
source venv/bin/activate

Install requirements

pip install -r requirements.txt

Setup

  • Add Environment variables
      SECRET_KEY = <Django unique secret key>
      DEBUG = <Mode of environment default:True>
      NAME = <postgres database name default:referralDB>
      USER = <postgres database user default:postgres>
      PASSWORD = <postgres database user password default:password>
      HOST = <postgres database server hostname default:localhost>
      PORT = <postgres database server port default:5432>
      EMAIL_FROM = <Host email address>
      EMAIL_PASSWORD = <Host password>
    Note:
  • Database setup
    python manage.py makemigrations
    python manage.py migrate
    python manage.py runserver

API's usage

Sign Up API - Signing up user and generate referral code

  • API End Point - {server DNS}/referral/signup/ - (POST)

    Request Body

    {
     "email":"[email protected]",
     "password":"password",
     "referral_code":"referral_code"
    }

Share Referral Code API - Share the referral code to given email id

  • API End Point - {server DNS}/referral/share/ - (POST)

    Request Body

    {
     "referrer":"user_id",
     "to_email":"[email protected]"
    }

User Detail API - Get the user detail by userid to get the points earned in total and referral code

  • API End Point - {server DNS}/referral/users/{user_id} - (GET)

Django admin page

  • Check admin for detail info. (requires superuser credentials)

Note : server DNS - server url such as localhost:8000

django-referral-system's People

Contributors

kiru13 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.