Suoritettu

PreLoad Django Model With a list of values to go into a ManytoMany Field

I have three Models: Standard, Assignment Curriculum

Assignment has a foreign key to Curriculum, related_name = curriculum_assignment

Assignment has a ManyToMany field to Standard, related_name=standard_assignment

I want to preload assignment records from a CSV for all of my assignments, including the curriculum and standard fields.

I have this code, but need it corrected:

@login_required

def assignment_upload(request):

template = "[login to view URL]"

prompt = {

'order':"The columns should be: Name, Instructions or Link, Curriculum, Standard."

}

if [login to view URL] == "GET":

return render (request, template, prompt)

csv_file = [login to view URL]['file']

if not [login to view URL]('.csv'):

[login to view URL](request, "Only CSV files may be uploaded.")

data_set = [login to view URL]().decode("UTF-8")

#for row in data_set:

io_string = [login to view URL](data_set)

next(io_string)

for column in [login to view URL](io_string, delimiter=',', quotechar="|"):

obj_c, curriculum = Curriculum.objects.update_or_create(...)

obj_a, created = Assignment.objects.update_or_create(

name = column[1],

description = column [2],

curriculum=obj_c,

standard = column [3],

)

return redirect ("/assignment")

context = {}

return render(request, template, context)

Taidot: Python, Javascript, Django, tietojärjestelmäarkkitehtuuri

Näytä lisää: calculate beta list values, largest model mayhem list, php drop list values table mysql, php form retain values hidden field, insert values hidden field database php, sharepoint list view cut field, show values form field javascript, year model drop list, excel permutation list values, year model website list, car model drop list, model mayhem list, global country state city list values, car brand model drop list javascript, as2 edit list values, cars model drop list, display list values extjs grid java, php mysql drop list values select option display details table

Tietoa työnantajasta:
( 5 arvostelua ) WESTVILLE, United States

Projektin tunnus: #21749480

Myönnetty käyttäjälle:

aanchal1995

Hi. there I’m grateful that you spared a part of your precious time for having a look at my proposal. I am a Fullstack Python Developer expertise in all the technologies required for your project. Being a remote freel Lisää

$20 USD 2 päivässä
(3 Arvostelua)
2.4

5 freelanceria on tarjonnut keskimäärin 22$ tähän työhön

susanna2018

⭐⭐⭐ Dear client. ⭐⭐⭐ How are you Doing, Hope you are doing Great. I believe you still searching for Freelancer to handover your highly desirable work. I am sure i can take that Highly valuable Work and Finish on Time. Lisää

$20 USD 7 päivässä
(60 arvostelua)
6.4
Jng93Slv3

Hi, sir. I have read your project description and found that i am best qualified for your job. I am always available any time for your project and i have many skilles that fullfill your project. Plz contact with me and Lisää

$20 USD 7 päivässä
(9 arvostelua)
4.5
adityagajbhiye20

Hey, I am an experienced python and script developer. Love to work on your project. message me for further discussion.

$25 USD 3 päivässä
(0 arvostelua)
0.0
KingJMK

Hello, I am a Full stack web developer, experienced in Django, ASP.NET and PHP, i have read your code and i guess you're trying to read an CSV and insert values into your database, your problem is simple to solve usi Lisää

$25 USD 1 päivässä
(0 arvostelua)
0.0