Para instalar o django-ipware
pip install django-ipware
>>> g.city('74.125.79.147')
{'city': 'Ackworth',
'region': 'IA',
'area_code': 970,
| quicksort [] = [] | |
| quicksort (a:as) = quicksort [x | x <- as, x <= a] ++ [a] ++ quicksort [x | x <- as, x > a] |
Para instalar o django-ipware
pip install django-ipware
>>> g.city('74.125.79.147')
{'city': 'Ackworth',
'region': 'IA',
'area_code': 970,
| def get_formatted_text(self): | |
| """ | |
| Method used to format all gist snippets from the post. | |
| Thanks @marcelcaraciolo. | |
| """ | |
| text = re.sub( | |
| r'{{<a href=\"(.*?)\">(.*?)</a>}}', | |
| r'<script src="\1.js"></script>', | |
| self.text | |
| ) |
| <!DOCTYPE html> | |
| <html lang="pt-br"> | |
| <head> | |
| <title>Login</title> | |
| </head> | |
| <body> | |
| <form action="" method="POST"> | |
| {% csrf_token %} | |
| {{ form }} | |
| <input type="submit" value="Login" /> |
| <!DOCTYPE html> | |
| <html lang="pt-br"> | |
| <head> | |
| <title>Mobdoctor</title> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <link rel="stylesheet" href="{{STATIC_URL}}template/css/bootstrap.min.css" /> | |
| <link rel="stylesheet" href="{{STATIC_URL}}template/css/bootstrap-responsive.min.css" /> | |
| <link rel="stylesheet" href="{{STATIC_URL}}template/css/unicorn.login.css" /> | |
| <link rel="stylesheet" href="{{STATIC_URL}}css/login.css" /> |
| class Loja(models.Model): | |
| # attrs | |
| class Produto(models.Model): | |
| loja = models.ForeignKey(Loja, related_name='produtos') | |
| class PhoneFormSet(BaseModelFormSet): | |
| def __init__(self, *args, **kwargs): | |
| super(PhoneFormSet, self).__init__(*args, **kwargs) | |
| self.forms[0].empty_permitted = False |
| from django.views.generic.base import RedirectView | |
| urlpatterns = patterns('', | |
| url(r'^$', RedirectView.as_view(url='http://php.fejepe.org.br')), | |
| #etc... | |
| ) |
| class Tag(models.Model): | |
| name = models.CharField(u'Tag', max_length=100) | |
| post = models.ForeignKey(Post, related_name='tags') | |
| slug = models.SlugField(u'Slug') | |
| def get_absolute_url(self): | |
| return reverse('posts.views.tag', kwargs={'slug': self.slug}) | |
| def __unicode__(self): | |
| return unicode(self.name) |
| def get_comorbities(self): | |
| return [ | |
| field.verbose_name for field in self._meta._fields() | |
| if isinstance(field, models.BooleanField) | |
| and getattr(self, field.get_attname()) | |
| ] |