How to insert value by one post method in 2 table with Django

0 votes
Hey guys can you help me with django rest api.

Actually I have to insert value by one post method in 2 table, the id of first table should be save to other table, And the 2 nd table data is coming from excel.

So need to use library to read excel data and loop through it one by one and save all data in 2table while having one primary key of 1st table.
Nov 12, 2020 in Python by anonymous
• 8,870 points
1,163 views

1 answer to this question.

0 votes

try 
import-export 
 library of Django or if you are using the Postgres database then they have also explicit support to directly upload CSV in DB.

From there you can manage you can choose to depend upon your simplicity.

Once you take out the values from excel then you may directly do it by using for loop method.

answered Nov 12, 2020 by Gitika
• 65,770 points

Related Questions In Python

0 votes
1 answer

How to look up a dictionary value with a variable in Django template?

Hii @kartik, Write a custom template filter: from django.template.defaulttags ...READ MORE

answered Aug 3, 2020 in Python by Niroj
• 82,840 points
10,747 views
0 votes
1 answer

How to query as GROUP BY in django?

Hii, Django does not support free group by ...READ MORE

answered Apr 23, 2020 in Python by Niroj
• 82,840 points
6,364 views
0 votes
1 answer

How to output text from database with line breaks in a django template?

Hello @kartik, Use linebreaks or linebreaksbr filter: {{ text|linebreaks }} Or surround the text ...READ MORE

answered Jun 24, 2020 in Python by Niroj
• 82,840 points
13,551 views
0 votes
1 answer

How to disable a method in a ViewSet, django-rest-framework

Hello @kartik, You could keep using viewsets.ModelViewSet and define http_method_names on your ...READ MORE

answered Jun 26, 2020 in Python by Niroj
• 82,840 points
10,891 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,467 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,127 views
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,770 points
2,424 views
+2 votes
10 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

answered Nov 16, 2018 in Python by Nymeria
• 3,560 points
409,379 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP