Thursday, March 29, 2018

Re: models that are not tables but not abstract

Currently for things like this I create a view and serializer that are not related to any model.

Of course I lose some introspection code that expect a model, but for the most part I'm able to make an API endpoint with data not from the ORM.

Can you elaborate more on your use case?

On Thu, Mar 29, 2018 at 12:51 PM, Younes Ch <hdzyounes@gmail.com> wrote:

I have this recurrent need that I handle entities that are not tables but calculated entities from other models.

Consider this example :
an entity that I call task that is calculated using the model suggestion a task may be to approve a suggestion, to pilot a suggestion, to close a suggestion. the task model can't be in the database but it is handled exactly like a model (it has fields that are calculated from other models, it should have views, serializers using DRF).

Problem
Since there is no way in django to handle this kind of entities as models I need to make exception to make it follow same process as other models except the fact that it is not in the database.

It would be great to find a way to integrate this in the next django version

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/991cdfe4-7451-4708-a53f-544d255a01d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFWa6t%2B3Xi3vE3DyTRKRjcMAewEZEtcJkVzA-b0HHP30gbnSSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment