-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kendy Wong
committed
May 6, 2023
0 parents
commit d1c3b54
Showing
134 changed files
with
1,109 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
"""Django's command-line utility for administrative tasks.""" | ||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Run administrative tasks.""" | ||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'webapps2023.settings') | ||
try: | ||
from django.core.management import execute_from_command_line | ||
except ImportError as exc: | ||
raise ImportError( | ||
"Couldn't import Django. Are you sure it's installed and " | ||
"available on your PYTHONPATH environment variable? Did you " | ||
"forget to activate a virtual environment?" | ||
) from exc | ||
execute_from_command_line(sys.argv) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class PayappConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'payapp' |
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class='container'> | ||
<h1>This is PayPal Page</h1> | ||
<hr /> | ||
<div id='paypal-button-container'></div> | ||
</div> | ||
<script src="https://www.paypal.com/sdk/js?client-id=sb¤cy=USD"></script> | ||
|
||
<script> | ||
paypal.Buttons({ | ||
createOrder: function(data, actions) { | ||
return actions.order.create({ | ||
purchase_units: [{ | ||
amount: { | ||
value: '0.01' | ||
} | ||
}] | ||
}); | ||
}, | ||
|
||
onApprove: function(data, actions) { | ||
return actions.order.capture().then(function(details) { | ||
alert('Transaction completed by' + details.payer.name.given_name + '!'); | ||
}); | ||
} | ||
}).render('#paypal-button-container'); | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('', views.paypal, name="paypal"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.shortcuts import render, redirect | ||
|
||
def paypal(request): | ||
return render(request, 'paypal.html', {}) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class AuthenticateConfig(AppConfig): | ||
name = 'register' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from django.contrib.auth.forms import UserCreationForm, UserChangeForm | ||
from django.contrib.auth.models import User | ||
from django import forms | ||
|
||
class EditProfileForm(UserChangeForm): | ||
password = forms.CharField(label="", widget=forms.TextInput(attrs={'type':'hidden'})) | ||
class Meta: | ||
model = User | ||
fields = ('username', 'first_name', 'last_name', 'email', 'password',) | ||
|
||
|
||
class SignUpForm(UserCreationForm): | ||
email = forms.EmailField(label="", widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'Email Address'}), ) | ||
first_name = forms.CharField(label="", max_length=100, widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'First Name'})) | ||
last_name = forms.CharField(label="", max_length=100, widget=forms.TextInput(attrs={'class':'form-control', 'placeholder':'Last Name'})) | ||
|
||
|
||
class Meta: | ||
model = User | ||
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(SignUpForm, self).__init__(*args, **kwargs) | ||
|
||
self.fields['username'].widget.attrs['class'] = 'form-control' | ||
self.fields['username'].widget.attrs['placeholder'] = 'User Name' | ||
self.fields['username'].label = '' | ||
self.fields['username'].help_text = '<span class="form-text text-muted"><small>Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.</small></span>' | ||
|
||
self.fields['password1'].widget.attrs['class'] = 'form-control' | ||
self.fields['password1'].widget.attrs['placeholder'] = 'Password' | ||
self.fields['password1'].label = '' | ||
self.fields['password1'].help_text = '<ul class="form-text text-muted small"><li>Your password can\'t be too similar to your other personal information.</li><li>Your password must contain at least 4 characters.</li><li>Your password can\'t be a commonly used password.</li><li>Your password can\'t be entirely numeric.</li></ul>' | ||
|
||
self.fields['password2'].widget.attrs['class'] = 'form-control' | ||
self.fields['password2'].widget.attrs['placeholder'] = 'Confirm Password' | ||
self.fields['password2'].label = '' | ||
self.fields['password2'].help_text = '<span class="form-text text-muted"><small>Enter the same password as before, for verification.</small></span>' |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h2 class="text-center">Change Password</h2> | ||
|
||
|
||
<form method="POST" action="{% url 'change_password' %}"> | ||
{% csrf_token %} | ||
|
||
{% if form.errors %} | ||
<div class="alert alert-warning alert-dismissable" role="alert"> | ||
<button class="close" data-dismiss="alert"> | ||
<small><sup>x</sup></small> | ||
</button> | ||
<p>Your Form Has Errors...</p> | ||
{% for field in form %} | ||
{% if field.errors %} | ||
{{ field.errors }} | ||
{% endif %} | ||
|
||
{% endfor %} | ||
|
||
</div> | ||
|
||
|
||
{% endif %} | ||
|
||
|
||
{{ form.as_p }} | ||
|
||
<input type="submit" value="Change Password" class="btn btn-secondary"> | ||
</form> | ||
|
||
<br/><br/> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h2 class="text-center">Edit Profile</h2> | ||
|
||
|
||
<form method="POST" action="{% url 'edit_profile' %}"> | ||
{% csrf_token %} | ||
|
||
{% if form.errors %} | ||
<div class="alert alert-warning alert-dismissable" role="alert"> | ||
<button class="close" data-dismiss="alert"> | ||
<small><sup>x</sup></small> | ||
</button> | ||
<p>Your Form Has Errors...</p> | ||
{% for field in form %} | ||
{% if field.errors %} | ||
{{ field.errors }} | ||
{% endif %} | ||
|
||
{% endfor %} | ||
|
||
</div> | ||
|
||
|
||
{% endif %} | ||
|
||
|
||
{{ form.as_p }} | ||
|
||
|
||
<input type="submit" value="Edit Profile" class="btn btn-secondary"> | ||
</form> | ||
<br/> | ||
<p><small><a href="{% url 'change_password' %}">Click Here</a> To Change Your Password</small></p> | ||
|
||
<br/><br/> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h1>This is the home page</h1> | ||
|
||
{% if user.is_authenticated %} | ||
|
||
<p>Name: {{ user.first_name }} {{ user.last_name }}</p> | ||
<p>Username: {{ user.username}}</p> | ||
<p>Email: {{ user.email }}</p> | ||
|
||
{% endif %} | ||
|
||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h2 class="text-center">Login</h2> | ||
|
||
<div class="col-md-6 offset-md-3"> | ||
<form method="POST"> | ||
{% csrf_token %} | ||
<div class="form-group"> | ||
|
||
<input type="text" class="form-control" placeholder="Enter Username" name="username"> | ||
|
||
</div> | ||
<div class="form-group"> | ||
|
||
<input type="password" class="form-control" placeholder="Enter Password" name="password"> | ||
</div> | ||
|
||
<button type="submit" class="btn btn-secondary">Login</button> | ||
</form> | ||
|
||
</div> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
|
||
<h2 class="text-center">Register</h2> | ||
|
||
<div class="col-md-6 offset-md-3"> | ||
<form method="POST" action="{% url 'register' %}"> | ||
{% csrf_token %} | ||
|
||
{% if form.errors %} | ||
<div class="alert alert-warning alert-dismissable" role="alert"> | ||
<button class="close" data-dismiss="alert"> | ||
<small><sup>x</sup></small> | ||
</button> | ||
<p>Your Form Has Errors...</p> | ||
{% for field in form %} | ||
{% if field.errors %} | ||
{{ field.errors }} | ||
{% endif %} | ||
|
||
{% endfor %} | ||
|
||
</div> | ||
|
||
|
||
{% endif %} | ||
|
||
|
||
{{ form.as_p }} | ||
|
||
<input type="submit" value="Register" class="btn btn-secondary"> | ||
</form> | ||
</div> | ||
<br/><br/> | ||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.db import models | ||
|
||
# Create your tests here. | ||
class User(models.Model): | ||
username = models.CharField(max_length=60) | ||
email = models.EmailField(max_length=60) | ||
password = models.CharField(max_length=255) | ||
firstname = models.CharField(max_length=255) | ||
lastname = models.CharField(max_length=255) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('', views.home, name="home"), | ||
path('login/', views.login_user, name='login'), | ||
path('logout/', views.logout_user, name='logout'), | ||
path('register/', views.register_user, name='register'), | ||
path('edit_profile/', views.edit_profile, name='edit_profile'), | ||
path('change_password', views.change_password, name='change_password'), | ||
] |
Oops, something went wrong.