I have model that represents a file, and has a FileField, that I am rendering via an Inline Formset. When a user fills in the form it gets saved with no problems. However, I want the users to be able to continue editing the file, but when I re-display the newly created object, the data for the FileField doesn't show, so if the user edits some data but doesn't re-upload the file, she gets an error. How can I make the formset render the FileField's current value within the form field?
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 django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---