Sample.objects.filter(sampledate__gt=datetime.date(2011, 1, 1),
sampledate__lt=datetime.date(2011, 1, 31))
Sample.objects.filter(date__range=["2011-01-01", "2011-01-31"])
if request.is_ajax():
JsonResponse(
# data, encoder=DjangoJSONEncoder,
safe=False,
# json_dumps_params=None,
{'like_counter': 42})
# https://docs.python.org/3/library/decimal.html
from decimal import Decimal
class Product(models.Model):
price = models.DecimalField('Цена')
# подумай, почему никто никогда не использует флоат для денег
discount = models.IntegerField('Скидка')
def get_price_with_discount(self):
return self.price * Decimal(self.discount)
Disabling Touchpad while Typing
Go to System > Preferences > Mouse > Touchpad and uncheck 'Disable touchpad while typing' and 'Enable mouse clicks with touchpad'. (This method is not available under Ubuntu 14.04.)
sudo apt-get install touchpad-indicator
ffmpeg -y -i input -c:v libx264 -preset medium -b:v 555k -pass 1 -c:a libfdk_aac -b:a 128k -f mp4 /dev/null && \
ffmpeg -i input -c:v libx264 -preset medium -b:v 555k -pass 2 -c:a libfdk_aac -b:a 128k output.mp4
-pass 2
-f mp4
указывать нужно если твой input хреново распознался ffmpeg-oм