Hi Malcolm, thanks for your reply.
> So, perhaps you could give a small, reduced to the minimum, example of
> how you're setting all this up. Maybe it's a problem in inline formsets,
> or maybe it's an oversight in your code. At the moment, hard to tell.
>
I included the View and Model in my original post, I reproduce it here
in case you don't have access to the whole thread:
Here's the view, the Parent model is "Articulo", the inline model is
"Archivo":
ArchivoInlineFormSet = inlineformset_factory(Articulo, Archivo,
extra=3)
@login_required
def create_article(request, id=False):
text = "Enviar"
button = "Enviar"
user = request.user
if request.method == 'POST':
#save data for new article
form = ArticuloForm(request.POST, request.FILES)
if form.is_valid():
#save info
articulo = form.save()
articulo.autores.add(user.get_profile())
articulo.save()
formset = ArchivoInlineFormSet(request.POST,
request.FILES, instance=articulo)
if formset.is_valid():
formset.save()
else:
#start editing new article
form = ArticuloForm()
formset = ArchivoInlineFormSet()
objContext = RequestContext(request, locals())
return render_to_response("editar/articulo.html", objContext)
------------------
And the class, the troublesome field is "archivo":
class Archivo(models.Model):
articulo = models.ForeignKey(Articulo)
tipo = models.IntegerField()
numero = models.IntegerField()
archivo = models.FileField(upload_to="archivos")
etapa = models.IntegerField()
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---