Skip to content

Instantly share code, notes, and snippets.

@fitoria
Created March 29, 2009 23:38
Show Gist options
  • Save fitoria/87569 to your computer and use it in GitHub Desktop.
Save fitoria/87569 to your computer and use it in GitHub Desktop.
from django import forms
from models import Place, RestaurantDetail
class PlaceForm(forms.Form):
""""Formulario para crear un lugar nuevo"""
name = forms.CharField(max_length = 100, required = True)
img = forms.ImageField()
#todo: agregar los demas campos
def save(self):
place = Place(name = self.cleaned_data['name']) #agregar los demas aca
place.save()
return place
def clean(self):
pass #todo agregar regla de validaciones......
class RestaurantDetailForm(forms.Form):
pass #todo todo :P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment