Skip to content

Commit

Permalink
Release: v0.2.0 (#302)
Browse files Browse the repository at this point in the history
## Changes

- Enforcing unique email addresses for users.
- Removed logo from users since it wasn't being used.
- Improved initial form for students.
  • Loading branch information
Gustavo-SF authored Sep 16, 2024
1 parent 81baab3 commit 07b2212
Show file tree
Hide file tree
Showing 19 changed files with 139 additions and 123 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.0] - 2024-09-16

- Enforcing unique email addresses for users.
- Removed logo from users since it wasn't being used.
- Improved initial form for students.

## [0.1.0] - 2024-08-24

### Added
Expand Down
1 change: 0 additions & 1 deletion deploy/ldsa-portal/templates/django-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ data:
DJANGO_SETTINGS_MODULE: config.settings.settings

# GRADING
BATCH_NAME: batch8
STUDENT_REPO_NAME: batch-workspace
GRADING_USERNAME: portal-api

Expand Down
3 changes: 0 additions & 3 deletions deploy/ldsa-portal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ env:
- name: STUDENT_REPO_NAME
key: STUDENT_REPO_NAME
configMapName: django-configmap
- name: BATCH_NAME
key: BATCH_NAME
configMapName: django-configmap
- name: GRADING_USERNAME
key: GRADING_USERNAME
configMapName: django-configmap
Expand Down
1 change: 0 additions & 1 deletion portal/ci.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ GRADING_USERNAME=portal-api
STUDENT_REPO_NAME=batch6-workspace
# ADMISSIONS
# ------------------------------------------------------------------------------
BATCH_NAME=batch5
# GENERAL
# ------------------------------------------------------------------------------
DJANGO_DEBUG=true
Expand Down
2 changes: 1 addition & 1 deletion portal/config/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)
BASE_URL = env.str("BASE_URL")
STUDENT_REPO_NAME = env.str("STUDENT_REPO_NAME")
BATCH_NAME = env.str("BATCH_NAME")
IN_DEV = True if "dev" in BASE_URL else False

# ADMISSIONS
# ------------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions portal/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
InstructorsSignupView.as_view(),
name="instructors_signup",
),
# path("",
# TemplateView.as_view(template_name="pages/home.html"),
# name="home"),
# path("about/",
# TemplateView.as_view(template_name="pages/about.html"),
# name="about",
# ),
path("", HomeRedirectView.as_view(), name="home"),
# Django Admin, use {% url 'admin:index' %}
path(settings.ADMIN_URL, admin.site.urls),
Expand Down
2 changes: 0 additions & 2 deletions portal/fixtures/initial.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,6 @@
updated_at: 2021-04-14 20:32:27.106363+00:00
date_joined: 2021-04-14 20:32:27.106363+00:00
name: Admin
logo: qwe
student: false
slack_member_id: qwe
github_username: qwe
Expand Down Expand Up @@ -924,7 +923,6 @@
created_at: 2021-04-14 20:32:27.106363+00:00
updated_at: 2021-04-14 20:32:27.106363+00:00
name: ''
logo: ''
student: true
slack_member_id: 'U01SZUU0R2M'
github_username: ''
Expand Down
1 change: 0 additions & 1 deletion portal/local.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ GRADING_USERNAME=portal-api
STUDENT_REPO_NAME=batch6-workspace
# ADMISSIONS
# ------------------------------------------------------------------------------
BATCH_NAME=batch5
# GENERAL
# ------------------------------------------------------------------------------
DJANGO_DEBUG=true
Expand Down
6 changes: 4 additions & 2 deletions portal/portal/grading/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def get_checksum_url(self):
return urljoin(settings.BASE_URL, url)

def get_image(self):
return f"ldssa/{settings.BATCH_NAME}-{self.grade.unit.code.lower()}"
prefix = "dev-" if settings.IN_DEV else ""
return f"ldssa/{prefix}batch-{self.grade.unit.code.lower()}"

def get_name(self):
id_ = "".join(random.choices(string.ascii_lowercase, k=8))
Expand Down Expand Up @@ -165,7 +166,8 @@ class AdmissionsGradingMixin(AcademyGradingMixin):
notebook_view_name = "grading:admissions-notebook"

def get_image(self):
return f"ldssa/{settings.BATCH_NAME}-admissions-{self.grade.unit.code.lower()}:latest"
prefix = "dev-" if settings.IN_DEV else ""
return f"ldssa/{prefix}batch-admissions-{self.grade.unit.code.lower()}:latest"

def get_env(self):
env = super().get_env()
Expand Down
20 changes: 20 additions & 0 deletions portal/portal/static/css/project.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,23 @@ table img {
background-color: #f2dede;
border-color: #eed3d7;
}

/* Center the form on the page */
.form-container {
margin: 0 auto;
max-width: 600px;
}

/* Style the deploy key section */
.deploy-key {
background-color: #f8f9fa;
padding: 15px;
border-radius: 5px;
font-family: monospace;
}

