How to create dynamic models in django rest framework?
Is there any chance to create dynamic models with APIs
Any examples please send me thanks in advance..
1) Requirement is need create table name and fields in frontend
2) we are getting the data and store in to the db create db stru
which code do you have or you want the code example explaining everything?
On Fri, May 19, 2023 at 3:59 PM Helly Modi wrote:
> How to create dynamic models in django rest framework?
>
> Is there any chance to create dynamic models with APIs
>
>
>
> Any examples please send me thanks in advance.
class CreateTableAPIView(APIView):
def post(self, request):
serializer = CreateTableSerializer(data=request.data)
serializer.is_valid(raise_exception=True)
table_name = serializer.validated_data['table_name']
fields = serializer.validated_data['fields']
This is my code and it worked in creating tables but here django provides
26 fields and many relation how can i include all ? If else become too
complex .Is there any other way to do this
On Mon, May 22, 2023 at 10:49 AM Helly Modi wrote:
> class CreateTableAPIView(APIView):
> def post(self,
Try this i am not so sure though but trying isn't bad...kindly give me the
feedback after trying
from django.apps import apps
from django.db import connection, models
from rest_framework.response import Response
from rest_framework.views import APIView
FIELD_TYPE_MAPPING = {
'char': models.C
Hello,
I take everytime a EAV implementation for this task. Hete a manual:
https://django-eav2.readthedocs.io/en/latest/
I hope this helps you
Helly Modi schrieb am Fr., 19. Mai 2023, 14:59:
> How to create dynamic models in django rest framework?
>
> Is there any chance to create dynamic mode
I have to create api where user can select the column and type and other
argument and it will create table in database in django.now here we can't
use models .so we have to create tables dynamically at run time.so first i
use django dynamic model in order to create table .it created table in
da
it worked for me thanks.but if someone wants to add constraints like
primary key,Foreign key and many more then how to do it.
On Monday, May 22, 2023 at 10:59:08 AM UTC+5:30 Brian Gitau wrote:
Try this i am not so sure though but trying isn't bad...kindly give me the
feedback after trying
fr
8 matches
Mail list logo