Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 159553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:52:46+00:00 2026-05-11T10:52:46+00:00

Consider: >>>jr.operators.values_list(‘id’) [(1,), (2,), (3,)] How does one simplify further to: [‘1’, ‘2’, ‘3’]

  • 0

Consider:

>>>jr.operators.values_list('id') [(1,), (2,), (3,)] 

How does one simplify further to:

['1', '2', '3'] 

The purpose:

class ActivityForm(forms.ModelForm):     def __init__(self, *args, **kwargs):         super(ActivityForm, self).__init__(*args, **kwargs)         if self.initial['job_record']:             jr = JobRecord.objects.get(pk=self.initial['job_record'])              # Operators             self.fields['operators'].queryset = jr.operators              # select all operators by default             self.initial['operators'] = jr.operators.values_list('id') # refined as above. 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:52:47+00:00Added an answer on May 11, 2026 at 10:52 am

    Use the flat=True construct of the django queryset: https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.values_list

    From the example in the docs:

    >>> Entry.objects.values_list('id', flat=True).order_by('id') [1, 2, 3, ...] 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: class A { public: A& operator=( const A& ); const
Consider these classes. class Base { ... }; class Derived : public Base {
Consider the following proxy class: class VertexProxy { public: VertexProxy(double* x, double* y, double*
Consider the following code: class CustomClass { public CustomClass(string value) { m_value = value;
Consider this code sample: public class Human { public string Value { get; set;}
Consider the following: class Example : boost::noncopyable { HANDLE hExample; public: Example() { hExample
Consider the following simplified version of my code. I have a template class A
I'm looking to increment a value by one and Python does not have the
I'm seeking advice on doing the following in a more pythonic way. Consider: class
Consider the following code: #include <iostream> template<class T> struct outer { struct inner {};

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.