Created
September 14, 2013 19:47
-
-
Save manuel14/6565013 to your computer and use it in GitHub Desktop.
ladero
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 Noticia(models.Model): | |
titulo = models.TextField() | |
texto = models.TextField(help_text='Redacta la Noticia') | |
autor = models.TextField(verbose_name='Autor') | |
#imagen = models.ImageField(upload_to='rrpp', verbose_name='imagen') | |
#tiempo_registro = models.DateTimeField(auto_now=True) | |
usuario = models.ForeignKey(User) | |
def __unicode__(self): | |
return self.titulo | |
def guardar_noticia(request): | |
if request.method=='POST': | |
titulo = request.POST['titulo'] | |
autor = request.POST['autor'] | |
texto = request.POST['texto'] | |
noticia = Noticia(titulo, autor, texto) | |
noticia.save() | |
return HttpResponseRedirect('/') | |
else: | |
return HttpResponseRedirect('/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment