Skip to content

Commit

Permalink
minor changes in template
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalol committed Jan 26, 2018
1 parent 7f1f30b commit 5226f97
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
Binary file modified db.sqlite3
Binary file not shown.
2 changes: 1 addition & 1 deletion main/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def render(self, value):

class FollowColumn(Column):
def render(self, value):
return format_html('<span id = "{}-user"></span>', value.id)
return format_html('<span id = "{}-user"></span><script>hello();</script>', value.id)



Expand Down
Binary file modified main/tables.pyc
Binary file not shown.
29 changes: 18 additions & 11 deletions main/templates/main/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
<link href="{% static 'table/css/bootstrap.min.css' %}" rel="stylesheet">
<script src="{% static 'table/js/jquery.min.js' %}"></script>
<script src="{% static 'table/js/bootstrap.min.js' %}"></script>
<script type="text/javascript">
function hello() {

{% for equipment in equipments %}
{% if request.user in equipment.followers.all %}
$('#'+{{ equipment.id }}+'-user').html( '<input type="button" name="'+{{equipment.id }}+'" value="Unfollow" onclick="cancelfollow(this.name)" />' );
console.log({{ equipment.id }});

{% else %}
$('#'+{{ equipment.id }}+'-user').html( '<input type="button" name="'+{{equipment.id }}+'" value="Follow" onclick="follow(this.name)" />' );
{% endif %}
{% endfor %}

};
</script>

</head>
<body>
<center>
Expand Down Expand Up @@ -67,16 +83,7 @@ <h1>Equipments</h1>
});
}
</script>
<script type="text/javascript">

{% for equipment in equipments %}
{% if request.user in equipment.followers.all %}
setTimeout(function () {$('#'+{{ equipment.id }}+'-user').html( '<input type="button" name="'+{{equipment.id }}+'" value="Unfollow" onclick="cancelfollow(this.name)" />' );}, 1000)

{% else %}
setTimeout(function () {$('#'+{{ equipment.id }}+'-user').html( '<input type="button" name="'+{{equipment.id }}+'" value="Follow" onclick="follow(this.name)" />' );}, 1000)
{% endif %}
{% endfor %}
</script>


</body>
</html>
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ django-notify-x==0.1.7
jsonfield==2.0.2
pytz==2017.2
six==1.11.0
django-cron==0.5.0

0 comments on commit 5226f97

Please sign in to comment.