graphql-python / graphql-python/graphene-django
DjangoObjectType attribute of type FileField should return its url
Open
✨enhancement
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
Current behavior is to return file name for `FileField` and `ImageField` type attributes of `graphene_django.types.DjangoObjectType`.
It seems completely unusable as we always need an actual url of the file or image on a client.
Thus the one is forced to implement something like the following for every `FileField`:
```python
class CompanyNode(types.DjangoObjectType):
logo = graphene.String()
class Meta:
model = models.Company
interfaces = (relay.Node,)
def resolve_logo(self, args, context, info):
return self.logo and self.logo.url
```
Contributor guide
Assessment
This issue has not been assessed yet.