This file contains hidden or 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
| boto==2.12.0 | |
| sorl-thumbnail==11.12 |
This file contains hidden or 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
| from django.forms.util import ErrorList | |
| from django import forms | |
| class ContractUpdateView(UpdateView): | |
| model = Contract | |
| template_name = 'contract/contract_form.html' | |
| form_class = ContractForm | |
| def form_valid(self, form): | |
| if self.request.POST.get('finish'): |
This file contains hidden or 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
| <a class="facebook-button" id="js-facebook_link" href="{% url 'social:begin' 'facebook' %}?next={{ request.get_full_path|urlencode }}"> | |
| <span class="img-facebook-login"></span>Login with Facebook | |
| </a> | |
| <a class="twitter-button" id="" href="{% url 'social:begin' 'twitter' %}?next={{ request.get_full_path|urlencode }}"> | |
| <span class="img-twitter-login"></span>Login with Twitter | |
| </a> | |
| <a class="linkedin-button" id="" href="{% url 'social:begin' 'linkedin' %}?next={{ request.get_full_path|urlencode }}"> | |
| <span class="img-linkedin-login"></span>Login with LinkedIn | |
| </a> | |
| <a class="google-button" id="" href="{% url 'social:begin' 'google-oauth2' %}?next={{ request.get_full_path|urlencode }}"> |
This file contains hidden or 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
| invoice_6_contract_5_items = invoice_6.invoice_items.filter( | |
| contract=self.contract5 | |
| ) | |
| print invoice_6_contract_5_items.first().id, invoice_6_contract_5_items.last().id | |
| print invoice_6_contract_5_items[0].id, invoice_6_contract_5_items[1].id | |
| output >> | |
| 22 22 | |
| 22 23 |
This file contains hidden or 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
| for d in app1 app2 appN; do | |
| cd $d | |
| ../manage.py makemessages --all | |
| cd .. | |
| done |
This file contains hidden or 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
| # Install the latest version of Node: | |
| brew install node | |
| # Install Bundler | |
| sudo gem install bundler | |
| bower install | |
| # Install required node packages | |
| npm install -g bower |
This file contains hidden or 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
| from itertools import chain | |
| for item in chain(qs1, qs2, qs3): | |
| # ... |
This file contains hidden or 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
| { | |
| "favourites": [2, 3], | |
| "hobbies": [ | |
| { | |
| "name": "playing football", | |
| "id": 1 | |
| }, | |
| { | |
| "name": "reading books", | |
| "id": 2 |
This file contains hidden or 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
| from django.forms.models import model_to_dict | |
| model_to_dict(instance, fields=[], exclude=[]) |
This file contains hidden or 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 MyModel(models.Model): | |
| updated_at = models.DateTimeField( | |
| default=timezone.now, | |
| auto_now=True, | |
| ) |