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.contrib import admin | |
from .models import Gallery, Image | |
class ImageInline(admin.StackedInline): | |
model = Image | |
extra = 0 | |
fields = ('image',) | |
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
------------------------ EXEMPLO 1 ----------------------- | |
Hello World. | |
World { | |
font-style: bold; | |
color: green; | |
} | |
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
import random | |
notas = ['C', 'D', 'E', 'F', 'G', 'A', 'B'] | |
while True: | |
nota = random.randint(0, len(notas) - 1) | |
if nota == (len(notas) - 1): | |
nota = 0 |
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.contrib import admin | |
from django.contrib.flatpages.models import FlatPage | |
class MyFlatPageAdmin(admin.ModelAdmin): | |
class Media: | |
js = ('1.js', '2.js',) | |
admin.site.unregister(FlatPage) | |
admin.site.register(FlatPage, MyFlatPageAdmin) |
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
#!/usr/bin/env python | |
# Copyright (C) 2013 by Claudemiro Alves Feitosa Neto | |
# <[email protected]> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
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 ExtraMixin(object): | |
def get_context_data(self): | |
context = super(ExtraMixin, self).get_context_data() | |
context['random'] = RandomModel.objects.all() | |
return context | |
class MyBeatifulView(ExtraMixin, TemplateView): | |
... |
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
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.mysql', | |
'NAME': 'nome-do-banco', | |
'USER': 'ususario-do-banco', | |
'PASSWORD': 'senha', | |
'HOST': 'localhost', | |
'PORT': '3306', | |
} | |
} |
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
#!/usr/bin/python | |
import sys | |
import MySQLdb | |
import subprocess | |
my_host = "localhost" | |
my_user = "usuario" | |
my_pass = "senha" | |
my_db = "banco" | |
command_restart_mysql = "service mysql restart" |
http://udinic.wordpress.com/2013/07/24/write-your-own-android-sync-adapter/ https://github.com/Udinic/SyncAdapter
Criando Contas (Autenticator)