Skip to content

Commit

Permalink
Merge branch 'main' into FE-FORMHERO
Browse files Browse the repository at this point in the history
  • Loading branch information
arup1221 committed Jun 23, 2023
2 parents 71056f9 + cf2a596 commit 924d3cc
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 36 deletions.
138 changes: 138 additions & 0 deletions templates/account/create_team.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{% load static %}
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400&display=swap" rel="stylesheet">

<link rel="stylesheet" href="{% static 'assets/fonts/icomoon/style.css' %}">

<link rel="stylesheet" href="{% static 'assets/css/owl.carousel.min.css' %}">

<!-- Favicons -->
<link href="{% static 'assets/img/favicon.png' %}" rel="icon">
<link href="{% static 'assets/img/apple-touch-icon.png' %}" rel="apple-touch-icon">

<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Raleway:300,300i,400,400i,600,600i,700,700i" rel="stylesheet">

<!-- Vendor CSS Files -->
<link href="{% static 'assets/vendor/aos/aos.css' %}" rel="stylesheet">
<link href="{% static 'assets/vendor/bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'assets/vendor/bootstrap-icons/bootstrap-icons.css' %}" rel="stylesheet">
<link href="{% static 'assets/vendor/boxicons/css/boxicons.min.css' %}" rel="stylesheet">
<link href="{% static 'assets/vendor/glightbox/css/glightbox.min.css' %}" rel="stylesheet">
<link href="{% static 'assets/vendor/swiper/swiper-bundle.min.css' %}" rel="stylesheet">

<!-- Template Main CSS File -->
<link href="{% static 'assets/css/style.css' %}" rel="stylesheet">
<!--% static 'assets/css/timeline.css' %-->
<link rel="stylesheet" href="{% static 'assets/css/timeline.css' %}">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="{% static 'assets/css/bootstrap.min.css' %}">

<!-- Style -->

<link rel="stylesheet" href="{% static 'assets/css/style1.css' %}">

<title>Sign Up #2</title>
</head>
<style>
.form-check-input[type="radio"]:checked {
background-color: #FA761B;
}
</style>
<body style="background: rgb(255,226,206);background: linear-gradient(90deg, rgba(255,226,206,1) 0%, rgba(250,118,27,1) 50%, rgba(255,252,241,1) 100%);">
<!-- ======= Header ======= -->
<header id="header" class="fixed-top d-flex align-items-center">
<div class="container d-flex align-items-center justify-content-between">

<div class="logo">
<!-- <h1 class="text-light"><a href="index.html"><img src=""></a></h1> -->
<!-- Uncomment below if you prefer to use an image logo -->
<a href="{% url 'index' %}"><img src="{% static 'assets/img/logo3.png' %}" alt="" class="img-fluid" height="1000px" width="180px"></a>
</div>

<nav id="navbar" class="navbar">
<ul>
<li><a class="getstarted scrollto" href="{% url 'user:register' %}">Register</a></li>
</ul>
<i class="bi bi-list mobile-nav-toggle"></i>
</nav><!-- .navbar -->

