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
GitHub username:armonge | |
Day job:Web Developer | |
Favorite open source project:Django | |
Open Source contributions (if any): | |
Stranded on an island, what 3 items do you take:Flashlight,matches, satellite phone | |
Tie-breaker, pick a number between 1 and 20,000:32433 |
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 GoogleMapMarker(object): | |
def __init__(self, latitude, longitude): | |
self.latitude = latitude | |
self.longitude = longitude | |
def __unicode__(self): | |
return '%f,%f'%(self.latitude, self.longitude) | |
def __len__(self): | |
return len(self.__unicode__()) |
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 ContentTypeRestrictedFileField(models.FileField): | |
""" | |
Tomado de http://nemesisdesign.net/blog/coding/django-filefield-content-type-size-validation/ | |
Same as FileField, but you can specify: | |
* content_types - list containing allowed content_types. Example: ['application/pdf', 'image/jpeg'] | |
* max_upload_size - a number indicating the maximum file size allowed for upload. | |
2.5MB - 2621440 | |
5MB - 5242880 | |
10MB - 10485760 | |
20MB - 20971520 |
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 TranslatableModelMixin(models.Model): | |
''' | |
Adapted from http://snippets.dzone.com/posts/show/2979 | |
''' | |
language = models.CharField(max_length=2, choices=settings.LANGUAGES, db_index=True) | |
translation_of = models.ForeignKey( | |
to='self', | |
related_name='translation_set', | |
limit_choices_to={'language' : settings.DEFAULT_LANGUAGE}, | |
blank=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
Day job: Web Developer in Nicaragua | |
Favorite Python project: Django | |
Favorite Conference: Haven't attended any yet :( | |
Python Experience Level: Intermediate |
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
Day job: Web Developer | |
What is your language of choice: Python | |
Open Source contributions: No biggies here, just some patch in https://github.com/mozes/smpp.pdu | |
How do you use GitHub: Mostly i work for organizations that provide me some git repos here, but i also mantain some gists and template django projects i use regularly |
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
###### NEW: | |
from django.conf.urls.defaults import * | |
from sporty import views | |
urlpatterns = patterns('', | |
url( | |
# 30 characters or fewer. Letters, numbers and @/./+/-/_ characters: | |
r'^users/(?P<username>[a-zA-Z0-9@.+-_]+)/$', |
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 ProductAdmin(admin.ModelAdmin): | |
list_display = ('name','thumb') | |
def thumb(self, obj): | |
return render_to_string('thumb.html',{ | |
'image': obj.image | |
}) | |
thumb.allow_tags = 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
from bs4 import BeautifulSoup | |
from urlparse import parse_qs, urlparse | |
from urlparse import unquote, urlparse, parse_qs | |
from concurrent.futures import ProcessPoolExecutor | |
import urllib | |
import sys | |
video_list = [] | |
sys.setrecursionlimit(10000) |
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
import urlparse | |
import re | |
from django.db import models | |
from django import forms | |
def validate_youtube_url(value): | |
'''El patron lo saque de http://stackoverflow.com/questions/2964678/jquery-youtube-url-validation-with-regex''' | |
pattern = r'^http:\/\/(?:www\.)?youtube.com\/watch\?(?=.*v=\w+)(?:\S+)?$' |
OlderNewer