{"action":"created","issue":{"url":"https://api.github.com/repos/tomturner/django-tenants/issues/72","repository_url":"https://api.github.com/repos/tomturner/django-tenants","labels_url":"https://api.github.com/repos/tomturner/django-tenants/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/tomturner/django-tenants/issues/72/comments","events_url":"https://api.github.com/repos/tomturner/django-tenants/issues/72/events","html_url":"https://github.com/tomturner/django-tenants/issues/72","id":138622146,"number":72,"title":"set MEDIA_ROOT per  tenant","user":{"login":"juanefren","id":201982,"avatar_url":"https://avatars.githubusercontent.com/u/201982?v=3","gravatar_id":"","url":"https://api.github.com/users/juanefren","html_url":"https://github.com/juanefren","followers_url":"https://api.github.com/users/juanefren/followers","following_url":"https://api.github.com/users/juanefren/following{/other_user}","gists_url":"https://api.github.com/users/juanefren/gists{/gist_id}","starred_url":"https://api.github.com/users/juanefren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanefren/subscriptions","organizations_url":"https://api.github.com/users/juanefren/orgs","repos_url":"https://api.github.com/users/juanefren/repos","events_url":"https://api.github.com/users/juanefren/events{/privacy}","received_events_url":"https://api.github.com/users/juanefren/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-05T00:03:19Z","updated_at":"2016-03-10T10:21:04Z","closed_at":"2016-03-10T00:35:45Z","body":"Hi, I have my MEDIA_ROOT in /srv/www/upload using default django FileFields/ImageFields from django using upload_to parameter as bare strings for example:\r\n```\r\nclass Car(models.Model):\r\n     profile_picture = ImageField(upload_to=\"profile_pictures\")\r\n     billing_document = FileField(upload_to=\"billing_documents\")\r\n     specs_file = FileField(upload_to=\"specs_files\")\r\n```\r\n\r\nIt automatically uploads the content to:\r\n/srv/www/upload/profile_pictures\r\n/srv/www/upload/billing_documents\r\n/srv/www/upload/specs_files\r\n\r\nHow would you recommend to proceed if I want to change uploads to:\r\n\r\n/srv/www/upload/SCHEMA_NAME/profile_pictures\r\n/srv/www/upload/SCHEMA_NAME/billing_documents\r\n/srv/www/upload/SCHEMA_NAME/specs_files\r\n\r\nwhere SCHEMA_NAME is connection.db.tenant.schema_name\r\n\r\nHow could I sublcass models.ForeignKey to get that result? (according to docs I could write a custom callable and pass it as upload_to parameter, but that would imply to create one function for each field)\r\n\r\nAny ideas about this?\r\n \r\nThanks  in advance :)"},"comment":{"url":"https://api.github.com/repos/tomturner/django-tenants/issues/comments/194776346","html_url":"https://github.com/tomturner/django-tenants/issues/72#issuecomment-194776346","issue_url":"https://api.github.com/repos/tomturner/django-tenants/issues/72","id":194776346,"user":{"login":"kosz85","id":2547425,"avatar_url":"https://avatars.githubusercontent.com/u/2547425?v=3","gravatar_id":"","url":"https://api.github.com/users/kosz85","html_url":"https://github.com/kosz85","followers_url":"https://api.github.com/users/kosz85/followers","following_url":"https://api.github.com/users/kosz85/following{/other_user}","gists_url":"https://api.github.com/users/kosz85/gists{/gist_id}","starred_url":"https://api.github.com/users/kosz85/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kosz85/subscriptions","organizations_url":"https://api.github.com/users/kosz85/orgs","repos_url":"https://api.github.com/users/kosz85/repos","events_url":"https://api.github.com/users/kosz85/events{/privacy}","received_events_url":"https://api.github.com/users/kosz85/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T10:21:04Z","updated_at":"2016-03-10T10:21:04Z","body":"The solution that you proposed was exactly the one I was thinking about. And I think it's good solution it's almost the same as `upload_to=\"folder\"`.\r\nOther solutions... You can create your own `TenantImageField` and `TenantFileField`, and just hide `custom_upload_to` inside, or you can replace `ImageField` and `FileField` with new versions, but I suggest to leave it like it is now.  Less work, look nice, why you want to do anything about it?\r\n\r\nThis uploading is nothing really complicated, it's just path to file, I don't know what you are expecting to invent here :)"}}