Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0082ff2
Merge pull request #1 from devmedtz/authentication
devmedtz Oct 13, 2020
7350bb9
membership app added
devmedtz Oct 13, 2020
2f3186c
Merge pull request #2 from devmedtz/membership
devmedtz Oct 13, 2020
e9924ff
added all membership models
devmedtz Oct 13, 2020
468d0b8
Merge pull request #3 from devmedtz/membership
devmedtz Oct 13, 2020
201b43b
on signup business, businessteammember created
devmedtz Oct 13, 2020
d501b04
added dashboard and pricing page
devmedtz Oct 14, 2020
82ef752
Merge pull request #4 from devmedtz/membership
devmedtz Oct 14, 2020
9b9dd9d
add payment page
devmedtz Oct 15, 2020
e45c2f0
Merge pull request #7 from devmedtz/membership
devmedtz Oct 15, 2020
a674cd8
resolve issues
devmedtz Oct 15, 2020
a3d2e3b
Merge pull request #8 from devmedtz/membership
devmedtz Oct 15, 2020
9d5fa57
added portal-sdk for open mpesa api
devmedtz Oct 15, 2020
5468629
Merge pull request #9 from devmedtz/membership
devmedtz Oct 15, 2020
a3b80bb
update urllib3 to 1.25.10
devmedtz Oct 15, 2020
9e06004
Merge pull request #14 from devmedtz/membership
devmedtz Oct 15, 2020
f203854
Create SECURITY.md
devmedtz Oct 15, 2020
a47ff6d
Bump requests from 2.18.4 to 2.20.0 in /portal-sdk
dependabot[bot] Oct 15, 2020
1033232
Create codeql-analysis.yml
devmedtz Oct 15, 2020
79dac98
Merge pull request #12 from devmedtz/dependabot/pip/portal-sdk/reques…
devmedtz Oct 15, 2020
dad0c79
Bump requests from 2.18.4 to 2.20.0
dependabot[bot] Oct 15, 2020
58778b1
Bump urllib3 from 1.22 to 1.24.2 in /portal-sdk
dependabot[bot] Oct 15, 2020
99bfab5
Merge pull request #13 from devmedtz/dependabot/pip/portal-sdk/urllib…
devmedtz Oct 15, 2020
61d73c4
Merge pull request #11 from devmedtz/dependabot/pip/requests-2.20.0
devmedtz Oct 15, 2020
7ebd8cb
payment intergration continue
devmedtz Oct 15, 2020
9bb5411
Merge pull request #15 from devmedtz/membership
devmedtz Oct 15, 2020
a00330c
payment integration continue
devmedtz Oct 17, 2020
12fdf7a
Merge branch 'main' into membership
devmedtz Oct 17, 2020
4d92ab4
Merge pull request #16 from devmedtz/membership
devmedtz Oct 17, 2020
6c8c04b
hotfix
devmedtz Oct 17, 2020
734aef9
Merge branch 'membership' of github.com:devmedtz/django_saas into mem…
devmedtz Oct 17, 2020
367199d
Merge pull request #17 from devmedtz/membership
devmedtz Oct 17, 2020
526dd14
add AUTHORS.md
ZendaInnocent Oct 20, 2020
4994779
add contributing guide
ZendaInnocent Oct 20, 2020
038e434
update README file
ZendaInnocent Oct 20, 2020
19cc63d
Merge pull request #18 from ZendaInnocent/opens
devmedtz Oct 20, 2020
f1b2a7e
change SECRET_KEY to DJANGO_SECRET_KEY
ZendaInnocent Oct 20, 2020
9b71f18
update portalsdk api style
ZendaInnocent Oct 20, 2020
e59e645
use admin.register decorate for registering models in admin
ZendaInnocent Oct 20, 2020
da43b6a
style: enhancement of files
ZendaInnocent Oct 20, 2020
684e378
Merge pull request #20 from ZendaInnocent/fixes
devmedtz Oct 20, 2020
0f799f5
update requirements.txt for portalsdk
ZendaInnocent Oct 20, 2020
31cae9b
Merge pull request #21 from ZendaInnocent/portalsdk
devmedtz Oct 20, 2020
ea6ac4c
rename `env-example` to `.env-example`
ZendaInnocent Oct 20, 2020
6c63921
update README.md
ZendaInnocent Oct 20, 2020
ad14227
update accounts app
ZendaInnocent Oct 20, 2020
85a8929
Merge pull request #22 from ZendaInnocent/fix
devmedtz Oct 20, 2020
be95a6e
Merge pull request #27 from ZendaInnocent/accounts
devmedtz Oct 20, 2020
e2f7479
first commit
shankline Oct 22, 2020
3fb5331
creating subscription on sign up
shankline Oct 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
DEBUG=True

DJANGO_SECRET_KEY=aaaaa

PUBLIC_KEY=

API_KEY=


# Credentials for database

DB_NAME=aaa
DB_USER=aaa
DB_HOST=localhost
DB_PASSWORD=aaaa
DB_PORT=5432

#Email Credentials

EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST=aaaa
EMAIL_HOST_USER=aaaa
EMAIL_PORT=465
EMAIL_USE_SSL=True
EMAIL_HOST_PASSWORD=aaaa
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '0 3 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['python', 'javascript']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
Empty file added AUTHORS.md
Empty file.
120 changes: 120 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# How to contribute to Django SAAS

## Set up working copy of repo in your computer

Firstly, you need a local copy of the project. Press the "fork" button in Github to create a copy of the repository in your own Github account.

Now go ahead and create a local copy, find the "SSH clone URL" in the right hand column and use that to clone locally using the terminal:

```
git clone https://github.com/<your-username>/django_saas.git
```

After cloning the repository, now change into the new project's directory:

```
cd django_saas
```

Set up a new remote that points to the original project so that you can grab any changes and bring them into your local copy.

```
git remote add upstream https://github.com/devmedtz/django_saas.git
```

Now you have two remotes for this project:

- _origin_ which points to your Github fork of the project. You can read and write to this remote.
- _upstream_ which point to the main project's Github repository. You can only read from this remote.


## Get it working on your computer

Now you have the source code, get it working on your computer by following instruction on [README file](README.md).


## Do some work

Pick up an issue, reproduce it on your version. Once you have reproduced it, read the code to work out where the problem is. Once you've found the code problem, you can move on to fixing it.

If it's addition of feature, go on write the code for the particular feature.

> **For each issue/feature you are working on make sure to create a branch for it.**

First, make sure you are in a ```main``` branch

```
git checkout main
```
Sync your local copy with the upstream project

```
git pull upstream main
```
Then sync it to your forked Github project

```
git push origin main
```

Now you can create a branch on which you will work on.

```
git checkout -b <branch-name>
```

> **Ensure that you only fix the thing you're working on. Do not be tempted to fix some other things that you see along the way, including formatting issues, as your Pull Request (PR) will probably be rejected.**

