Завершено

Print Object List with ManyToManyField

I am trying to create a project and I have two databases, linked by a ManyToManyField, but I cannot get the actual field value to print on the html form. It just says [login to view URL] no matter what I do.

I need assistance completing my code. It is a tiny app, I just can't get past this one snag.

Here is my Model:

class Enrollment([login to view URL]):

Enroll_Student = [login to view URL](Student)

Put_Student_Here = [login to view URL](Course, on_delete=[login to view URL])

def get_delete_url(self):

return f"/withdraw/{[login to view URL]}/delete"

def __str__(self):

return '%s %s' % (self.Put_Student_Here, self.Enroll_Student,)

Here is my Form:

class EnrollmentModelForm([login to view URL]):

class Meta:

model = Enrollment

fields = ['Enroll_Student','Put_Student_Here']

labels = {

'Enroll_Student':'Student',

'Put_Student_Here':'Course',

}

Here is my view:

def roster_list_view(request):

qs = [login to view URL]()

#list out objects, this is a search view

template_name = '[login to view URL]'

context = {'object_list': qs}

return render (request, template_name, context)

HTML Form:

{% extends "[login to view URL]" %}

{% block content %}

Course Roster

{% for object in object_list%}

{% include '[login to view URL]'%}

{% endfor %}

{% endblock %}

In-Line Form:

{‌{object.Put_Student_Here}}, {‌{object.Enroll_Student}}

Withdraw Student

When I run this, the display on the screen says:

History Kristen Disney,

[login to view URL]

As you can see, it's the "ManyToManyField(Student)" value that's not coming out on the list. The ForeignKey field is coming over just fine.

Квалификация: Django, Documentation, Python, Software Documentation

Показать больше django many to many through, to add multiple records to a many to many field in one go use the ____ method, 'manyrelatedmanager' object is not iterable, django filter manytomany contains, django values manytomany, many to many field example, django manytomanyfield view, django many to many self, print object type, list vehicle manufacturers model names, print captionist list, list car makes model, magento product model base image, flex print object file, nested object list combobox flex, print product list prestashop, microsoft access print contact list, web print price list, print layout list design, list commercial vehicle model

О работодателе:
( 0 отзыв(-а, -ов) ) Oklahoma City, United States

ID проекта: #20092010

Поручен:

SammyOpiyo

Hello, {‌{object.Enroll_Student}} is a queryset and not an object. I am a Python Backend Developer | DevOps Engineer | SRE. I am proficient with tools such as Docker, Kubernetes, Istio, Terraform, Gitlab CI/CD, Trav Больше

$50 USD за 1 день
(10 отзывов(-а))
4.3

3 фрилансеров(-а) в среднем готовы выполнить эту работу за $43

devops724

Hi There I am trying to create a project and I have two databases, do you mean two tables? I have 10 years experience in Python and web development. 8 years developing Django sites and services. I did lots of projects Больше

$50 USD за 7 дней(-я)
(69 отзывов(-а))
6.4
alkajain2906

Hi, I have 5+years Experience in Website/Software Design & Website Development. I'm an Expert in: -Frontend & Backend Development -Python -Data Science -Machine Learning -JVM technologies -Jquery, PHP -Ionic - Hybrid Больше

$30 USD за 7 дней(-я)
(8 отзывов(-а))
4.0