django forms.py widgets cannot render in template (UpdateView) - django-views

I got the a problem, widgets in forms.py cannot render in template.
I want to create edit form in my application and i try used widgets in forms.py, but the widgets cannot render in template.
Any solutions ?
Form in html render like this, (class, placeholder, etc not rendering) :
IMAGE FORM EDIT
forms.py
class UserUsulanUpdatePenelitianForm(ModelForm):
class Meta:
model = UserUsulan
exclude = ['status_usulan' ,'jumlah_dana_disetujui', 'keterangan_operator', 'com_reviewer_1', 'com_reviewer_2' ]
widget = {
'anggota' : Select2MultipleWidget({'class' : 'form-control select2-multi', 'multiple' : 'multiple', 'name' : 'tags' }),
'tmt_awal' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Awal', 'type' : 'date'}),
'tmt_akhir' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Akhir', 'type' : 'date'}),
'judul_penelitian' : forms.Textarea({'class' : 'form-control', 'placeholder' : 'Judul Penelitian', 'rows':3, 'cols':20}),
}
views.py
class UserUsulanPenelitianUpdateView(LoginRequiredMixin, UpdateView):
template_name = 'dashboard/usulan-penelitian-edit.html'
form_class = UserUsulanUpdatePenelitianForm
queryset = UserUsulan.objects.all()
context_object_name = 'listUsulanPenelitian'
def form_valid(self, form):
messages.success(self.request, 'Usulan Penelitian Telah Diedit!')
return super().form_valid(form)
def get_success_url(self):
return reverse('dashboard:usulan-penelitian')
usulan-penelitian-edit.html
<form method="post">
{% csrf_token%}
{{form.errors}}
<div class="inputbox mt-3"> {{form.ketua}} <span>Ketua Penelitian</span> </div>
<div class="row">
<div class="col-md-6">
<div class="inputbox mt-3 mr-2"> {{form.anggota}} <i class="fa fa-users"></i> <span>Anggota</span> </div>
</div>
<div class="col-md-6">
<div class="d-flex flex-row">
<div class="inputbox mt-3 mr-2"> {{form.tmt_awal}} <span>TMT Awal</span> </div>
<div class="inputbox mt-3 mr-2"> {{form.tmt_akhir}} <span>TMT Akhir</span> </div>
</div>
</div>
</div>
<div class="mt-4 mb-4">
<h6 class="text-uppercase">Detail Penelitian</h6>
<div class="row mt-3">
<div class="inputbox mt-3"> {{form.judul_penelitian}} <span>Judul Penelitian</span> </div>
<div class="col-md-4">
<div class="inputbox mt-3 mr-2"> {{form.tahun}} <span>Tahun</span> </div>
</div>
<div class="col-md-4">
<div class="inputbox mt-3 mr-2"> {{form.jenis_penelitian}} <span>Jenis</span> </div>
</div>
<div class="col-md-4">
<div class="inputbox mt-3 mr-2"> {{form.bidang_penelitian}} <span>Bidang</span> </div>
</div>
</div>
<div class="row mt-2">
<div class="col-md-6">
<div class="inputbox mt-3 mr-2"> {{form.skema_penelitian}} <span>Skema</span> </div>
</div>
<div class="col-md-6">
<div class="inputbox mt-3 mr-2"> {{form.target_luaran}} <span>Target</span> </div>
</div>
</div>
<div class="row mt-2">
<div class="col-md-12">
<div class="inputbox mt-3 mr-2"> {{form.tujuan_sosial_ekonomi}} <span>Tujuan Sosial Ekonomi</span> </div>
</div>
</div>
</div>
<div class="mt-4 mb-4">
<h6 class="text-uppercase">Dana Penelitian</h6>
<div class="row mt-3">
<div class="col-md-6">
<div class="inputbox mt-3 mr-2"> {{form.jumlah_dana_usulan}} <span>Dana Usulan</span> </div>
</div>
</div>
</div>
<input type="submit" name="simpan" id="simpan" class="btn btn-primary btn-user btn-block" value="Simpan"/>
</form>

