wlanslovenija / django-tastypie-mongoengine

MongoEngine support for django-tastypie.
Other
73 stars 59 forks source link

Introspect mongoengine fields #78

Closed Seraf closed 10 years ago

Seraf commented 10 years ago

Hello,

I would like to know if there's a way to know from meta what type of field is my primarykey ?

It will help to fix this issue : https://github.com/concentricsky/django-tastypie-swagger/issues/66

@mitar have you an idea about this please ?

Thanks

mitar commented 10 years ago

So there are two things here. MongoEngine types, which are then mapped to Tastypie types. See here. So not sure why django-tastypie-swagger is trying to read original type of underlying model and not the one provided by Tastypie? Probably it should just check the type of Tastypie field? This is where REST resource is defined.

Seraf commented 10 years ago

Thanks for you helpful answer @mitar I'm sure it will solve the problem :+1:

johnraz commented 10 years ago

@mitar is totally right, I don't remember right now why I didn't go that way. I guess I was either tired or focussed on a specific use case that I cannot remember right and will blow in my face at some point ;-) (I'm currently working on unit testing the library...). FTR : the corresponding PR is here: concentricsky/django-tastypie-swagger#72