You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realise that RestFulModelAdmin isnt currently supposed to be used like a normal admin.ModelAdmin, however,
a) it is confusing/misleading to explain that people should create these beasts in "admin.py" and have the class ending with ..ModelAdmin
b) it is misleading to even say that django-restful-admin (current) is "Expose Django's admin as a RESTFUL service", or use "admin" in the name, as it doesnt use any part of django.contrib.admin afaics, and were it is asserted was wrong #8
c) there is a richness within the Django ModelAdmin that django-restful-admin can use to great effect to provide a great REST api, especially all of the Django admin apps which enhance Django Admin, some of which should enhance django-restful-admin also. Some of the "Todo" in the README indicate that Django Admin features would be integrated.
So with that in mind, the first step would be to decide whether the restful admin is going to become part of the typical admin class, or be separate with a link to the typical admin class.
This issue is about the former of those options, as I feel that is neater. (There is one significant reason against it, that DRF will instantiate "duplicate" instances because it thinks they are viewsets, but that can be prevented with python magic) The latter implies a need to create a lot of additional classes which are actually just specialised DRF viewsets, in which case I should just use DRF viewsets and the extremely large collection of helpers that exist for normal DRF viewsets.
The could be avoided if RestFulModelAdmin.__init__ understood model and site args, and also understood that it should not pass viewset specific args shouldnt be used when invoking `the super.__init__1
The text was updated successfully, but these errors were encountered:
I have been using ViewSet as ModelAdmin because I can do anything that I want with ApiView.
I can customize serializing, add pagination, add filters, and support any things that I want.
You have a Good Idea and if you can do it I'm happy to hear from you. and this repository is open to merging your pull requests.
With the next version, we can implement support Django default admin customization.
If you can get a test suite started (c.f. #11), I'll make RestFulModelAdmin a normal django.contrib.admin.ModelAdmin subclass, and then you can integrate features from django.contrib.admin.ModelAdmin.
If you can get a test suite started (c.f. #11), I'll make RestFulModelAdmin a normal django.contrib.admin.ModelAdmin subclass, and then you can integrate features from django.contrib.admin.ModelAdmin.
@jayvdb
I suggest you create a mixin class instead of a subclass for more flexibility.
On mixin vs subclass, that is irrelevant. Re-read my issue. If django-restful-admin is going to use ModelAdmin features, it needs to be able to be part of the MRO of a ModelAdmin subclass. A mixin is just a lazy and monkey-ier way of doing that, avoiding the brittle nature of subclassing. But in this case "brittle" is another way of describing type-safety.
I realise that
RestFulModelAdmin
isnt currently supposed to be used like a normaladmin.ModelAdmin
, however,a) it is confusing/misleading to explain that people should create these beasts in "admin.py" and have the class ending with
..ModelAdmin
b) it is misleading to even say that django-restful-admin (current) is "Expose Django's admin as a RESTFUL service", or use "admin" in the name, as it doesnt use any part of
django.contrib.admin
afaics, and were it is asserted was wrong #8c) there is a richness within the Django ModelAdmin that
django-restful-admin
can use to great effect to provide a great REST api, especially all of the Django admin apps which enhance Django Admin, some of which should enhancedjango-restful-admin
also. Some of the "Todo" in the README indicate that Django Admin features would be integrated.So with that in mind, the first step would be to decide whether the restful admin is going to become part of the typical admin class, or be separate with a link to the typical admin class.
This issue is about the former of those options, as I feel that is neater. (There is one significant reason against it, that DRF will instantiate "duplicate" instances because it thinks they are viewsets, but that can be prevented with python magic) The latter implies a need to create a lot of additional classes which are actually just specialised DRF viewsets, in which case I should just use DRF viewsets and the extremely large collection of helpers that exist for normal DRF viewsets.
So if I define
And I run
drf-spectacular
to generate a schema, I get the following errorgetattr(callback, 'initkwargs', {})
is returning{'suffix': 'List', 'basename': 'mymodel', 'detail': False}
I can work around this by changing the admin class a bit
The could be avoided if
RestFulModelAdmin.__init__
understoodmodel
andsite
args, and also understood that it should not pass viewset specific args shouldnt be used when invoking `the super.__init__1The text was updated successfully, but these errors were encountered: