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 functools import wraps | |
from django.http import HttpResponseRedirect, HttpResponse | |
from django.contrib.auth.models import Group | |
from django.http import Http404 | |
# ya despues solo importalo y usa @decorador arriba de tu función asi evitarar repetir código | |
def decorador(f): | |
def wrap(request, *args, **kwargs): | |
#Aqui la magia de negocio |
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.conf import settings | |
import re | |
class SubdominiosMiddleware: | |
def process_request(self, request): | |
request.domain = request.META['HTTP_HOST'] | |
request.subdomain = '' | |
parts = request.domain.split('.') | |
if len(parts) == 3 or (re.match("^localhost", parts[-1]) and len(parts) == 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.contrib import admin | |
from django.contrib.auth.admin import UserAdmin | |
from django.contrib.auth.models import User | |
admin.site.unregister(User) | |
class MyUserAdmin(UserAdmin): | |
filter_horizontal = ('user_permissions', 'groups') | |
save_on_top = True | |
list_display = ('username', 'email', 'is_staff', 'last_login') |
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.core.exceptions import PermissionDenied | |
from django.http import HttpResponse | |
from pyExcelerator import * | |
def export_as_xls(modeladmin, request, queryset): | |
""" | |
Exporta XLS totalmente generico | |
Requiere pyExcelerator |
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.db import models | |
import ParsePy | |
ParsePy.APPLICATION_ID = "" | |
ParsePy.MASTER_KEY = "" | |
class ParseObject(models.Model): | |
objectdId = models.CharField(max_length=100, null=True, blank = True) | |
class Meta: | |
abstract = True |
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
settings.py: | |
MEDIA_ROOT = 'C:/Server/Projects/project_name/static/' | |
MEDIA_URL = '/static/' | |
ADMIN_MEDIA_PREFIX = '/media/' | |
urls.py: | |
from django.conf import settings |
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
Tienes que tener Xcode Pre instalado | |
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
Bajar Command Line Tools de https://developer.apple.com/downloads/index.action# | |
Simlink a x11 : ln -s /opt/X11 /usr/X11 | |
brew list |
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
package org.brounie.android.widget.viewflow.noknokerapp.Adapters; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.graphics.Color; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.ArrayAdapter; | |
import android.widget.ImageView; |
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
/** | |
* Created with IntelliJ IDEA. | |
* User: arturojamaicagarcia | |
* Date: 14/07/12 | |
* Time: 04:17 | |
* To change this template use File | Settings | File Templates. | |
*/ | |
// Declaramos el Adaptador usamos templates | |
public class BaseAdapter extends ArrayAdapter<Object> { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="fill_parent" | |
android:layout_height="wrap_content" | |
> | |
<LinearLayout android:layout_width="fill_parent" |