the widgets cannot render because typo in write code widget. The Correct code is widgets not widget
before
widget = {
'anggota' : Select2MultipleWidget({'class' : 'form-control select2-multi', 'multiple' : 'multiple', 'name' : 'tags' }),
'tmt_awal' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Awal', 'type' : 'date'}),
'tmt_akhir' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Akhir', 'type' : 'date'}),
'judul_penelitian' : forms.Textarea({'class' : 'form-control', 'placeholder' : 'Judul Penelitian', 'rows':3, 'cols':20}),
}
after
widgets = {
'anggota' : Select2MultipleWidget({'class' : 'form-control select2-multi', 'multiple' : 'multiple', 'name' : 'tags' }),
'tmt_awal' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Awal', 'type' : 'date'}),
'tmt_akhir' : forms.TextInput({'class' : 'form-control', 'placeholder' : 'TMT Akhir', 'type' : 'date'}),
'judul_penelitian' : forms.Textarea({'class' : 'form-control', 'placeholder' : 'Judul Penelitian', 'rows':3, 'cols':20}),
}

Related

CheckboxSelectMultiple widget Django renders already collapsed in form

I am trying to create a form where you can enter the language or languages. I want to use a CheckboxSelectMultiple widget, but it renders already collapsed in the form:
The form with already collapsed select
How can I fix this?
forms.py:
class TweetForm(forms.ModelForm):
class Meta:
model = TweetSearch
fields = ['search_term', 'query_type', 'start_date', 'end_date', 'language', 'country', 'tweet_count']
widgets = {
'search_term': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Search...'}),
'query_type': forms.Select(attrs={'class': 'form-control'}),
'tweet_count': forms.NumberInput(attrs={'class': 'form-control', 'placeholder': 'Number of tweets'}),
'start_date': DateTimePickerInput(attrs={'class': 'form-control', 'placeholder': 'From'}),
'end_date': DateTimePickerInput(attrs={'class': 'form-control', 'placeholder': 'Till'}),
'language': forms.CheckboxSelectMultiple(attrs={'class':'form-control'})
}
html:
<div id="searchcontainer">
<div class="card w-50 text-center mx-auto mt-8" id="searchcard">
<div class="card-header">
Search
</div>
<div class="card-body">
<h5 class="card-title">Search for tweets</h5>
<form action="" method="POST">
{% csrf_token %}
<div class="form-row">
<div class="form-group col-md-4">
{{form.search_term}}
</div>
<div class="form-group col-md-4">
{{form.query_type}}
</div>
<div class="form-group col-md-4">
{{form.tweet_count}}
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
{{form.start_date}}
</div>
<div class="form-group col-md-6">
{{form.end_date}}
</div>
</div>
<div class="form-row">
{{form.language}}
</div>
<input class="btn btn-primary mb-2" type="submit">
</form>
</div>
</div>

Django Using setCustomValidity method in form fields clean

