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 431233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:57:15+00:00 2026-05-12T19:57:15+00:00

I want to generate a list using my django model say I have these

  • 0

I want to generate a list using my django model

say I have these model:

class AlarmServer(models.Model):
    ip = models.IPAddressField()

and such a list

server_ips = [i.ipfor i in AlarmServer.objects.all()]

Doesn’t seem to work, what am I doing wrong?

  • 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. Editorial Team
    Editorial Team
    2026-05-12T19:57:16+00:00Added an answer on May 12, 2026 at 7:57 pm
    server_ips = [i.ip for i in AlarmServer.objects.all()]
    

    Should work (I just added a space). I’ve tried this as below

    mez@stupor % ./manage.py shell
    Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) 
    [GCC 4.3.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    (InteractiveConsole)
    >>> from mysite_org.videos.models import Video
    >>> url_list = [v.url for v in Video.objects.all()]
    >>> url_list
    [u'http://media.mysite.org/videos/sblug_jan2009.flv', u'http://media.mysite.org/videos/sblug_feb2009.flv', u'http://media.mysite.org/videos/phpwm_mar2009.flv', u'http://media.mysite.org/videos/sblug_may2009.flv', u'http://media.mysite.org/videos/sblug_june2009.flv', u'http://media.mysite.org/videos/sblug_sep2009.flv', u'http://media.mysite.org/videos/bugjam-oct-2009.flv']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a class of 30 students and want generate every possible
I have such generic class of list: using System; using System.Collections; using System.Collections.Generic; using
I am using opencsv to parse text file and generate List<String[]> now I want
If I have a pair of dates, and I want to generate a list
I have a order list and I want to generate and rank the product
I want to generate a list of all methods in a class or in
I have this code I'm using to generate a list of records categorized into
I want to generate several SQL statements based on a column list using the
Say you want to generate a matched list of identifiers and strings enum {
Hi I want to be able to generate a list using find so that

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.