Opened 14 years ago

Closed 13 years ago

#412 closed defect (fixed)

FileField bug

Reported by: Dagur Páll Ammendrup Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version:
Severity: minor Keywords: FileField Upload
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I get this error: When I try to create a new message with an attachment. But still the object is created and the file seems to be added to my media directory.

However, if I create the message first and then edit it, adding the attachment, I get no errors and no problems.

The model validates and I'm using revision 547.
here is my model:

Change History (3)

comment:1 Changed 14 years ago by Boffbowsh

My initial attempt to fix it is here, but this brought up this error when Dagur tried to edit it in admin

comment:2 Changed 14 years ago by Dagur Páll Ammendrup

Changing the pre_save method in django/core/meta/ to this did the trick (and as far as I can see it doesn't break anything):

    def pre_save(self, value, add):
        if self.auto_now or (self.auto_now_add and add) or value=='':
        return value

comment:3 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

I assume this is fixed by now, so I'm closing...

Note: See TracTickets for help on using tickets.
Back to Top