new to Django and Python here, building my first project.
I´m making a form for registering new user and I´m controlling my fields in a forms.py file
class UserRegisterForm(forms.ModelForm):
password1 = forms.CharField(
label='Contraseña',
required=True,
widget=forms.PasswordInput(
attrs={
# 'placeholder': 'Contraseña',
'class': 'input-group-field',
'oninvalid': "this.setCustomValidity('Ingrese una contraseña')",
'oninput': "setCustomValidity('')"
}
)
)
password2 = forms.CharField(
label='Contraseña',
required=True,
widget=forms.PasswordInput(
attrs={
# 'placeholder': 'Repetir Contraseña',
'class': 'input-group-field',
'oninvalid': "this.setCustomValidity('Repita la contraseña')",
'oninput': "setCustomValidity('')"
}
)
)
class Meta:
"""Meta definition for Userform."""
model = User
fields = (
'user_name',
'full_name',
'phone',
'email',
'role',
'gender',
'date_birth',
)
widgets = {
'user_name': forms.TextInput(
attrs={
# 'placeholder': 'Usuario ...',
'class': 'input-group-field',
'max_length': '20',
'oninvalid': "this.setCustomValidity('Ingrese un nombre de usuario')",
'oninput': "setCustomValidity('')"
}
),
'full_name': forms.TextInput(
attrs={
# 'placeholder': 'Nombres ...',
'class': 'input-group-field',
'max_length': '100',
'oninvalid': "this.setCustomValidity('Ingrese su nombre completo')",
'oninput': "setCustomValidity('')"
}
),
'phone': forms.TextInput(
attrs={
# 'placeholder': 'Teléfono ...',
'class': 'input-group-field',
'max_length': '50',
'oninvalid': "this.setCustomValidity('Ingrese su teléfono')",
'oninput': "setCustomValidity('')"
}
),
'email': forms.EmailInput(
attrs={
# 'placeholder': 'Correo Electronico ...',
'class': 'input-group-field',
'max_length': '100',
'blank': True,
'oninvalid': "this.setCustomValidity('Ingrese un mail válido')",
'oninput': "setCustomValidity('')"
}
),
'role': forms.Select(
attrs={
# 'placeholder': 'Rol ...',
'class': 'input-group-field',
'required': True,
}
),
'gender': forms.Select(
attrs={
# 'placeholder': 'Género ...',
'class': 'input-group-field',
}
),
'date_birth': forms.DateInput(
format='%Y-%m-%d',
attrs={
'type': 'date',
'class': 'input-group-field',
},
),
}
def clean_password2(self):
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
self.add_error('password2', 'Las contraseñas no son iguales')
Everything is working fine showing this kind of "error messages" in my html
So I have a method for clean password2, to check is the same as password 1 (Password confirmation), and I want the error message, to be the same format as the other fields.
Is this possible?
Thanks for your help!
I also attach here my template
{% extends "panel.html" %}
{% load static %}
{% block panel-content %}
<div class="grid-x medium-10">
<h3 class="cell medium-12" style="text-align: center;color: wheat;">Nuevo Usuario</h3>
<div class="cell medium-12">&nbsp </div>
<div class="cell medium-12 grid-x">
<div class="cell medium-2"></div>
<form class="cell medium-8 grid-x" method="POST">{% csrf_token %}
<div class="cell medium-4">
<label>Usuario:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-torso"></i></span>
{{ form.user_name }}
</div>
</div>
<div class="cell medium-9"></div>
<div class="cell medium-4">
<label>Nombre:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-book"></i></span>
{{form.full_name}}
</div>
</div>
<div class="cell medium-1"></div>
<div class="cell medium-3">
<label>Género:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-male-female"></i></span>
{{form.gender}}
</div>
</div>
<div class="cell medium-1"></div>
<div class="cell medium-3">
<label>Fecha de Nacimiento:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-calendar"></i></span>
{{ form.date_birth }}
</div>
</div>
<div class="cell medium-4">
<label>Email:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-mail"></i></span>
{{form.email}}
</div>
</div>
<div class="cell medium-1"></div>
<div class="cell medium-3">
<label>Teléfono:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-telephone"></i></span>
{{form.phone}}
</div>
</div>
<div class="cell medium-4"></div>
<div class="cell medium-4">
<label>Rol:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-star"></i></span>
{{form.role}}
</div>
</div>
<div class="cell medium-8"></div>
<div class="cell medium-4">
<label>Contraseña:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-key"></i></span>
{{ form.password1 }}
</div>
</div>
<div class="cell medium-1"></div>
<div class="cell medium-4">
<label>Repetir Contraseña:</label>
<div class="input-group">
<span class="input-group-label"><i class="fi-key"></i></span>
{{ form.password2 }}
</div>
</div>
<!-- {% for error in form.password2.errors %}
<p class="cell" style="color: red;">
{{ error|escape }}
</p>
{% endfor %} -->
<div class="cell medium-3"></div>
<div class="cell medium-2">
<button type="submit" class="cell success button "> <i class="fi-save"></i>&nbsp Guardar</button>
</div>
</form>
<div class="cell medium-2"></div>
</div>
</div>
{% endblock panel-content %}
I think you might be interested in this answer : https://stackoverflow.com/a/54020111/8439435
Basically you would need to write a custom javascript function to check that both password match each other and use setCustomValidity to show a browser error message on validation of the form if passwords are different.

Issue with CreateView ,object not created in model on submit

