def abonstat(request):
abons = {}
abform = AbonStatForm(request.GET)
if abform.is_valid():
if abform.cleaned_data['client']:
abons = Uslugi.objects.filter(
client_id=abform.cleaned_data['client'])
return render(request, 'clients/abonstat.html',
{'abons': abons, 'abform': abform})
https://www.googleapis.com/youtube/v3/videos?id=" + videoId + "&key="+ apiKey + "&fields=items(snippet(title))&part=snippet"
-e, --get-title Simulate, quiet but print title
xhr.setRequestHeader("X-CSRFToken", csrftoken);
{% block header %}{%endblock%}
{% block header %}
{{ block.super }}
{%endblock%}
<div
id="user"
data-username="{{ user.username }}">
<script>
var _user = document.getElementById('user');
var username = _user.dataset.username;
Comments
db_table = 'article'
comments_article
article_title
import os
import datetime
def user_directory_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
return os.path.join(
instance.user.name,
datetime.datetime.now().strftime('%Y_%m_%d__%H_%M'),
filename)
class MyModel(models.Model):
upload = models.FileField(upload_to=user_directory_path)