/* Customize button styles */
.btn-secondary {
background-color: #6c757d;
border-color: black;
}
100 changes: 42 additions & 58 deletions portal/portal/templates/base.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,33 @@
{% load static i18n compress%}<!DOCTYPE html>
{% load static i18n compress %}
<!DOCTYPE html>
<html lang="en">
<head>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{% block title %}LDSA Portal{% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
<![endif]-->

<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

{% block css %}

<!-- Latest compiled and minified Bootstrap 4.1.1 CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous"></head>


<!-- Your stuff: Third-party CSS libraries go here -->
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-..." crossorigin="anonymous">
<!-- FontAwesome CSS -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="..." crossorigin="anonymous">
<!-- Custom CSS -->
{% compress css %}
<!-- This file stores project-specific CSS -->

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

{% endcompress %}
{% endblock %}

</head>
{% endblock css %}
</head>

<body>
<body>

<div class="mb-1">
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="{% url 'home' %}"><img src="{% static "images/ldssa_white.png" %}" alt="LDSA Portal"></a>
<a class="navbar-brand" href="{% url 'home' %}">
<img src="{% static 'images/ldssa_white.png' %}" alt="LDSA Portal" height="30">
</a>


<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
Expand Down Expand Up @@ -161,40 +147,38 @@

</div>

<div class="container">

{% if messages %}
{% for message in messages %}
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">{{ message }}</div>
{% endfor %}
{% endif %}

{% block content %}
<p>Use this document as a way to quick start any new project.</p>
{% endblock content %}

</div> <!-- /container -->

{% block modal %}{% endblock modal %}
<div class="container mt-4">
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endif %}


{% block content %}
<!-- Default content -->
{% endblock content %}
</div>

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
{% block javascript %}

<!-- Required by Bootstrap v4.1.1 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>

<!-- Your stuff: Third-party javascript libraries go here -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">


<!-- place project specific Javascript in this file -->
{% compress js %}
<script src="{% static 'js/project.js' %}"></script>
{% endcompress %}
{% block modal %}{% endblock modal %}

{% block javascript %}
<!-- jQuery, Popper.js, and Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="..." crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="..." crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="..." crossorigin="anonymous"></script>
<!-- Custom JS -->
{% compress js %}
<script src="{% static 'js/project.js' %}"></script>
{% endcompress %}
{% endblock javascript %}
</body>
</html>
Expand Down
45 changes: 28 additions & 17 deletions portal/portal/templates/users/user_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@
{% block title %}{{ user.username }}{% endblock %}

{% block content %}
<h1>{{ user.username }}</h1>
<form class="form-horizontal" method="post" action="{% url 'users:profile' %}">
{% csrf_token %}
{{ form|crispy }}
<div class="control-group">
<div class="controls">
<button type="submit" class="btn">Update</button>
</div>
<div class="container mt-4">
<h1 class="mb-4 text-center">Update User Data</h1>

<div class="row justify-content-center form-container">
<div class="col-md-6">
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>
</div>
</div>

<h2 class="mt-5">Deploy Key</h2>
<div class="card mb-3">
<div class="card-body deploy-key">
<p class="card-text">{{ user.deploy_public_key }}</p>
</div>
</div>
</form>
<h2>Deploy Key</h2>
<p>{{ user.deploy_public_key }}</p>
<p>
<a href="{% url 'account_set_password' %}">
Change password
</a>
</p>
{% endblock %}

<p>
<a href="{% url 'account_set_password' %}" class="btn btn-secondary">
<i class="fas fa-key"></i> Change Password
</a>
</p>
</div>
{% endblock content %}
1 change: 0 additions & 1 deletion portal/portal/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class UserAdmin(auth_admin.UserAdmin):
"gender",
"profession",
"company",
"logo",
"github_username",
"slack_member_id",
"failed_or_dropped",
Expand Down
33 changes: 12 additions & 21 deletions portal/portal/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,37 @@


class UserChangeForm(forms.ModelForm):
name = forms.CharField()
name = forms.CharField(required=True)
github_username = forms.CharField(required=True)
slack_member_id = forms.CharField(required=True)

def __init__(self, *args, **kwawgs) -> None:
super().__init__(*args, **kwawgs)
if config.PORTAL_STATUS == "academy":
del self.fields["gender"]
del self.fields["profession"]
del self.fields["company"]
del self.fields["ticket_type"]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

# Remove fields based on portal status
if config.PORTAL_STATUS == "academy":
fields_to_remove = ["gender", "profession", "company", "ticket_type"]
else:
del self.fields["logo"]
del self.fields["github_username"]
del self.fields["slack_member_id"]
if config.PORTAL_STATUS not in (
"admissions",
"admissions:applications",
):
fields_to_remove = ["github_username", "slack_member_id"]
if config.PORTAL_STATUS not in ("admissions", "admissions:applications"):
self.fields["ticket_type"] = forms.ChoiceField(
choices=TicketType.choices,
disabled=True,
)
for field in fields_to_remove:
del self.fields[field]

class Meta:
model = User
fields = (
"name",
"logo",
"github_username",
"slack_member_id",
"gender",
"profession",
"company",
"ticket_type",
)
widgets = {
"logo": forms.TextInput(),
"github_username": forms.TextInput(),
"slack_member_id": forms.TextInput(),
}


class UserCreationForm(django.contrib.auth.forms.UserCreationForm):
Expand Down
16 changes: 16 additions & 0 deletions portal/portal/users/migrations/0021_remove_user_logo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.14 on 2024-09-15 21:58

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("users", "0020_user_academy_type_preference"),
]

operations = [
migrations.RemoveField(
model_name="user",
name="logo",
),
]
Loading

0 comments on commit 07b2212

Please sign in to comment.