I have issue might missed something , i have created CreateView view for submitting objects in db , all seems to ok , but when i try to submit i don't get anything happen no error at all except
"POST /create_task/ HTTP/1.1" 200 12972 ,
MY code goes as follows , please advice
Thanks
models.py
class MainTask(models.Model):
task_title = models.CharField(max_length=200)
global_task_info = models.TextField(max_length=500,default=None)
complete = models.BooleanField(default=False)
overall_precent_complete = models.PositiveIntegerField(default=0)
created_at = models.DateTimeField(default=datetime.datetime.now())
updated_at = models.DateTimeField(default=datetime.datetime.now())
due_date = models.DateTimeField(default=datetime.datetime.now())
task_location = models.CharField(max_length=400, blank=True, null=True)
global_task_assign = models.ForeignKey(UserProfile, on_delete=models.CASCADE, related_name="global_task_assign",default=1)
TASK_STATUS_CHOICES = [
('ST', 'STARTED'),
('NS', 'NOT STARTED'),
('IP', 'IN PROGRESS'),
('PA', 'PAUSED'),
('CO', 'COMPLETED'),
]
task_status = models.CharField(max_length=2,choices=TASK_STATUS_CHOICES,default='NOT STARTED')
def __str__(self):
return self.task_title
forms.py
class TaskCraetionForm(forms.ModelForm):
TASK_STATUS_CHOICES = [
('ST', 'STARTED'),
('NS', 'NOT STARTED'),
('IP', 'IN PROGRESS'),
('PA', 'PAUSED'),
('CO', 'COMPLETED'),
]
task_title = forms.CharField(max_length=200, widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Task Title'}))
global_task_info = forms.CharField(max_length=500, widget=forms.Textarea(attrs={'class':'form-control','placeholder':'Task Description'}))
due_date = forms.DateTimeField(widget=forms.DateTimeInput(attrs={
'class': 'form-control',
'id': 'picker'
}))
global_task_assign = forms.ModelChoiceField(queryset= UserProfile.objects.all(), widget=forms.Select(attrs={'class':'form-control'} ))
task_status = forms.ChoiceField(label='', choices=TASK_STATUS_CHOICES, widget=forms.Select(attrs={'class':'form-control'}))
class Meta:
model = MainTask
fields = ['task_title',
'global_task_info',
'due_date',
'global_task_assign',
'task_status',
]
views.py
class CreatTaskView(CreateView):
model = MainTask
template_name = "create_newtask.html"
form_class = TaskCraetionForm
success_url = None
def form_valid(self, form):
f = form.save(commit=False)
f.save()
return super(CreatTaskView, self).form_valid(form)
Thank you very much Alasdair you're comment gave me the direction and more added the following to my HTML template shown below and found out i have issue with my datetime picker format needed to added the following
Thanks
INPUTֹTIMEֹFORMATS = [
'%Y/%m/%d %H:%M']
due_date = forms.DateTimeField(input_formats=INPUTֹTIMEֹFORMATS, widget=forms.DateTimeInput(attrs={
'class': 'form-control',
'id': 'picker'
}))
html temaplate
<form action="" method="POST">
<h3 class="mt-3 text-left">Create New Task</h3>
<hr>
<p class="text-muted text-left">Creat New Itom task</p>
{% csrf_token %}
{% if form.errors %}
<!-- Error messaging -->
<div id="errors">
<div class="inner">
<p>There were some errors in the information you entered. Please correct the following:</p>
<ul>
{% for field in form %}
{% if field.errors %}<li>{{ field.label }}: {{ field.errors|striptags }}</li>{% endif %}
{% endfor %}
</ul>
</div>
</div>
<!-- /Error messaging -->
{% endif %}
<div class="input-group mt-3 mb-3 mr-auto">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1"><i class="fas fa-book-medical"></i></span>
</div>
{{ form.task_title}}
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-pen"></i></span>
</div>
{{form.global_task_info}}
</div>
<!---date time picker-->
<h6 class="text-left">Task Due Date</h6>
<div class="input-group date mb-3 col-3">
<div class="input-group-append">
<div class="input-group-text"><i class="fa fa-calendar"></i></div>
</div>
{{ form.due_date }}
</div>
<!--end of date time picker-->
<!---user assign-->
<h6 class="text-left">Assign Task to IT member</h6>
<div class="input-group mb-3 mt-3 col-8">
<div class="input-group-prepend">
<div class="input-group-text"><i class="fas fa-user-tie"></i></div>
{{form.global_task_assign}}
</div>
</div>
<!--End Of User Assign-->
<h6 class="text-left">Set Task Status</h6>
<div class="input-group mb-3 mt-3 col-4">
<div class="input-group-prepend">
<div class="input-group-text"><i class="far fa-caret-square-right"></i></div>
</div>
{{form.task_status}}
</div>
<div class="col text-left">
<button type="submit" value="Save" class="btn btn-primary btn-lg text-white mt-2"><span><i class="fas fa-database"></i></span> Create Task</button>
</div>
</form>
</div>
</div>

Django RadioSelect field not rendering correctly

I'm using Django FilterSet to enable the user to filter a list of products on my website. Everything is working perfectly, I'm using standard html code to display a form. However there is a RadioSelect field that is not rendering correclty and I don't understand why. I provide you below the relevant parts of my code as well as a screenshot of the rendering problem. Does anyone know how I can solve that ?
filters.py
class PlatFilter(django_filters.FilterSet):
titre = django_filters.CharFilter(
field_name='titre', label='Mot clé :', lookup_expr='icontains',
widget=forms.TextInput(attrs={'class': 'form-control'}),
)
prix_min = django_filters.NumberFilter(
field_name='prix', label='Prix minimum :', lookup_expr='gte',
widget=forms.NumberInput(attrs={'class': 'form-control'}),
)
prix_max = django_filters.NumberFilter(
field_name='prix', label='Prix maximum :', lookup_expr='lte',
widget=forms.NumberInput(attrs={'class': 'form-control'}),
)
nb_portions = django_filters.NumberFilter(
field_name='nb_portions', label='Nombre de portions minimum :', lookup_expr='gte',
widget=forms.NumberInput(attrs={'class': 'form-control'}),
)
date_prep = django_filters.DateFilter(
field_name='date_prep__date', label='Date de préparation (format JJ/MM/AAAA)', lookup_expr='exact',
widget=forms.DateTimeInput(attrs={'class': 'form-control'}),
)
CHOICES = ((True, 'Oui'), (False, 'Non'))
is_delivering = django_filters.BooleanFilter(
field_name='chef__is_delivering', label='Livraison comprise',
widget=forms.RadioSelect(attrs={'class': 'form-control'}, choices=CHOICES),
)
class Meta:
model = Plat
fields = ['titre', 'nb_portions', 'date_prep']
html file (using Bootstrap)
<div class="col-md-3">
<div class="filters shadow-sm rounded bg-white mb-4">
<div class="filters-header border-bottom pl-4 pr-4 pt-3 pb-3">
<h5 class="m-0" style="font-size: 200%">Filtrer par</h5>
</div>
<div class="filters-body">
<form method="get">
<div class="well">
<div class="row">
<div class="col-md-12 pl-5 pb-4 pt-4 pr-5">
{% csrf_token %}
{% for field in filter.form %}
<div class="fieldWrapper form-group" style="font-size: 150%">
{{ field.label_tag }}
{{ field }}
</div>
{% endfor %}
<button type="submit" class="btn btn-primary">
<span class="glyphicon glyphicon-search"></span> Rechercher
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
Screenshot of the problem :

Trying to Save Multiple Files in Django: didn't return an HttpResponse object. It returned None instead

Please help out. I'm trying to save multiple files in Django using CreateView. But I'm only able to save the last file on the list selected. Then i changed my views to a function view matching most of the explanation i saw in here .. Now i'm getting Value Error.
Below are the two views. The CreateView(CBV) and the function View.
Thanks
CreateView
#method_decorator(login_required, name='dispatch')
class UpdateMatterCreateView(CreateView):
form_class = UpdateMatterForm
model = MatterUpdates
template_name = 'matter/matter_instance_create.html'
success_url = reverse_lazy('matter_list')
def form_valid(self, form):
form = UpdateMatterForm(self.request.POST, self.request.FILES)
with transaction.atomic():
form.instance.client_id = self.kwargs['client_id']
form.instance.firm_id = self.kwargs['firm_id']
form.instance.matter_id = self.kwargs['matter_id']
form.instance.user_id = self.request.user.id
files = self.request.FILES.getlist('files')
for f in files:
docs_path = Documents.objects.create(matter_update_id=self.kwargs['matter_id'], file_path=f)
docs_path.save()
return super(UpdateMatterCreateView, self).form_valid(form)
def get_context_data(self, **kwargs):
context = super(UpdateMatterCreateView, self).get_context_data(**kwargs)
context['object'] = Matter.objects.get(id=self.kwargs['matter_id'])
return context
Function Views
def update_matter_instance(request, firm_id, client_id, matter_id):
if request.method == 'POST':
form = UpdateMatterForm(request.POST, request.FILES)
if form.is_valid():
title = form.instance.title
content = form.instance.content
created_date = form.instance.created_date
created_time = form.instance.created_time
matter_update_link = MatterUpdates.objects.create(firm_id=firm_id, client_id=client_id,
matter_id=matter_id, title=title, content=content,
created_date=created_date, created_time=created_time,
user_id=request.user.id, )
matter_update_link.save()
files = request.FILES.getlist('files')
for f in files:
docs_path = Documents.objects.create(matter_update_id=matter_id, file_path=f)
docs_path.save()
return redirect('matter_list')
else:
form = UpdateMatterForm()
return render(request, 'matter/matter_instance_create.html', {'form': form})
forms.py
class UpdateMatterForm(forms.ModelForm):
class Meta:
model = MatterUpdates
exclude = ['matter', 'client', 'firm', 'sys_date', 'user']
widgets = {
'title': forms.TextInput(
attrs={'class': 'form-control', 'placeholder': 'Enter Title'}),
'content': RichTextFormField(),
'created_date': forms.DateInput(
attrs={'class': 'form-control', 'placeholder': 'mm/dd/yyyy'}),
'created_time': forms.TimeInput(
attrs={'class': 'form-control', 'id': 'timepicker2', 'type': 'text'}),
'files': forms.ClearableFileInput(attrs={'multiple': True})
}
urls.py
FUCNTION REGEX
url(r'^legal_stallion/stallion_matter_instance_update/(?P<firm_id>[0-9A-Fa-f-]+)/(?P<client_id>[0-9A-Fa-f-]+)/'
r'(?P<matter_id>[0-9A-Fa-f-]+)/$', views.update_matter_instance, name='update_matter_instance'),
CLASS REGEX
url(r'^legal_stallion/stallion_matter_instance_update/(?P<firm_id>[0-9A-Fa-f-]+)/(?P<client_id>[0-9A-Fa-f-]+)/'
r'(?P<matter_id>[0-9A-Fa-f-]+)/$', views.UpdateMatterCreateView.as_view(), name='update_matter_instance'),
Templates
<form class="cmxform form-horizontal " id="commentForm" method="post" action="#" enctype="multipart/form-data">
{% csrf_token %}
{{ form.errors }}
<div class="form-group " style="margin-bottom: 0px; margin-top: 0px">
<label for="cname" class="control-label col-lg-3">Title <span style="color: darkred">*</span></label>
<div class="col-lg-6">
{{ form.title }}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Date <span style="color: darkred">*</span></label>
<div class="col-lg-3">
<div class="input-group date">
{{ form.created_date }}
<span class="input-group-addon"><i class="glyphicon glyphicon-th fa fa-calendar"></i></span>
</div>
</div>
<div class="col-sm-3">
<div class="input-group bootstrap-timepicker timepicker">
{{ form.created_time }}
<span class="input-group-addon"><i class="glyphicon glyphicon-time fa fa-clock-o"></i></span>
</div>
</div>
</div>
<div class="form-group " style="margin-bottom: 0px; margin-top: 0px; margin-bottom: 10px">
<label for="cemail" class="control-label col-lg-3">Content </label>
<div class="col-lg-8">
{{ form.content }}
</div>
</div>
<div class="form-group " style="margin-bottom: 0px; margin-top: 0px; margin-bottom: 10px">
<label for="cemail" class="control-label col-lg-3">Select Files </label>
<div class="col-lg-6">
{{ form.files }}
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-3 col-lg-6">
<button class="btn btn-primary" type="submit">Submit</button>
</div>
</div>
</form>