</div>
</header><!-- End Header -->
<div class="d-lg-flex" style="background: rgb(255,226,206);background: linear-gradient(90deg, rgba(255,226,206,1) 0%, rgba(250,118,27,1) 50%, rgba(255,252,241,1) 100%);">
<div class="container mt-5">
<div class="row align-items-center justify-content-center">
<div class="col-md-9 py-5">
<div class="p-4 border border-5" style="background-color: #FFFFFF">
<p class="mb-4"></p>
<form method="post" style="background-color: #FFFFFF">
{% csrf_token %}
<div class="row">
<div class="col-md-12">
<div class="form-group first">
<label for="text">Member 1</label>
<input type="text" value="{{ user }}" class="form-control" id="member1" name="member1" disabled>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group last mb-3">
<label for="password">Member 2</label>
<select class="form-control" id="website" name="program_selected">
<option value="">None</option>
{% for free_user in available_users %}
<option value="{{ free_user }}">{{ free_user }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group last mb-3">
<label for="password">Member 3</label>
<select class="form-control" id="website" name="program_selected">
<option value="">None</option>
{% for free_user in available_users %}
<option value="{{ free_user }}">{{ free_user }}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="d-flex mb-2 mt-4 align-items-center">
</div>
<input type="submit" value="Login" class="btn px-5 btn-primary">
</div>
</form>

</div>
</div>
</div>
</div>
</div>
<script src="{% static 'assets/js/jquery-3.3.1.min.js' %}"></script>
<script src="{% static 'assets/js/popper.min.js' %}"></script>
<script src="{% static 'assets/js/bootstrap.min.js' %}"></script>
<script src="{% static 'assets/js/main1.js' %}"></script>
<!-- Vendor JS Files -->
<script src="{% static 'assets/vendor/aos/aos.js' %}"></script>
<script src="{% static 'assets/vendor/bootstrap/js/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'assets/vendor/glightbox/js/glightbox.min.js' %}"></script>
<script src="{% static 'assets/vendor/isotope-layout/isotope.pkgd.min.js' %}"></script>
<script src="{% static 'assets/vendor/swiper/swiper-bundle.min.js' %}"></script>
<script src="{% static 'assets/vendor/php-email-form/validate.js' %}"></script>

<!-- Template Main JS File -->
<script src="{%static 'assets/js/main.js' %}"></script>
</div>
</body>
</html>

2 changes: 1 addition & 1 deletion templates/account/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ <h2 class="col-md-8 offset-md-2 col-10 offset-1" style="margin-left: 15vh;"><a h
<div class="col-md-12">
<div class="form-group last mb-3">
<label for="password">Password</label>
<input type="password" name="password1" class="form-control" placeholder="Your Password" id="password">
<input type="password" name="password" class="form-control" placeholder="Your Password" id="password">
</div>
</div>
</div>
Expand Down
12 changes: 9 additions & 3 deletions templates/landing/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@
<li><a class="nav-link scrollto" href="#services">Timeline</a></li>
<li><a class="nav-link scrollto" href="#portfolio">Team</a></li>
<li><a class="nav-link scrollto" href="#contact">Contact</a></li>
<li><a class="nav-link scrollto" href="#portfolio"></a></li>
<li><a class="getstarted scrollto">Login</a></li>
{% if request.user.is_authenticated %}
<li><a class="nav-link scrollto" href="{% url 'user:create_team' %}" style="font-weight: bold; color: #eb5d1e">Create Team</a></li>
<li><a class="getstarted scrollto" href="">Dashboard</a></li>
{% else %}
<li><a class="getstarted scrollto" href="{% url 'user:login' %}">Login</a></li>
{% endif %}
</ul>
<i class="bi bi-list mobile-nav-toggle"></i>
</nav><!-- .navbar -->
Expand All @@ -77,7 +81,9 @@
<h1><b>CodeShack Summer of Code 2023</b></h1>
<h2>Unlock your coding potential at CodeShack Summer of Code: Igniting Brilliance, Fueling Innovation</h2>
<div>
<a href="{% url 'user:register' %}" class="btn-get-started scrollto"><b>Register Here</b></a>
{% if not request.user.is_authenticated %}
<a href="{% url 'user:register' %}" class="btn-get-started scrollto"><b>Register Here</b></a>
{% endif %}
</div>
</div>
<div class="col-lg-6 order-1 order-lg-2 hero-img">
Expand Down
29 changes: 14 additions & 15 deletions user/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@
class CustomUserCreationForm(UserCreationForm):
class Meta(UserCreationForm.Meta):
model = User
fields = ('email', 'first_name', 'last_name', 'phone_number', 'usn', 'program_selected', 'techstack', 'proficiency', 'password1', 'password2')
fields = (
'email',
'first_name',
'last_name',
'phone_number',
'usn',
'program_selected',
'techstack',
'proficiency',
'password1',
'password2'
)


class LoginForm(forms.Form):
email = forms.EmailField(
widget=forms.TextInput(
attrs={
"placeholder": "Email",
"class": "form-control"
}
))
password = forms.CharField(
widget=forms.PasswordInput(
attrs={
"placeholder": "Password",
"class": "form-control"
}
))
email = forms.EmailField(widget=forms.TextInput())
password = forms.CharField(widget=forms.PasswordInput())
18 changes: 18 additions & 0 deletions user/migrations/0004_alter_user_is_active.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-23 19:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('user', '0003_alter_user_techstack'),
]

operations = [
migrations.AlterField(
model_name='user',
name='is_active',
field=models.BooleanField(default=False),
),
]
31 changes: 31 additions & 0 deletions user/migrations/0005_team_member.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Generated by Django 4.2.2 on 2023-06-23 22:09

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('user', '0004_alter_user_is_active'),
]

operations = [
migrations.CreateModel(
name='Team',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, verbose_name='')),
],
),
migrations.CreateModel(
name='Member',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('acceptance_status', models.BooleanField(verbose_name='')),
('team', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='user.team', verbose_name='')),
('user', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to=settings.AUTH_USER_MODEL, verbose_name='')),
],
),
]
16 changes: 15 additions & 1 deletion user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ class User(AbstractUser):
username = None
email = models.EmailField(_('email address'), unique=True)
password = models.CharField(max_length=128)
is_active = models.BooleanField(default=False)
program_selected = models.ForeignKey(Program, null=True, on_delete=models.SET_NULL)
techstack = models.TextField(_("Techstack"), null=True, default=None, blank=True)
phone_number = PhoneNumberField()
usn = models.CharField(max_length=10)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []

class Proficiency(models.TextChoices):
EXPERT = 'EXP', _('Expert')
BEGINNER = 'BEG', _('Beginner')
Expand All @@ -33,4 +33,18 @@ class Proficiency(models.TextChoices):
default=Proficiency.BEGINNER,
)

def __str__(self):
return f"{self.first_name} {self.last_name} ({self.email})"
objects = CustomUserManager()



class Team(models.Model):
name = models.CharField(_(""), max_length=50)


# while accepting make sure that accepting from any team is not true
class Member(models.Model):
user = models.ForeignKey("user.User", verbose_name=_(""), null=True, default=None, on_delete=models.SET_DEFAULT)
team = models.ForeignKey(Team, verbose_name=_(""), on_delete=models.CASCADE)
acceptance_status = models.BooleanField(_(""))
6 changes: 4 additions & 2 deletions user/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from django.urls import path

from .views import UserRegisterView, UserLoginView
from .views import UserRegisterView, UserLoginView, UserLogoutView, UserCreateTeamView

app_name = 'user'

urlpatterns = [
path('register/', UserRegisterView.as_view(), name='register'),
path('login/', UserLoginView.as_view(), name='login')
path('login/', UserLoginView.as_view(), name='login'),
path('logout/', UserLogoutView.as_view(), name='logout'),
path('create/team/', UserCreateTeamView.as_view(), name='create_team')
]
Loading

0 comments on commit 924d3cc

Please sign in to comment.