Skip to content

Commit

Permalink
Bump UI & Codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
App Generator committed May 21, 2021
1 parent e6fb6f4 commit eeae77a
Show file tree
Hide file tree
Showing 1,969 changed files with 69,360 additions and 10 deletions.
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# tests and coverage
*.pytest_cache
.coverage

# database & logs
*.db
*.sqlite3
*.log

# venv
env
env__
venv

# other
.DS_Store

# javascript
package-lock.json

staticfiles/*
!staticfiles/.gitkeep
.vscode/symbols.json
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Change Log

## [1.0.1] 2020-01-12
## [1.0.2] 2021-05-21
### Improvements

- Bump UI: [Jinja Pixel Lite](https://github.com/app-generator/jinja-pixel-lite) v1.0.2 / Pixel Lite v4.0.0
- Codebase: [Django Boilerplate](https://github.com/app-generator/boilerplate-code-django) v1.0.4

## [1.0.1] 2021-01-12
### Improvements

- Bump UI: [Pixel Lite](https://github.com/themesberg/pixel-bootstrap-ui-kit) v3.1.2
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.6

COPY manage.py gunicorn-cfg.py requirements.txt .env ./
COPY app app
COPY authentication authentication
COPY core core

RUN pip install -r requirements.txt

RUN python manage.py makemigrations
RUN python manage.py migrate

EXPOSE 5005
CMD ["gunicorn", "--config", "gunicorn-cfg.py", "core.wsgi"]
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn core.wsgi --log-file=-
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ PRO versions include **Premium UI Kits**, Lifetime updates and **24/7 LIVE Suppo
<br />
<br />

![Django Pixel Lite - Template project provided by AppSeed.](https://raw.githubusercontent.com/app-generator/django-pixel-bootstrap-uikit/master/media/django-pixel-bootstrap-uikit-screen.png)
![Django Pixel Lite - Template project provided by AppSeed.](https://raw.githubusercontent.com/app-generator/django-pixel-lite/master/media/django-pixel-bootstrap-uikit-screen.png)

<br />

## How to use it

```bash
$ # Get the code
$ git clone https://github.com/app-generator/django-pixel-bootstrap-uikit.git
$ cd django-pixel-bootstrap-uikit
$ git clone https://github.com/app-generator/django-pixel-lite.git
$ cd django-pixel-lite
$
$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
Expand Down Expand Up @@ -151,8 +151,8 @@ The application can be easily executed in a docker container. The steps:
> Get the code
```bash
$ git clone https://github.com/app-generator/django-pixel-bootstrap-uikit.git
$ cd django-pixel-bootstrap-uikit
$ git clone https://github.com/app-generator/django-pixel-lite.git
$ cd django-pixel-lite
```

> Start the app in Docker
Expand Down
4 changes: 4 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
8 changes: 8 additions & 0 deletions app/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.contrib import admin

# Register your models here.
9 changes: 9 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.apps import AppConfig

class MyConfig(AppConfig):
name = 'cfg'
4 changes: 4 additions & 0 deletions app/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
10 changes: 10 additions & 0 deletions app/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.db import models
from django.contrib.auth.models import User

# Create your models here.

8 changes: 8 additions & 0 deletions app/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.test import TestCase

# Create your tests here.
17 changes: 17 additions & 0 deletions app/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.urls import path, re_path
from app import views

urlpatterns = [

# The home page
path('', views.index, name='home'),

# Matches any html file
re_path(r'^.*\.*', views.pages, name='pages'),

]
42 changes: 42 additions & 0 deletions app/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template

@login_required(login_url="/login/")
def index(request):

context = {}
context['segment'] = 'index'

html_template = loader.get_template( 'index.html' )
return HttpResponse(html_template.render(context, request))

@login_required(login_url="/login/")
def pages(request):
context = {}
# All resource paths end in .html.
# Pick out the html file name from the url. And load that template.
try:

load_template = request.path.split('/')[-1]
context['segment'] = load_template

html_template = loader.get_template( load_template )
return HttpResponse(html_template.render(context, request))

except template.TemplateDoesNotExist:

html_template = loader.get_template( 'page-404.html' )
return HttpResponse(html_template.render(context, request))

except:

html_template = loader.get_template( 'page-500.html' )
return HttpResponse(html_template.render(context, request))
4 changes: 4 additions & 0 deletions authentication/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
8 changes: 8 additions & 0 deletions authentication/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.contrib import admin

# Register your models here.
9 changes: 9 additions & 0 deletions authentication/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.apps import AppConfig

class AuthConfig(AppConfig):
name = 'authcfg'
58 changes: 58 additions & 0 deletions authentication/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User

class LoginForm(forms.Form):
username = forms.CharField(
widget=forms.TextInput(
attrs={
"placeholder" : "Username",
"class": "form-control"
}
))
password = forms.CharField(
widget=forms.PasswordInput(
attrs={
"placeholder" : "Password",
"class": "form-control"
}
))

class SignUpForm(UserCreationForm):
username = forms.CharField(
widget=forms.TextInput(
attrs={
"placeholder" : "Username",
"class": "form-control"
}
))
email = forms.EmailField(
widget=forms.EmailInput(
attrs={
"placeholder" : "Email",
"class": "form-control"
}
))
password1 = forms.CharField(
widget=forms.PasswordInput(
attrs={
"placeholder" : "Password",
"class": "form-control"
}
))
password2 = forms.CharField(
widget=forms.PasswordInput(
attrs={
"placeholder" : "Password check",
"class": "form-control"
}
))

class Meta:
model = User
fields = ('username', 'email', 'password1', 'password2')
4 changes: 4 additions & 0 deletions authentication/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
8 changes: 8 additions & 0 deletions authentication/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.db import models

# Create your models here.
8 changes: 8 additions & 0 deletions authentication/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.test import TestCase

# Create your tests here.
14 changes: 14 additions & 0 deletions authentication/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.urls import path
from .views import login_view, register_user
from django.contrib.auth.views import LogoutView

urlpatterns = [
path('login/' , login_view, name="login" ),
path('register/' , register_user, name="register"),
path("logout/" , LogoutView.as_view(), name="logout" )
]
60 changes: 60 additions & 0 deletions authentication/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

from django.shortcuts import render

# Create your views here.
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.forms.utils import ErrorList
from django.http import HttpResponse
from .forms import LoginForm, SignUpForm

def login_view(request):
form = LoginForm(request.POST or None)

msg = None

if request.method == "POST":

if form.is_valid():
username = form.cleaned_data.get("username")
password = form.cleaned_data.get("password")
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
return redirect("/")
else:
msg = 'Invalid credentials'
else:
msg = 'Error validating the form'

return render(request, "accounts/login.html", {"form": form, "msg" : msg})

def register_user(request):

msg = None
success = False

if request.method == "POST":
form = SignUpForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get("username")
raw_password = form.cleaned_data.get("password1")
user = authenticate(username=username, password=raw_password)

msg = 'User created - please <a href="/login">login</a>.'
success = True

#return redirect("/login/")

else:
msg = 'Form is not valid'
else:
form = SignUpForm()

return render(request, "accounts/register.html", {"form": form, "msg" : msg, "success" : success })
4 changes: 4 additions & 0 deletions core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""
12 changes: 12 additions & 0 deletions core/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- encoding: utf-8 -*-
"""
Copyright (c) 2019 - present AppSeed.us
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')

application = get_asgi_application()
Loading

0 comments on commit eeae77a

Please sign in to comment.