Commit 67abdece authored by Ciella Francisco's avatar Ciella Francisco 😵

Implemented the form to be used in creating new events in the front-end side

parent 9020a682
from accounts import models as accounts
from django import forms
from .models import Event
# class EventForm(forms.ModelForm):
# class Meta:
# model = Event
# fields = ["event_name", "event_datetime_start", "event_datetime_end", "event_organizer", "event_header", "last_time_bumped"]
class EventForm(forms.Form):
event_name = forms.CharField(label='Event Name', max_length=150)
event_datetime_start = forms.DateTimeField(label='Event Start Date and Time')
event_datetime_end = forms.DateTimeField(label='Event End Date and Time')
event_organizer = forms.ModelChoiceField(label='Event Organizer', queryset=accounts.CustomUser.objects.all(),
)
event_header = forms.ImageField(label='Event Header Photo')
last_time_bumped = forms.DateTimeField(label='Last Time Bump')
\ No newline at end of file
{% extends 'base.html' %}
{% block event_form %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="{{ STATIC_URL }}css/bootstrap.css" rel="stylesheet" type="text/css"/>
<script src="{{ STATIC_URL }}js/bootstrap.js"></script>
{{ form.media }}
{% endblock %}
{% load static %}
{% block title %}Widget's Forum{% endblock %}
{% block content %}
{ form.non_field_errors }
{% for field in form %}
{% if field.errors %}
<p>{{ field.label }} has the following errors:</p>
<ul>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
<form action="/add" method="post">
{% csrf_token %}
{{ form }}
</form>
{% endblock %}
\ 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