from django.contrib import admin
from .models import WorkingBase
from .models import Blacklist
admin.site.register(WorkingBase) # Первое подключение WorkingBase
admin.site.register(Blacklist)
class WorkingBaseAdmin(admin.ModelAdmin):
list_display=('title', 'price3')
search_fields=('title')
admin.site.register(WorkingBase) # Второе подключение WorkingBase
The message must contain author(unauthenticated user) email and text, create date and update date.
if request.method == 'POST':
if 'bannedphrase' in request.POST: # Имя кнопки
bannedphraseform = BannedPhraseForm(request.POST, prefix='banned')
if bannedphraseform.is_valid():
bannedphraseform.save()
expectedphraseform = ExpectedPhraseForm(prefix='expected')
elif 'expectedphrase' in request.POST:
expectedphraseform = ExpectedPhraseForm(request.POST, prefix='expected')
if expectedphraseform.is_valid():
expectedphraseform.save()
bannedphraseform = BannedPhraseForm(prefix='banned')
else:
bannedphraseform = BannedPhraseForm(prefix='banned')
expectedphraseform = ExpectedPhraseForm(prefix='expected')
# Вызвать напрямую
var = ModelDeal.STATUS_CHOISES
# Создать метод класса
@classmethod
def return_choises(cls):
return cls.STATUS_CHOISES
***
var = ModelDeal.return_choises()
@register.filter
def get_active_portfolio_items(client):
return Portfolio.objects.filter(client=client, active=True)
{% for port in i|get_active_portfolio_items%}
{{ port}}
{% endfor %}
function add_to_cart(id) {
let token = '{{csrf_token}}';
$.ajax({
headers: { "X-CSRFToken": token },
url: '/add-to-cart/',
type: 'POST',
data: {'id':id},
success: function(data) {
get_cart()
},
failure: function(data) {
console.log('Не успешно');
}
});
}