﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35658	"InMemoryFileNode object has no attribute ""name"""	David	Lucas Esposito	"Using the `InMemoryStorage` into an other model by using:

{{{#!python
# models.py

class MyModel(models.Model):
    attachment = models.FileField(...)

# script.py

obj = MyModel.objects.create(attachment=ContentFile(b'content', 'myfile.txt') 
repr(obj.attachment)
}}}

An excetption is raised: `AttributeError(""'InMemoryFileNode' object has no attribute 'name'"") raised in repr()`


This may be caused by the fact that `InMemoryFileNode` inheriths from `ContentFile` but does not use the name attribute nor uses the base class `__init__` method:

https://github.com/django/django/blob/509763c79952cde02d9f5b584af4278bdbed77b2/django/core/files/storage/memory.py#L48-L52

This resulting in a partially initialized object without an important property."	Bug	closed	File uploads/storage	4.2	Normal	fixed	storage		Ready for checkin	1	0	0	0	0	0
