# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#     * Rearrange models' order
#     * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.

from django.db import models


class Adresses(models.Model):
    nom = models.CharField(max_length=1536)
    rue = models.CharField(max_length=1536)
    codepostal = models.CharField(max_length=1536, db_column='codePostal') # Field name made lowercase.
    quartier = models.CharField(max_length=1536)
    categorie = models.CharField(max_length=1536)
    urlimage = models.ImageField(upload_to='images/%Y%m%d%H%M%S',blank=True)
    telephone = models.CharField(max_length=60,blank=True)
    nbvote = models.IntegerField(db_column='nbVote') # Field name made lowercase.
    totalvote = models.IntegerField(db_column='totalVote') # Field name made lowercase.
    description = models.CharField(max_length=1536,blank=True)
    urlweb = models.CharField(max_length=765, db_column='urlWeb',blank=True) # Field name made lowercase.
    latitude = models.FloatField(blank=True)
    longitude = models.FloatField(blank=True)
    dateupdate = models.DateTimeField(auto_now=True)
    valide = models.BooleanField()
    def __unicode__(self):
      return u'%s' % (self.nom)
    def thumbnail(self):
     return """<img src="%s" width="160" height="120"/>""" % (self.urlimage)
    thumbnail.allow_tags = True

    class Meta:
        db_table = "adresses"
