Opened 19 years ago

Closed 19 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

Description

I get this error: http://django.pastebin.com/344429 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: http://django.pastebin.com/344456

Change History (3)

comment:1 by Boffbowsh, 19 years ago

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

comment:2 by Dagur Páll Ammendrup, 19 years ago

Changing the pre_save method in django/core/meta/fields.py 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 datetime.datetime.now()
        return value

comment:3 by Adrian Holovaty, 19 years ago

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