>>> class SomeClass:
... pass
...
>>> cls = SomeClass()
>>> print cls.some_var
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: SomeClass instance has no attribute 'some_var'
>>> print hasattr(cls, 'some_var')
False
>>> if not hasattr(cls, 'some_var'):
... cls.some_var = 1
...
>>> print cls.some_var
1
>>> print hasattr(cls, 'some_var')
True
>>>
>>> callable(getattr(cls, 'some_var'))
False
from poliv.settings import PUBLIC_URL
from django.conf import settings
settings.PUBLIC_URL
from django.conf import settings
from django.conf.urls.static import static
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
type()
var call= $.getJSON('https://api.vk.com/method/users.get?user_ids=' + id + '&callback=?', function(resp){
<link rel="stylesheet" href="/mint/Remodal-master/dist/remodal.css">
<link rel="stylesheet" href="/mint/Remodal-master/dist/remodal-default-theme.css">
...
from django.views.generic import ListView
...
class RecordsListView(ListView):
template_name = 'record_list_view.html'
model = Record
paginate_by = 10
...
{% for record in object_list %}
...
{% endfor %}
{% if is_paginated %}
<div class="row">
<div class="col-sm-4">
<div class="dataTables_info" id="dynamic-table_info" role="status" aria-live="polite">
Показано с {{ page_obj.start_index }} по {{ page_obj.end_index }} из {{ page_obj.paginator.count }} результатов
</div>
</div>
<div class="col-sm-2">
<div class="dataTables_paginate paging_simple_numbers" id="dynamic-table_paginate">
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="paginate_button previous" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'recordt_list'%}?page={{ page_obj.previous_page_number }}{{ search_data|set_search_data }}">Пред.</a>
</li>
{% else %}
<li class="paginate_button disabled previous" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'ticket_list'%}">Пред.</a>
</li>
{% endif %}
<li class="paginate_button active" aria-controls="dynamic-table" tabindex="0">
<a href="{% url record_list'%}?page={{page_obj.number}}{{ search_data|set_search_data }}">{{ page_obj.number }}</a>
</li>
{% if page_obj.has_next %}
<li class="paginate_button next" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'rtecord_list'%}?page={{ page_obj.next_page_number }}{{ search_data|set_search_data }}">След.</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="dynamic-table" tabindex="0">
<a href="{% url 'record_list'%}?page={{ page_obj.paginator.num_pages }}">След.</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endif %}
...