Show list depending class (Django) - django

I have the following problem.
<div class="variable">
<ul class="1">
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
<ul class="2">
<li>2</li>
<li>2</li>
<li>2</li>
<li>2</li>
<li>2</li>
</ul>
<ul class="3">
<li>3</li>
<li>3</li>
<li>3</li>
<li>3</li>
<li>3</li>
</ul>
<ul class="4">
<li>4</li>
<li>4</li>
<li>4</li>
<li>4</li>
<li>4</li>
</ul>
<ul class="5">
<li>5</li>
<li>5</li>
<li>5</li>
<li>5</li>
<li>5</li>
</ul>
</div>
I need that when "variable" is for example "1" list only shows "1".
Is possible?
I need to display a list depending on the class of the DIV. The DIV class is variable, generates my system, but no problem, since the set as ordinary HTML.
Regards
UPGRADE
I'm use web in Django.
I have get a list of the ID of the category. I wanted to put that DIV ID in order to display only the list match that number.
As you comment that I can not use numbers, I have to use the name, the problem is that a category called "LOGITECH MICE" and the class does not allow me to put a space, any solution?
My Django template is:
{% load i18n %}
{% load thumbnail %}
{% load modules %}
{% module {category_decription|catalog.right} id="sidebar" class="block" %}
<div style="float:right; width: 700px; margin-right: 10px; margin-bottom: 10px;" id="slider">
<div><img border="0" src="/../../static/banners_productos/{{ query.id }}/01.jpg" ></img></div>
</div>
<style>
ul.marcas{
display: none;
}
div.SMARTPHONES ul{
display: none;
color: green;
}
div.SMARTPHONES ul.SMARTPHONES{
display: block;
}
div.FAX ul{
display: none;
color: green;
}
div.FAX ul.FAX{
display: block;
}
.fabricante { display: inline; }
</style>
<div style="background-color:#fff;" id="content">
<div id="catalog-category" class="block clearfix">
<!--div class="catalog-head"-->
<div class="toolbar toolbar-top">
<span style=" float: left;" class="view-mode">Productos : {{ values|length }}/{{ total }}</span>
<div class="items-pager">
<span class="items-drop"><select onchange="setLocation('paginator',this.value)">{% for item in paginator_items %}<option value="{{ item }}"{% if paginator_option == item %} selected="selected"{% endif %}>{{ item }}</option>{% endfor %}</select> Mostrar</span>
</div>
<!--div style="float: left; margin-left: 25px;"><span class="view-mode">Stock </span><a style="color:#1D9107;" href="?available=1">OK</a><a style="color:#f00;" href="?available=0">NO</a></div-->
<div class="items-sort">
<span class="sort-drop">Ordenar por
<select onchange="setLocation('order',this.value)">{% for order in catalog_orders %}<option value="{{ order }}"{% if order_option == order %} selected="selected"{% endif %}>{% trans order %}</option>{% endfor %}</select>
{% if order_by_option = 'desc' %}<a style="color:#fff; margin-left: 15px;" href="#" onclick="setLocation('order_by','asc')">Descendente<img style="height: 22px; float: right; margin-left: 4px; margin-right: 15px;" border="0" src="/../../static/asce.png" ></img></a>{% else %}<a style="color: #FFF !important; margin-left: 15px;" href="#" onclick="setLocation('order_by','desc')">Ascendente<img style="height: 22px; float: right; margin-left: 4px; margin-right: 15px; " src="/../../static/des.png" ></img></a>{% endif %}</span>
</div>
</div>
{% if values|length == 0 %}<p class="note-msg">{% trans "No existen productos en esta categoria." %}</p>{% endif %}
<!--/div-->
<!--div class="catalog-body"-->
<div style="height: 40px; margin-top: -10px; padding: 10px; height: 30px;" class="{{ query.name }}">
<ul class="marcas FAX">
<li class="fabricante">BROTHER</li>
</ul>
<ul class="marcas IMPRESORAS">
<li class="fabricante">HP</li>
<li class="fabricante">BROTHER</li>
<li class="fabricante">EPSON</li>
</ul>
<ul class="marcas SMARTPHONES">
<li class="fabricante">TP LINK</li>
<li class="fabricante">TENDA</li>
<li class="fabricante">{{ query.id }}</li>
</ul>
</div>
{% if mode_option == 'list' %}
<ul id="catalog-list">{% for value in values %}
<li id="product-{{value.product.id}}" class="product-item block clearfix">
<div class="product-detail">
<div>
<img src="{% thumbnail value.base_image.url 150x150 product_zoook.png %}" title="{{value.name}}" />
</div>
<div style="width: 420px; float: left; height: 15px; overflow: hidden;"><h2>{{value.name}}</h2></div>
<div style="width: 365px; float:left;">
<div style="height: 35px; float:left;"></div>
<div style="width: 50%; float: left; height: 15px; font-size: 10px;">Ref: {{value.code}}</h2></div>
<div style="width: 50%; float: left; height: 15px; font-size: 10px;">Part Number: {{value.variants}}</h2></div>
<div style="width: 50%; float: left; height: 15px; font-size: 10px;">Categoria: {{ query.name }}</h2></div>
<div style="width: 110px; float: left;font-size: 10px;">
<img style="height: 22px; float: left; margin-top: 7px;" src="../../../../static/images/info_ico.png" />
</div>
</div>
<div style="width: 150px; float: right;">
{% if value.status %}
{% if value.product.available %}
<img style="height: 15px; margin-top: -16px; margin-left: 79px; margin-bottom: 14px;" src="../../../../static/images/ok.jpg" />
{% else %}
<img style="height: 15px; margin-top: -16px; margin-left: 79px; margin-bottom: 14px;" src="../../../../static/images/ok.jpg" />
{% endif %}
{% else %}
</div>
<div class="out-service ico border3b"><h3>{% trans "This product is out of service" %}</h3></div>
{% endif %}
{% if user.is_authenticated %}
<div id="product-price-{{value.product.id}}" class="price-box">
<span class="regular-price">
<span class="price3">
{% if currency_position == 'before' %}{{ currency }} {{value.price}}{% else %}{{value.price}} {{ currency }}{% endif %}
</span>
</span>
</div>
</div>
{% else %}
<a style="margin-right: 12px; width: 90px; float: right; height: 16px; padding: 5px; margin-top: 5px; background-image: url('/static/images/menu_pequeño/reg.jpg');" class="boton5" href="http://www.broadband-technologies.es/es/partner/login"><span style="padding-left: 20px;"></span></a>
{% endif %}
</li>{% endfor %}
</ul>
{% endif %}
<!--/div--></div>
{% if product_products.paginator.num_pages > 1 %}
<div id="paginator" class="pagination toolbar-bottom">
<span class="step-links">
{% if product_products.has_previous %}
{% trans "Previous" %}
{% endif %}
<span class="current">
{% trans "Page" %} {{ product_products.number }} DE {{ product_products.paginator.num_pages }}
</span>
{% if product_products.has_next %}
{% trans "Next" %}
{% endif %}
</span>
</div>{% endif %}
</div>
<!--/div-->
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.zproduct.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.fancybox-1.3.4.pack.js"></script>
{% if update_price and user.is_authenticated and values|length > 0 %}<script type="text/javascript" src="{{ STATIC_URL }}js/jquery.zupdateprice.js"></script>{% endif %}
You may get a list of the categories? Easier ... to display only manufacturers that contain a category?
My main problem is this (that's why I ask the code).:
- I have a page in Django
- I products, categories and manufacturers.
- I want to take, when you are in a category, a list of manufacturers who have products in that category.
Best Regards

First of all - CSS class shouldn't be a pure integer. So I use letters in my answer since numbers doesn't work. Normally it should be something more descriptive though.
Define CSS rules like:
div.a ul{
display: none;
color: green;
}
div.a ul.a{
display: block;
}
div.c ul{
display: none;
color: red;
}
div.c ul.c{
display: block;
}
Here is the fiddle - http://jsfiddle.net/FC6vF/
The color rule is just to mark the difference in the fiddle and you can omit this.
For Django template - put this code:
{% for css_class in fancy_css_classes %}
div.{{ css_class }} ul{
display: none;
color: red;
}
div.{{ css_class }} ul.{{ css_class }}{
display: block;
}
{% endfor %}
inside <style>...</style> tag and pass the list of classes as a context variable fancy_css_classes from your view.

Related

Elements going inside div tag when using context

My pages have a normal layout like so
When trying to include the calendar on the /calendar url everything seems to just squish under the calendar tab.
views.py
#login_required
def calendar(request):
context={}
results = get_events(request)
#context['results'] = results
d = date.today()
print(d)
cal = Calendar(d.year, d.month)
html_cal = cal.formatmonth(results, withyear=True)
context['calendar'] = mark_safe(html_cal)
context['nmenu'] = 'calendar'
editProfileForm = UserProfileForm(instance=request.user)
context['editProfileForm'] = editProfileForm
if request.method=="POST":
if 'editProfileForm' in request.POST:
editProfileForm = UserProfileForm(request.POST or None, request.FILES or None,instance=request.user)
if editProfileForm.is_valid():
editProfileForm.save()
editProfileForm = UserProfileForm(instance=request.user)
context['editProfileForm'] = editProfileForm
context['is_post'] = False
return render(request, "home.html", context)
else:
context['is_post'] = True
context['editProfileForm'] = editProfileForm
return render(request, "home.html", context)
return render(request, 'home.html', context)
calendar.html
{% block content %}
<style>
.calendar {
width: 98%;
margin: auto;
font-size: 13px;
}
.calendar tr, .calendar td {
border: 1px solid black;
}
.calendar th {
padding: 10px;
text-align: center;
font-size: 18px;
}
.calendar td {
width: 200px;
height: 150px;
padding: 20px 0px 0px 5px;
}
.month {
font-size: 25px;
}
.date {
font-size: 16px;
}
ul {
height: 100%;
padding: 0px 5px 0px 20px;
}
</style>
<h1>Calendar</h1>
<button>+</button>
{{calendar}}
{% endblock %}
<!-- <ul>
{% for result in results %}
<li>{{result.start.date}}{% if result.end.date %}-{% endif%}{{result.end.date}}: {{result.summary}}</li>
{% endfor %}
</ul> -->
sidebar.html:
{% block content %}
<div class="col-md-3" style="float:left">
<h1>Hi {{ user.username }}!</h1>
<img class="avatar" src="{{user.get_profile_pic_url}}" >
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#editProfile">+</button>
<ul class="nav nav-tabs flex-column" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link" id="home" href="{% url 'home' %}" >Dashboard</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="calendar" href="calendar">Calendar</a>
</li>
<li class="nav-item dropdown" role="presentation">
<a class="nav-link dropdown-toggle" id="messages-tab" data-bs-toggle="dropdown" >Messages</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" id="messagesSend" href="messagesSend" >Send</a></li>
<li><a class="dropdown-item" id="messagesInbox" href="messagesInbox" >Inbox</a></li>
</ul>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="documents" href="documents" >Documents</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="medications" href="medications">Medications</a>
</li>
{% if request.user.is_staff %}
<li class="nav-item" role="presentation">
<a class="nav-link" id="adminControls" href="adminControls" >Admin</a>
</li>
{% endif %}
{% if request.user.is_staff is not True and request.user.is_doctor is not True %}
<li class="nav-item" role="presentation">
<a class="nav-link" id="bookAppointment" href="bookAppointment" >Book Appointment</a>
</li>
{% endif %}
<li class="nav-item" role="presentation">
<a class="nav-link" id="logout" href="{% url 'logout' %}" >Log out</a>
</li>
</ul>
</div>
<div class="col-md-9" style="float:right">
<div class="tab-content" id="myTabContent">
<div class="tab-pane" id="home" >
{% include 'dashboard.html' %}
</div>
<div class="tab-pane" id="calendar" >
{% include 'calendar.html' %}
</div>
<div class="tab-pane" id="messagesSend" >
{% include 'messagesSend.html' %}
</div>
<div class="tab-pane" id="messagesInbox" >
{% include 'messagesInbox.html' %}
</div>
<div class="tab-pane" id="documents" >
{% include 'documents.html' %}
</div>
<div class="tab-pane" id="medications" >
{% include 'medications.html' %}
</div>
{% if request.user.is_staff is not True and request.user.is_doctor is not True %}
<div class="tab-pane" id="bookAppointment" >
{% include 'bookAppointment.html' %}
</div>
{% endif %}
{% if request.user.is_staff %}
<div class="tab-pane" id="adminControls" >
{% include 'adminControls.html' %}
</div>
{% endif %}
</div>
</div>
{% if nmenu %}
<script type="text/javascript">
$("a#{{nmenu}}").addClass("active");
$("div#{{nmenu}}").addClass("active");
</script>
{% endif %}
{% endblock %}

Django Unable to pass a variable name in the next template

Hi I am facing a problem in my project .
In the Patient list, if a Click the Notes row present in the Add notes column. The new template load where it will list the recent notes for the patients... and also it allows me add patient notes by selecting the patient ( i am passing the objects of patients through forms )
My problem ..
How to add notes to the specified patient only. ( i.e. by not passing through forms) and also filtering to display the specfic Patient notes only.
Code
Model:
class Notes(models.Model):
doctorId = models.PositiveIntegerField(null=True)
patientName = models.CharField(max_length=40, null=True)
report = models.TextField(max_length=500)
NoteDate = models.DateTimeField(default=timezone.now)
#def __str__(self):
# return self.patientName+" "+self.report
#property
def get_id(self):
return self.id
View
#login_required(login_url='doctorlogin')
#user_passes_test(is_doctor)
def doctor_add_notes_view(request):
appointmentForm=forms.PatientNotesForm()
notes = models.Notes.objects.all().order_by('-NoteDate')
mydict={'appointmentForm':appointmentForm,'notes':notes}
if request.method=='POST':
appointmentForm=forms.PatientNotesForm(request.POST)
if appointmentForm.is_valid():
appointment=appointmentForm.save(commit=False)
appointment.doctorId =request.user.id #request.POST.get('doctorId')
doctors = models.Appointment.objects.all().filter(AppointmentStatus=True, status=True)
appointment.patientName = models.User.objects.get(id=request.POST.get('patientId')).first_name
now = datetime.now()
print("Current date and time : ")
print(now.strftime("%Y-%m-%d %H:%M:%S"))
appointment.NoteDate = now
print('doctors', doctors)
appointment.save()
return HttpResponseRedirect('doctor-view-patient')
else:
print(appointmentForm.errors)
return render(request, 'hospital/doctor_view_patient.html',{'alert_flag': True})
return render(request,'hospital/doctor_add_notes.html',context=mydict)
def doctor_view_patient_view(request):
appointments1 = models.Appointment.objects.all().filter(AppointmentStatus=False, status=True,doctorId=request.user.id)
print('appointments are ', appointments1)
patientid = []
for a in appointments1:
patientid.append(a.patientId)
print('patientid', patientid)
patients = models.Patient.objects.all().filter(PatientStatus=True, status=True, user_id__in=patientid)
print('patients', patients)
print(request.user.id)
doctor=models.Doctor.objects.get(user_id=request.user.id) #for profile picture of doctor in sidebar
print('doctor', doctor)
notes = models.Notes.objects.all().order_by('-NoteDate')
#print(notes)
return render(request,'hospital/doctor_view_patient.html',{'patients':patients,'doctor':doctor,'notes':notes})
Forms
class PatientNotesForm(forms.ModelForm):
patientId=forms.ModelChoiceField(queryset=models.Patient.objects.all().filter(status=True),empty_label="Patient Name and Symptoms", to_field_name="user_id")
class Meta:
model=models.Notes
fields=['report']
**doctor_view_patient.html
{% extends 'hospital/doctor_base.html' %}
{% block content %}
{%load static%}
<head>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<style media="screen">
a:link {
text-decoration: none;
}
h6 {
text-align: center;
}
.row {
margin: 100px;
}
</style>
</head>
<div class="container">
<div class="panel panel-primary">
<div class="panel-heading">
<h6 class="panel-title">Your Total Patient List</h6>
</div>
<table class="table table-hover" id="dev-table">
<thead>
<tr>
<th>Name</th>
<th>Profile Picture</th>
<th>Symptoms</th>
<th>Mobile</th>
<th>Address</th>
<th>Add Notes</th>
</tr>
</thead>
{{Notes.get_id}}
{% for p in patients %}
<tr>
<td> {{p.get_name}}</td>
<td> <img src="{% static p.profile_pic.url %}" alt="Profile Pic" height="40px" width="40px" /></td>
<td>{{p.symptoms}}</td>
<td>{{p.mobile}}</td>
<td>{{p.address}}</td>
<td><a class="btn btn-primary btn-xs" href="{% url 'doctor-add-notes' %}">Notes</a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endblock content %}
doctor_add_notes.html
{% extends 'hospital/doctor_base.html' %}
{% load widget_tweaks %}
{% block content %}
<head>
<style media="screen">
a:link {
text-decoration: none;
}
.note {
text-align: center;
height: 80px;
background: -webkit-linear-gradient(left, #0072ff, #8811c5);
color: #fff;
font-weight: bold;
line-height: 80px;
}
.form-content {
padding: 5%;
border: 1px solid #ced4da;
margin-bottom: 2%;
}
.form-control {
border-radius: 1.5rem;
}
.btnSubmit {
border: none;
border-radius: 1.5rem;
padding: 1%;
width: 20%;
cursor: pointer;
background: #0062cc;
color: #fff;
}
.menu {
top: 50px;
}
</style>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<br><br>
<div class="container register-form">
<div class="form">
<div class="note">
<p>Recent patient Notes</p>
</div>
</div>
<table class="table table-hover" id="dev-table">
<thead>
<tr>
<th>Name</th>
<th>Notes</th>
<th>Date</th>
</tr>
</thead>
{{Notes.get_id}}
{% for a in notes %}
<tr>
<td>{{a.patientName}}</td>
<td>{{a.report}}</td>
<td>{{a.NoteDate}}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
<form method="post">
{% csrf_token %}
<div class="container register-form">
<div class="form">
<div class="note">
<p>Add New Notes</p>
</div>
<div class="form-content">
<div class="row">
<div class="col-md-12">
<div class="form-group">
{% render_field appointmentForm.report class="form-control" placeholder="Description" %}
</div>
<div class="form-group">
{% render_field appointmentForm.patientId class="form-control" placeholder="Patient" %}
</div>
<div class="form-group">
{% render_field appointmentForm.NoteDate class="form-control" placeholder="Date" %}
</div>
</div>
</div>
<button type="submit" class="btnSubmit">Add</button>
</div>
</div>
</div>
</form>
{% endblock content %}
Can someone please help me as by clicking the Notes of a particular patient only specific to that user notes has to be displayed as well as to add notes to that patient only.
After doing some R n D i was able to get through it just added a way to pass paramter as URL
<td><a class="btn btn-primary btn-xs" href="{% url 'doctor-add-notes' p.get_name %}">Notes</a></td>
and in Views
def doctor_add_notes_view(request,value):
appointmentForm=forms.PatientNotesForm()
print('value',value)
#notes = models.Notes.objects.all().order_by('-NoteDate')
notes = models.Notes.objects.all().filter(patientName=value).order_by('-NoteDate')
so URL becomes
http://127.0.0.1:8000/doctor-add-notes/P4
this way i was able to solve the problem ( learnt a new thing )

Django CMS dynamic image

I need to dynamically change image background-image css from home page in django cms, but is imposible.
home
CSS CODE
The css has the welcome-image-area class the user needs to change the image url in the cms.
.welcome-area {
height: 100%;
}
.welcome-image-area {
position: relative;
height: 100%;
background-image: url(../images/bg/bg.jpg);
background-size: cover;
z-index: 1;
}
.welcome-image-area:after {
position: absolute;
background: rgba(0, 0, 0, .7);
left: 0;
top: 0;
width: 100%;
height: 100%;
content: "";
z-index: -1;
}
HTML CODE
base.html
<div id="welcome-image-area" class="welcome-image-area" data-stellar-background-ratio="0.6" >
<div class="display-table">
<div class="display-table-cell">
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<div class="header-text">
<h2>{% static_placeholder 'mensaje bienvenida' %}</h2>
<p>{% static_placeholder 'sub mensaje bienvenida' %}</p>
<a class="smoth-scroll hire-us-slide-btn" href="#service">Servicios <i class="fa fa-hand-pointer-o btn-hire-us" aria-hidden="true"></i></a>
<a class="slide-btn smoth-scroll" href="#contact">Contactanos <i class="fa fa-hand-pointer-o btn-contact-us" aria-hidden="true"></i></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
In those cases I would recommend to utilize the "style" attribute as following:
<div class="welcome-image-area" style="background-image: url({{ instance.image.url }})"></div>

My VideoObject isn't being picked up in my Django blog app. Does Google need time to update?

I added the appropriate markup but my videos are not showing up in Google search video tab.
Here is my markup:
{% block content %}
<div itemprop="video" itemscope itemtype="http://schema.org/VideoObject">
<meta itemprop="thumbnailUrl" content="{{post.image_url}}" />
<meta itemprop="embedURL" content="{{post.video_path}}" />
<meta itemprop="uploadDate" content="{{ post.publish }}" />
<h2 id="detail-h1">
<span itemprop="name">{{ post.title }}</span>
</h2>
{% if post.video %}
<div class="embed-responsive embed-responsive-16by9">
<iframe src="{{post.video_path}}?autoplay=1&autohide=1" class="embed-responsive-item"
frameborder="0" controls="0" allowfullscreen>
</iframe>
</div>
{% else %}
{% if post.image_url %}
<img src="{{post.image_url}}" class="img-responsive">
{% else %}
<p>upload an image</p>
{% endif %}
{% endif %}
<div style="margin-top: 10px; background: white; padding: 10px 10px 10px 10px;">
<span>
<p style="float: left">
{% if post.author %}
Author: {{post.author}}
{% endif %}
</p>
<p style="float: right" id="pub">
{%if post.draft %}<span id="draft">Draft </span>{% endif %} Publicado: {{ post.publish|date }}
</p>
</span>
<p class="tags" style="clear: both">Tags:
{% for tag in post.tags.all %}
<a href="{% url 'blog:post_list_by_tag' tag.slug %}">
{{ tag.name }}
</a>
{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
{% if user.is_authenticated %}
<p>
delete
edit
</p>
{% endif %}
<p>Share on:
<a href="https://www.facebook.com/sharer/sharer.php?u={{ request.build_absolute_uri }}"
class="btn btn-social-icon btn-facebook" target="_blank">
<span class="fa fa-facebook"></span>
</a>
<a href="https://twitter.com/home?status={{ instance.content | truncatechars:80 | urlify }}%20{{ request.build_absolute_uri }}"
class="btn btn-social-icon btn-twitter" target="_blank">
<span class="fa fa-twitter"></span>
</a>
<a href='https://plus.google.com/share?url={{ request.build_absolute_uri }}'
class="btn btn-social-icon btn-google" target="_blank">
<span class="fa fa-google"></span>
</a>
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ request.build_absolute_uri }}&title={{
instance.title }}&summary={{ share_string }}&source={{ request.build_absolute_uri }}"
class="btn btn-social-icon btn-linkedin" target="_blank">
<span class="fa fa-linkedin"></span>
</a>
</p>
</div>
<div style="margin-top: 10px; background: white; padding: 10px 10px 10px 10px;">
<p class="content-markdown"><span itemprop="description">{{post.body}}</span></p>
</div>
<div style="margin-top: 10px; background: white; padding: 10px 10px 10px 10px; margin-bottom: 10px">
<div id="disqus_thread"></div>
</div>
</div>
{% endblock content %}
{% block aside %}
<h3 class="">Similar Posts</h3>
<hr style="margin:10px">
<div class="row">
{% for post in similar_posts %}
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-12" id="similar">
<div class="thumbnail thumb">
<h6 id="date">{{ post.publish|date }}</h6>
{% if post.image %}
<img src="{{post.image.url}}" class="img-responsive post">
{% elif post.image_url %}
<img src="{{post.image_url}}" class="img-responsive post">
{% else %}
<p>upload an image</p>
{% endif %}
<div class="caption">
<a href="{{ post.get_absolute_url }}">
<h5 class="post-title" id="title">{{post.title}}</h5>
</a>
{% if user.is_authenticated %}
<p>
delete
edit
</p>
{% endif %}
</div>
</div>
</div>
{% empty %}
<p id="para">There are no similar posts yet.</p>
{% endfor %}
</div>
{% endblock aside %}
Today is Sunday May 8th 2016. I did this about 11:30 last night.
Does Google need to update its systems for it to show up? I ran it throught the Structured Data Testing Tool and It worked. I got a green check on my VideoObject. So Google is sensing it but it's not showing.
Another thing: My blog doesn't host videos. The videos are embeds from YouTube. When someone clicks the link on Google, will it send them to my site or to the source of the embed?

