Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bootstrap Framework #61

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
140 changes: 139 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,139 @@
/myenv
# Django #
*.log
*.pot
*.pyc
__pycache__
db.sqlite3
media

# Backup files #
*.bak

# If you are using PyCharm #
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# File-based project format
*.iws

# IntelliJ
out/

# JIRA plugin
atlassian-ide-plugin.xml

# Python #
*.py[cod]
*$py.class

# Distribution / packaging
.Python build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.whl
*.egg-info/
.installed.cfg
*.egg
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
.pytest_cache/
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery
celerybeat-schedule.*

# SageMath parsed files
*.sage.py

# Environments
/myenv
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mkdocs documentation
/site

# mypy
.mypy_cache/

# Sublime Text #
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace
*.sublime-project

# sftp configuration file
sftp-config.json

# Package control specific files Package
Control.last-run
Control.ca-list
Control.ca-bundle
Control.system-ca-bundle
GitHub.sublime-settings

# Visual Studio Code #
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history
1 change: 1 addition & 0 deletions accounts/validators.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.core.validators import EmailValidator
from django.utils.deconstruct import deconstructible

# Function to validate only nyu.edu email addresses for sign up
@deconstructible
class NyuEmailValidator(EmailValidator):
def validate_domain_part(self, domain_part):
Expand Down
Binary file modified db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ python <your_main_script.py>
deactivate

# Update the requirements.txt if new packages are installed
pip freeze > requirements.txt
pip freeze > requirements.txt
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
asgiref==3.8.1
Django==5.1.2
beautifulsoup4==4.12.3
Django==4.2.16
django-bootstrap-v5==1.0.11
pytz==2024.2
soupsieve==2.6
sqlparse==0.5.1
typing_extensions==4.12.2
5 changes: 3 additions & 2 deletions routepals/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = ["RoutePals-dev.us-east-1.elasticbeanstalk.com"]
ALLOWED_HOSTS = ["RoutePals-dev.us-east-1.elasticbeanstalk.com", "127.0.0.1"]


# Application definition
Expand All @@ -38,6 +38,7 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'accounts',
'bootstrap5',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -114,7 +115,7 @@


# Static files (CSS, JavaScript, Images)
STATIC_URL = 'static/'
STATIC_URL = '/static/'
STATIC_ROOT = 'static'

# Default primary key field type
Expand Down
4 changes: 4 additions & 0 deletions routepals/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from django.shortcuts import render_to_response

def index( request ):
return render_to_response('base.html')
Binary file added static/assets/img/routepalslogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 35 additions & 10 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,40 @@
<!DOCTYPE html>
<html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>{% block title %}Route Pals{% endblock %}</title>
{% load static %}
<meta charset="UTF-8">
<title>RoutePals - {% block title %}{% endblock %}</title>
{% load bootstrap5 %}
{% bootstrap_css %}
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/bootstrap.min.css">
</head>

<body>
<main>
{% block content %}
{% endblock %}
</main>
<div class="container-fluid">

<nav class="navbar navbar-expand-lg navbar-light p-3 mb-2 bg-dark bg-gradient text-white">
<a class="navbar-brand text-light" href="/">RoutePals</a>
{% if user.is_authenticated %}
<div class="collapse navbar-collapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link link-light" href="/">Home</a>
</li>
<!-- Add more nav items here as needed -->
</ul>
</div>
<span class="navbar-text">
<form class="form-inline" action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button class="btn btn-outline-light" type="submit">Log Out</button>
</form>
{% endif %}
</span>
</nav>
<div class="container mt-3">
{% block content %}
{% endblock %}
</div>
</div>
{% bootstrap_javascript %}
</body>
</html>
</html>
15 changes: 5 additions & 10 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@

{% block content %}
{% if user.is_authenticated %}
Hi {{ user.username }}! Welcome to Route Pals.
<p><a href="{% url 'password_change' %}">Password Change</a></p>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Log Out</button>
</form>
<p>Hi {{ user.username }}! Welcome to Route Pals.</p>
<p><a class="btn btn-primary btn-lg" href="{% url 'password_change' %}" role="button">Password Change</a></p>
{% else %}
<p>You are not logged in</p>
<p><a href="/accounts/signup">Sign Up</a></p>
<p><a href="{% url 'password_reset' %}">Password Reset</a></p>
<a href="{% url 'login' %}">Log In</a>
<p>Welcome to Route Pals.</p>
<p><a class="btn btn-secondary btn-lg" href="/accounts/signup" role="button">Sign Up</a></p>
<a class="btn btn-primary btn-lg" href="{% url 'login' %}" role="button">Log In</a>
{% endif %}
{% endblock %}
52 changes: 44 additions & 8 deletions templates/registration/login.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
{% extends "base.html" %}
{% load static %}

{% block title %}Login{% endblock %}

{% block content %}
<h2>Log In</h2>

<form method="post">
{% csrf_token %}
{{ form }}
<button type="submit">Log In</button>
</form>
{% endblock %}

<section class="vh-100">
<div class="container-fluid h-custom p-3 mb-2">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-md-9 col-lg-6 col-xl-5">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/draw2.webp"
class="img-fluid" alt="Sample Image">
</div>
<div class="col-md-8 col-lg-6 col-xl-4 offset-xl-1">
<form method="post">
{% csrf_token %}


<!-- Email input -->
<div data-mdb-input-init class="form-outline mb-4">
<label class="form-label" for="username">Username</label>
{{ form.username }}
</div>

<!-- Password input -->
<div data-mdb-input-init class="form-outline mb-3">
<label class="form-label" for="password">Password</label>
{{ form.password }}
</div>

<div class="d-flex justify-content-between align-items-center">
<a href="{% url 'password_reset' %}" class="text-body">Forgot password?</a>
</div>

<div class="text-center text-lg-start mt-4 pt-2">
<button type="submit" class="btn btn-primary btn-lg"
style="padding-left: 2.5rem; padding-right: 2.5rem;">Login</button>
<p class="small fw-bold mt-2 pt-1 mb-0">Don't have an account? <a href="/accounts/signup"
class="link-danger">Register</a></p>
</div>

</form>
</div>
</div>
</div>
</section>

{% endblock %}
28 changes: 21 additions & 7 deletions templates/registration/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@
{% block title %}Sign Up{% endblock %}

{% block content %}
<h2>Sign Up</h2>
<h4>Only NYU students can use Route Pals. Please sign up using your NYU email.</h4>
<form method="POST" class="form-group">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Sign Up</button>
</form>

<section class="vh-100">
<div class="container-fluid h-custom p-3 mb-2">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-md-9 col-lg-6 col-xl-5">
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/draw2.webp"
class="img-fluid" alt="Sample Image">
</div>
<div class="col-md-8 col-lg-6 col-xl-4 offset-xl-1">
<h5>Only NYU students can use Route Pals. Please sign up using your NYU email.</h5>
<br/>
<form method="POST" class="form-group">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary btn-lg"
style="padding-left: 2.5rem; padding-right: 2.5rem;">Sign Up</button>
</form>
</div>
</div>
</div>
</section>
{% endblock %}