FileField parser populating other fields

1 view
Skip to first unread message

Paulo VJ

unread,
Sep 26, 2011, 11:55:32 AM9/26/11
to django...@googlegroups.com
Hello Everyone,

I'm looking to building an Model where it's fields are populated by the contents of a PDF file.
I've come to this solution, one I didn't like:

class ContaPdf(models.Model):
  conta_pdf = models.FileField(upload_to='conta_pdf')
  
class Conta(models.Model)
  data_inicio = models.DateField()
  data_fim = models.DateField()
  data_vencimento = models.DateField()
  telefone = models.ForeignKey(Telefone)

@receiver(pos_save, sender=ContaPdf)
def pdf_parser(sender, **kwards):
  # Parses data from PDF file and create/save Conta object.

Is there any easier way to do this, considering I'll be using mostly django.admin as interface?
I can't quite see the alternatives.

Thanks a lot,
Paulo
Reply all
Reply to author
Forward
0 new messages