Angular/bootstrap collapse button collapsing all elements

I'm new to Bootstrap, Angular and Django, so I'll try my best to be as clear as possible. I have several dynamic generated div's by a django loop, and for each div a collapse button. I set the data-target of each button to a dynamically attributed id for each element (I use a django variable that is being pulled in the loop for it), but regardless of what button I press all the div's will be collapsed/uncollapsed.
{% for country in countries %}
<div class="container">
<div class="row">
<div class="country-panel col-xs-12" style="background:url({{ country.country_image}}) no-repeat; position: relative;">
<div class="row">
<div class="country-name col-xs-4 col-xs-offset-4">
<div class="row">
<div class="col-xs-12">
<p class="title">{{ country.name | upper }}</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="description-panel col-xs-12">
<div class="row">
<p class="content">{{ country.content }}</p>
</div>
<div class="row">
{% for city in country.cities %}
{% if forloop.counter <= 3 %}
{% if forloop.counter < 3 %}
<a><div class="col-xs-4 city-block right" style="background:url({{city.image}}) no-repeat; position: relative; z-index: 0;">
{% elif forloop.counter == 3 %}
<a><div class="col-xs-4 city-block" style="background:url({{city.image}}) no-repeat; position: relative; z-index: 0;">
{% endif %}
<div class="city-layer"></div>
<span class="city-name">{{city.name | upper}}</span>
</div></a>
{% endif %}
{% endfor %}
</div>
<div class="row" uib-collapse="isCollapsed" id="{{country.name}}">
{% for city in country.cities %}
{% if forloop.counter > 3 %}
{% if forloop.counter|divisibleby:3 %}
<a><div class="col-xs-4 city-block" style="background:url({{city.image}}) no-repeat; position: relative; z-index: 0;">
{% else %}
<a><div class="col-xs-4 city-block right" style="background:url({{city.image}}) no-repeat; position: relative; z-index: 0;">
{% endif %}
<div class="city-layer"></div>
<span class="city-name">{{city.name | upper}}</span>
</div></a>
{% endif %}
{% endfor %}
</div>
<div class="row">
<div class="col-xs-12">
<p class="content">{{country.description}}</p>
<p><div class="col-xs-2 col-xs-offset-10"><a class="btn-default pink-button more-cities col-xs-12" role="button" type="button" ng-click="isCollapsed = !isCollapsed" data-target="#{{country.name}}">{% trans "MORE CITIES" %}&nbsp<span class="fa fa-plus"></span></a></div></p>
</div>
</div>
<div class="button-separator col-xs-12"></div>
</div>
</div>
</div>
</div>
{% endfor %}
Please not that I've started web development a month or 2 ago and also First time posting on stackoverflow, so please be gentle.
Turns out that I forgot to pass the ng-controller in the collapse div, for the controller that has my collapse functions. Thank you for all the help anyway!