You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
3.2 KiB

<html>
<head>
{% load static %}
<link rel="stylesheet" href="{% static 'redis_app/style.css' %}">
</head>
<body>
<nav>
<a href="{% url 'home' %}">Home</a>
{% if person == '' %}
<a href="{% url 'login_form' %}">Login</a>
<a href="{% url 'register_form' %}">Register</a>
{% else %}
<a href="{% url 'courses' %}">Courses</a>
<a href="{% url 'profile' %}">Profile</a>
<a href="{% url 'search' %}">Search</a>
<a href="{% url 'notifications_view' %}">Notifications</a>
{% if person.role == 'Teacher' %}
<a href="{% url 'publish_message' %}">Publish a message</a>
{% endif %}
<a href="{% url 'logout' %}">Logout</a>
{% endif %}
</nav>
<div class="body">
<div class="container">
<!--
Redirects to my view called create_course_form which handles the POST result of the form to create a course.
I won't repeat this part because for all form, it will be the same
-->
<form action="{% url 'create_course_form' %}" method="POST">
<!--
What a great feature... As we seen in Security module, csrf are really dangerous attacks on form. We have to prevent them.
And Django helped us with this really short code, but soooo useful!
-->
{% csrf_token %}
<fieldset>
<legend><h1>Create a course</h1></legend>
{% if error_message %}
<p class="error-message">{{ error_message }}</p>
{% endif %}
{% if success_message %}
<p class="success-message">{{ success_message }}</p>
{% endif %}
<label for="title">Course Title</label>
<input type="text" name="title" id="title" class="input" required>
<label for="summary">Course Summary</label>
<textarea name="summary" id="summary" required></textarea>
<label for="level">Course Level</label>
<select name="level" id="level" required>
<option value="Beginner">Beginner</option>
<option value="Intermediate">Intermediate</option>
<option value="Advanced">Advanced</option>
</select>
<label for="places" class="input">Number of Places</label>
<input type="number" name="places" id="places" min="1" class="input" required>
</fieldset>
<div class="submit-container">
<input type="submit" value="Create Course" class="submit">
</div>
</form>
</div>
</div>
</body>
</html>