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
git remote set-url --add origin url1 | |
git remote set-url --add origin url2 | |
git remote set-url --add origin url3 | |
git remote set-url --add origin url4 | |
git push |
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 djqscsv import render_to_csv_response | |
def csv_view(request): | |
#queryset | |
qs = Foo.objects.filter(bar=True).values('id', 'bar') | |
return render_to_csv_response(qs) |
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
DROP DATABASE <database name>; | |
CREATE DATABASE <database name>; | |
\l |
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): | |
onefield = models.CharField('The field', max_length=100) | |
class MyModelAdmin(admin.ModelAdmin): | |
def has_add_permission(self, request): | |
# if there's already an entry, do not allow adding | |
count = MyModel.objects.all().count() | |
if count == 0: | |
return True | |
return False |
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 Form1( ModelForm ): | |
class Meta: | |
model = AModel | |
fields = ( 'fieldA', ) | |
class Form2( ModelForm ): | |
class Meta: | |
model = AModel | |
fields = ( 'fieldB', ) |
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
<script src="/static/parsleyjs/dist/parsley.min.js"></script> | |
{% load bootstrap3 %} | |
<form class="form-horizontal form-label-left" data-parsley-validate> | |
{%bootstrap_form form layout='horizontal'%} | |
<div class="form-group"> | |
<div class="col-md-6 col-md-offset-3"> | |
<button type="reset" class="btn btn-primary">Reset</button> | |
<button id="send" type="submit" class="btn btn-success">Submit</button> | |
</div> | |
</div> |
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 AuthorForm(ModelForm): | |
class Meta: | |
model = Author | |
fields = ('name', 'title', 'birth_date') | |
labels = { | |
'name': _('Writer'), | |
} | |
help_texts = { | |
'name': _('Some useful help text.'), | |
} |
NewerOlder