Make sure you commit in logical blocks. Each commit message should be sane. Check this [commit messages guide](https://gist.github.com/brianclements/841ea7bffdb01346392c).

# Create the Pull Request (PR)

Create a PR by pushing your branch to the _origin_ remote and then press some buttons on Github.

To push new branch:
```
git push -u origin <branch-name>
```

This will create the branch on your Github project.

Swap back to the browser and navigate to your fork of the project `https://github.com/<username>/django_saas.git` and you'll see that your new branch is listed at the top with a handy "Compate & pull request button". Get ahead and press the button.

Ensure you provide a good, succint title for your pull request and explain why you have created in the in the description box. Add any relevant issue numbers if you have them.

> Don't forget to add your name in [Contributors List](AUTHORS.md)

# Review by the maintainers

For your work to be integrated into the project, the maintainer will review your work and either request changes or merge it.

# What next?

Once your PR has been merged, you can delete your branch. Firstly update your main with the changes from maintainers:

```
git checkout main
git pull upstream main
git push origin main
```

You can now delete your branch:

```
git branch -d <branch-name>
git push origin --delete <branch-name>
```

You now have a latest version of the code, so for your next change you can start again at creating new branch.

```
git checkout main
git pull upstream main
git push origin main
git checkout -b <new-branch-name>
```
and away you go making the changes required.

# Attribution

This guide is adopted from [Rob Allen article](https://akrabat.com/the-beginners-guide-to-contributing-to-a-GitHub-project)
40 changes: 30 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,39 @@ django-saas is a generic subscription billing system built for django projects.
5. Payment gateway should be MPESA, by mpesa open api

## Installation
1. clone the repo

git clone git@github.com:devmedtz/django_saas.git
- Clone the repo

2. Install the virtual env and activate
```git clone git@github.com:devmedtz/django_saas.git```

3. Install the requirements packages

pip install -r requirements.txt
- Create virtual environment and activate it.

4. create your feature branch eg. payment gateway branch
```
virtualenv env

5. Start contribution then push on your branch
env/scripts/activate
```

- Install the required packages

------your welcome for Contribution --------
```pip install -r requirements.txt```

- Create and apply migrations

```python manage.py makemigrations```

```python manage.py migrate```

- rename ```.env-sample``` to ```.env``` and fill accordingly.

- Create superuser

```python manage.py createsuperuser```

- Run development server

```python manage.py runserver```


### Contributions are warmly welcomed.

- Start contributing following the [contributing guide](CONTRIBUTING.md)
21 changes: 21 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
3 changes: 3 additions & 0 deletions accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from django.contrib import admin
from .models import CustomUser, Profile

# Register your models here.
admin.site.register(CustomUser)
admin.site.register(Profile)
16 changes: 10 additions & 6 deletions accounts/forms.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
from django import forms
from .models import CustomUser

from django.contrib.auth import get_user_model

User = get_user_model()

# todo: #26 add forms for adding and updating user


class SignUpForm(forms.ModelForm):
password1 = forms.CharField(label='Password', widget=forms.PasswordInput)
password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput)
password2 = forms.CharField(
label='Password confirmation', widget=forms.PasswordInput)

class Meta:
class Meta:
model = User
fields = ['name','email','phone']
fields = ['name', 'email', 'phone']

def clean_password2(self):
password1 = self.cleaned_data.get("password1")
Expand All @@ -34,10 +37,11 @@ class CreateStaffForm(forms.ModelForm):

class Meta:
model = User
fields = ['name','email','phone','is_active']
fields = ['name', 'email', 'phone', 'is_active']


class UpdateStaffForm(forms.ModelForm):

class Meta:
model = User
fields = ['name','email','phone','is_active']
fields = ['name', 'email', 'phone', 'is_active']
3 changes: 1 addition & 2 deletions accounts/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.db import models
from django.contrib.auth.models import BaseUserManager


Expand Down Expand Up @@ -27,4 +26,4 @@ def create_superuser(self, email, name, phone, password=None):
user.is_active = True
user.is_superuser = True
user.save(using=self._db)
return user
return user
4 changes: 2 additions & 2 deletions accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.0.7 on 2020-10-13 07:44
# Generated by Django 3.0.7 on 2020-10-13 14:01

import accounts.models
from django.conf import settings
Expand All @@ -25,7 +25,7 @@ class Migration(migrations.Migration):
('phone', models.CharField(max_length=50, unique=True, verbose_name='Phone Number')),
('is_superuser', models.BooleanField(default=False)),
('is_admin', models.BooleanField(default=False)),
('is_manager', models.BooleanField(default=True)),
('is_manager', models.BooleanField(default=False)),
('is_staff', models.BooleanField(default=False)),
('is_active', models.BooleanField(default=False)),
('created_by', models.CharField(blank=True, max_length=100, null=True)),
Expand Down
18 changes: 18 additions & 0 deletions accounts/migrations/0002_auto_20201013_1725.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.0.7 on 2020-10-13 14:25

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('accounts', '0001_initial'),
]

operations = [
migrations.RenameField(
model_name='customuser',
old_name='is_staff',
new_name='is_team',
),
]
Loading