class Edito(models.Model):
title = models.CharField(max_length=50)
cover_picture = models.ImageField(upload_to=edito_picture_upload_path, blank=True, null=True)
picture = CloudinaryField('image', blank=True, null=True)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React Tutorial</title> | |
<!-- Not present in the tutorial. Just for basic styling. --> | |
<link rel="stylesheet" href="css/base.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ --> | |
<html> | |
<head> | |
<title>iOS 8 web app</title> | |
<!-- CONFIGURATION --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
First technique, use set | |
""" | |
# two querysets or lists | |
q1 | |
>>> [<obj1>,<obj2>, <obj3>] | |
q2 | |
>>> [<obj4>,<obj2>, <obj5>] | |
# compare querysets : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get to the directory you want to share | |
cd <mydirectory> | |
# step 1: Get your ip adress | |
python | |
import socket | |
print socket.gethostbyname(socket.gethostname()) | |
quit() # back to shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TaggedProducts(GenericTaggedItemBase): | |
[...] | |
# filter products by tags | |
@classmethod | |
def filter(cls, *tags): | |
products = Products.objects.all() | |
for tag in tags: | |
if tag not in (t.slug for t in ProductTags.objects.all()): # not good for speed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Products(models.Model): | |
# [....] | |
picture = models.ImageField(upload_to='products', blank=True, null=True) | |
picture_2 = models.ImageField(upload_to='products', blank=True, null=True) | |
picture_3 = models.ImageField(upload_to='products', blank=True, null=True) | |
# [....] | |