Commit 16b3ea8f authored by Jenica's avatar Jenica

Fixed merge conflict

parents be48e342 02295020
...@@ -14,6 +14,8 @@ class CustomUserAuthenticationForm(AuthenticationForm): ...@@ -14,6 +14,8 @@ class CustomUserAuthenticationForm(AuthenticationForm):
self.fields['email'].required = True self.fields['email'].required = True
self.fields.pop('username') self.fields.pop('username')
self.order_fields(['email', 'password']) self.order_fields(['email', 'password'])
for visible in self.visible_fields():
visible.field.widget.attrs['class'] = 'form-control'
# Registering a User Form # Registering a User Form
class CustomUserCreationForm(UserCreationForm): class CustomUserCreationForm(UserCreationForm):
......
{% extends "base.html" %} {% extends "base.html" %}
{% block head %} {% block head %}
<script src="https://accounts.google.com/gsi/client" async></script> <script src="https://accounts.google.com/gsi/client" async defer></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<form method="POST" autocomplete="off"> <div id="login-container" class="d-flex my-5">
<div id="login-form" class="mx-auto px-3 py-4 bg-white" style="width: 23rem;">
<p class="h1">Log in</p>
<form method="POST" autocomplete="off">
{% csrf_token %} {% csrf_token %}
{{ loginform.as_p }} <div class="form-group">
<input type="submit" value="Log In"/> <label class="h5" for="email">Email</label>
{{ loginform.email }}
</div>
<div class="form-group">
<label class="h5" for="password">Password</label>
{{ loginform.password }}
</div>
<input class="btn-red login-btn" type="submit" value="Log In"/>
<a href="{% url 'accounts:register' %}"><input class="btn-red login-btn" type="button" value="Register"/></a>
<div id="g_id_onload" <div id="g_id_onload"
data-client_id="1091426130026-resqtjvbfu1mguphrr5seg6d31k1ttqf.apps.googleusercontent.com" data-client_id="1091426130026-resqtjvbfu1mguphrr5seg6d31k1ttqf.apps.googleusercontent.com"
data-context="signin" data-context="signin"
data-ux_mode="redirect" data-ux_mode="redirect"
data-login_uri="http://localhost:8000/accounts/auth-receiver" data-login_uri="http://localhost:8000/accounts/auth-receiver"
data-itp_support="true"> data-auto_prompt="false">
</div> </div>
<div class="g_id_signin" <div class="login-btn g_id_signin"
data-type="standard" data-type="standard"
data-shape="pill" data-shape="rectangle"
data-theme="filled_black" data-theme="filled_blue"
data-text="signin_with" data-text="continue_with"
data-size="large" data-size="large"
data-logo_alignment="left"> data-logo_alignment="left">
</div> </div>
</form> </form>
</div>
</div>
{% endblock %} {% endblock %}
\ No newline at end of file
from django.contrib import admin from django.contrib import admin
# Register your models here. # Register your models here.
from django.contrib import admin
from .models import Event
admin.site.register(Event)
\ No newline at end of file
...@@ -7,25 +7,29 @@ from accounts import models as accounts ...@@ -7,25 +7,29 @@ from accounts import models as accounts
class Event(models.Model): class Event(models.Model):
event_name = models.CharField(default='', max_length=150) event_name = models.CharField(default='', max_length=150)
event_datetime_start = models.DateTimeField(default=timezone.now, null=False) event_datetime_start = models.DateTimeField(default=timezone.now, null=False)
event_datetime_end = models.DateTimeField() event_datetime_end = models.DateTimeField(default=None, null=True)
event_organizer = models.ForeignKey(accounts.CustomUser, on_delete=models.CASCADE, related_name='events_organized') event_organizer = models.ForeignKey(accounts.CustomUser, on_delete=models.CASCADE, related_name='events_organized')
# finalize arguments # finalize arguments
event_header = models.ImageField(upload_to='headers/', height_field=None, width_field=None, max_length=100, blank=True) event_header = models.ImageField(upload_to='headers/', height_field=None, width_field=None, max_length=100, blank=True)
# research how exactly to do this
event_promos = models.FileField(upload_to='promos/', blank=True, null=True)
# decide whether to have a separate model for the comments
comments = models.TextField()
last_time_bumped = models.DateTimeField() last_time_bumped = models.DateTimeField()
def __str__(self): def __str__(self):
return '{}'.format(self.event_name) return '{}'.format(self.event_name)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('event_management:event_details', kwargs={'pk': self.pk}) return reverse('event_management:event-details', kwargs={'pk': self.pk})
def save(self, *args, **kwargs): # def save(self, *args, **kwargs):
if self.event_datetime_end is None: # if self.event_datetime_end is None:
self.event_datetime_end = self.event_datetime_start + timedelta(hours=1) # self.event_datetime_end = self.event_datetime_start + timedelta(hours=1)
if self.last_time_bumped is None: # if self.last_time_bumped is None:
self.last_time_bumped = self.event_datetime_start # self.last_time_bumped = self.event_datetime_start
super(Event, self).save(*args, **kwargs) # super(Event, self).save(*args, **kwargs)
\ No newline at end of file
class Promo(models.Model):
img = models.ImageField(upload_to='images/', height_field=None, width_field=None, max_length=100, blank=True)
event_name = models.ForeignKey(Event, on_delete=models.CASCADE)
class Comment(models.Model):
event_comment = models.TextField(default='', max_length=255)
event_name = models.ForeignKey(Event, on_delete=models.CASCADE)
\ No newline at end of file
{% block content %}
<img src="{{ object.event_header.url }}" width = '300'/>
<p><a href='{{ object.get_absolute_url }}'>{{ object }}</a></p>
<p>{{ object.event_organizer }}</p>
{% endblock %}
{% block content %}
<ul>
{% for event in object_list %}
<li>
<a href="{{ event.get_absolute_url }}">{{ event.event_name }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}
from django.urls import path from django.urls import path
from .views import index from .views import event_view, EventListView, EventDetailView, EventCreateView, EventUpdateView
urlpatterns = [path('', index, name='index')] urlpatterns = [
path('', event_view, name='event'),
path('events/', EventListView.as_view(), name='event-list'),
path('<int:pk>/details', EventDetailView.as_view(), name='event-details'),
path('add/', EventCreateView.as_view(), name='event-create'),
path('<int:pk>/update', EventUpdateView.as_view(), name='event-update'),
]
app_name = "event_management" app_name = "event_management"
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView
def index(request): from .models import Event
return HttpResponse('Hello World! This came from the index view.')
\ No newline at end of file def event_view(request):
events = Event.objects.all()
context = {'events' : events}
return render(request, 'event_management/events.html', context)
class EventDetailView(DetailView):
model = Event
template_name = 'event_management/event-details.html'
class EventListView(ListView):
model = Event
template_name = 'event_management/event-list.html'
class EventCreateView(CreateView):
model = Event
fields = '__all__'
template_name = 'event_management/event-create.html'
class EventUpdateView(UpdateView):
model = Event
fields = '__all__'
template_name = 'event/event-update.html'
\ No newline at end of file
...@@ -2,16 +2,6 @@ ...@@ -2,16 +2,6 @@
{% block content %} {% block content %}
{% if user.is_authenticated %}
Hi {{ user.first_name }} {{ user.last_name }}!
<form action="{% url 'accounts:logout' %}" method="post">
{% csrf_token %}
<button type="submit">Log Out</button>
</form>
{% else %}
<p>You are not logged in</p>
<a href="{% url 'accounts:login' %}">Log In</a>
<a href="{% url 'accounts:register' %}">Register</a>
{% endif %}
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -3,5 +3,5 @@ from django.urls import path ...@@ -3,5 +3,5 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.homepage, name="index"), path('', views.index, name="index"),
] ]
\ No newline at end of file
...@@ -2,5 +2,5 @@ from django.shortcuts import render ...@@ -2,5 +2,5 @@ from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
# Create your views here. # Create your views here.
def homepage(request): def index(request):
return render(request, "eventcatalog/index.html") return render(request, "eventcatalog/index.html")
\ No newline at end of file
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class HomeConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'home'
from django.db import models
# Create your models here.
{% extends "base.html" %}
{% block content %}
<div id="featured-events-div" class="py-3 px-5 container-fluid bg-white">
<p class="h1">Featured Events</p>
{% comment %} Delete text-center if you want it to be left-aligned {% endcomment %}
<div class="container text-center">
{% comment %}
Loop for events
https://getbootstrap.com/docs/5.3/components/card/#images
{% endcomment %}
</div>
</div>
{% endblock %}
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="index"),
]
\ No newline at end of file
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, "home/index.html")
\ No newline at end of file
...@@ -40,6 +40,7 @@ INSTALLED_APPS = [ ...@@ -40,6 +40,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'home',
'accounts', 'accounts',
'eventcatalog', 'eventcatalog',
'event_management', 'event_management',
...@@ -133,3 +134,6 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' ...@@ -133,3 +134,6 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_REDIRECT_URL = "index" LOGIN_REDIRECT_URL = "index"
LOGOUT_REDIRECT_URL = "index" LOGOUT_REDIRECT_URL = "index"
AUTH_USER_MODEL = "accounts.CustomUser" AUTH_USER_MODEL = "accounts.CustomUser"
MEDIA_ROOT = BASE_DIR/'media'
MEDIA_URL = '/media/'
\ No newline at end of file
...@@ -15,12 +15,17 @@ Including another URLconf ...@@ -15,12 +15,17 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.conf import settings
from django.urls import path, include from django.urls import path, include
from django.conf.urls.static import static
from django.views.generic.base import TemplateView from django.views.generic.base import TemplateView
urlpatterns = [ urlpatterns = [
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path("accounts/", include("accounts.urls"), name="accounts"), path("accounts/", include("accounts.urls"), name="accounts"),
path("event_management/", include("event_management.urls", namespace="event_management")), path("event_management/", include("event_management.urls"), name='eventmanagement'),
path("", include("eventcatalog.urls"), name="index"), path("eventcatalog/", include("eventcatalog.urls"), name="eventcatalog"),
path("", include("home.urls"), name="index"),
] ]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
\ No newline at end of file
...@@ -2,32 +2,118 @@ ...@@ -2,32 +2,118 @@
:root { :root {
--theme-prusian-blue: #003049; --theme-prusian-blue: #003049;
--theme-bright-red: #D62828; --theme-bright-red: #D62727;
--theme-orange: #F77F00; --theme-orange: #F77F00;
--theme-yellow-red: #FCBF49; --theme-yellow-red: #FCBF49;
--theme-dutch-white: #EAE2B7; --theme-dutch-white: #EAE2B7;
} }
body { * {
font-family: "Inter"; font-family: "Inter";
font-size: 1rem;
}
body {
background-color: var(--theme-dutch-white); background-color: var(--theme-dutch-white);
/* background-image: url("/static/images/Continuous Background.png"); */ background-image: url("/static/images/Continuous Background.png");
background-position: left top; background-position: left top;
background-repeat: repeat-y; background-repeat: repeat-y;
background-size: 80%; background-size: 80%;
} }
#event-catalog { .btn-red {
color: var(--theme-orange); transition: all 0.3s ease-in;
font-size: 1.5vw;
background-color: var(--theme-bright-red);
color: #fff;
border-color: var(--theme-bright-red);
white-space: nowrap;
}
.btn-red:hover {
transition: all 0.3s ease-in;
font-size: 1.55vw;
background-color: var(--theme-prusian-blue);
color: #fff;
border-color: var(--theme-prusian-blue);
}
@media (max-width: 950px) {
.navbar-brand {
width: 90%;
}
}
@media (max-width: 780px) {
.navbar-brand {
width: 85%;
}
}
@media (max-width: 560px) {
.navbar-brand {
width: 75%;
}
}
@media (max-width: 425px) {
.navbar-brand {
width: 70%;
}
}
.nav-link {
transition: all 0.3s ease-in;
color: var(--theme-bright-red) !important;
font-size: 1.5vw; font-size: 1.5vw;
white-space: nowrap;
} }
.col-form-label {
font-family:Verdana, sans-serif; .nav-link:hover {
font-size: 2vw; transition: all 0.3s ease-in;
font-size: 1.55vw;
color: var(--theme-prusian-blue) !important;
text-decoration: underline;
} }
#trial { #trial {
align-items: center; align-items: center;
background-color: white; background-color: white;
} }
#featured-events-div {
margin-top: 7.5rem;
height: 100vh;
}
#login-container {
align-items: center;
justify-content: center;
}
#login-form {
border-radius: 0.625rem;
border: 1px solid #000;
background: #FFF;
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
}
.form-group > label {
margin-top: 1.19rem;
}
.form-group > input:not([type="submit"]) {
border-radius: 0.625rem !important;
border: 1px solid #000 !important;
background: #FFF !important;
}
.login-btn {
margin-top: 1.62rem;
width: 100%;
border-radius: 0.3125rem;
background: #DF4E4E;
border-color: #DF4E4E;
}
\ No newline at end of file
...@@ -6,40 +6,47 @@ ...@@ -6,40 +6,47 @@
{% bootstrap_css %} {% bootstrap_css %}
{% bootstrap_javascript %} {% bootstrap_javascript %}
{% bootstrap_messages %} {% bootstrap_messages %}
{% block head %}
{% endblock %}
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="{% static 'css/custom.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'css/custom.css' %}">
<link rel="icon" type="image/x-icon" href="{% static 'images/Logo.png' %}"> <link rel="icon" type="image/x-icon" href="{% static 'images/Logo.png' %}">
<title>{% block title %}Red Brick Board{% endblock %}</title> <title>{% block title %}Red Brick Board{% endblock %}</title>
{% block head %}
{% endblock %}
</head> </head>
<body> <body>
<main> <nav class="px-5 navbar navbar-expand-lg navbar-light bg-light">
<nav class="navbar navbar-expand-md navbar-light bg-light"> <div class="container-fluid justify-content-end">
<div class="container-fluid"> <a class="navbar-brand" href="/">
<a class="navbar-brand" href="#"> <img src="{% static '/images/Logo with Name.png' %}" alt="Red Brick Board" style="width:30%; height:auto;">
<img src="{% static 'images/Logo with Name.png' %}" alt="Red Brick Board" style="width:30%; height:auto; padding-left:10%;">
</a> </a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse justify-content-end align-center" id="navbarNavAltMarkup"> <div class="collapse navbar-collapse justify-content-end" id="navbarNavAltMarkup">
<div class="navbar-nav"> <ul class="navbar-nav d-flex">
<a class="nav-link" id="event-catalog" href="#">Event Catalog</a> <li class="nav-item">
<form class="container-fluid"> <a class="nav-link" href="/eventcatalog" style="margin-right: 2.94rem;">Event Catalog</a>
<button class="btn" type="button">Log Out</button> </li>
<li class="nav-item">
{% if user.is_authenticated %}
<form role="Log Out" action="{% url 'accounts:logout' %}" method="post">
{% csrf_token %}
<button class="btn btn-red" type="submit">Log Out</button>
</form> </form>
{% else %}
<form role="Log In" action="{% url 'accounts:login' %}" method="post">
{% csrf_token %}
<button class="btn btn-red" type="submit">Log In</button>
</form>
{% endif %}
</li>
</ul>
</div> </div>
{% comment %} <form class="container-fluid justify-content-start"> </nav>
<button class="btn" type="button" >Log Out</button>
</form> {% endcomment %}
</div>
</div>
</nav>
{% block content %} {% block content %}
{% endblock %} {% endblock %}
</main>
</body> </body>
</html> </html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment