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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:44:52+00:00 2026-06-14T01:44:52+00:00

Like many others, I’ve been learning web development on django through building a test

  • 0

Like many others, I’ve been learning web development on django through building a test app. I’ve the basic models set up. I’ve populated a few of the tables with the absolute minimum data needed for further testing though using fixtures.

Now for a different table, I want to create data tuples through a custom management command which takes the required arguments. If this works as expected, I’ll save the created data to the database by adding the --save option.

The syntax of the command is like this

create_raw_data owner_id temperature [--save]

where owner_id is required and temperature (in C) is optional. Within the Handle method, I’m using factory boy to create the raw_data with the given arguments etc.

I did have some issues but searching on SO, google, django docs etc, I’ve got the command working fine.

EXCEPT when I input a negative temperature…

Then I get the following error

Usage: C:\test\manage.py create_raw_data [options] 

Creates a RawData object. Usage:  create_raw_data owner_id temperature [--save]

C:\test\manage.py: error: no such option: -5

The code I have for parsing the args is like this

for index, item in enumerate(args):
    if index == 0:
        owner_id = int(item)
    else index == 1:
        temp = int(item)

I put a print(args) as the 1st line inside Handle but it seems the control is not even reaching here.

I’m not sure what is wrong… please help…

Thanks a lot

  • 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-06-14T01:44:53+00:00Added an answer on June 14, 2026 at 1:44 am

    got the issue fixed so providing an answer to others who may come across this.

    The issue was with parse_args method of optparse. I’ve read in a number of places that though optparse is deprecated and instead argparse is recommended, django recommends using optparse since that is what it uses. Long story short, the link at link suggested a few alternatives and using create_raw_data 1 -- -5 works as expected. So I did get a workaround. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI, I am struggeling with Basic HTTP Authentication like I have seen many others..
I'm really new in Android Development and, like many others, I'm trying desperately to
Like many others, I've been killing braincells trying to get oauth to work on
Like many others Knockout developers before me, I encountered a slow running script warning
I, like many others, love Eclipse as my ide of choice, and because of
I am creating dynamic TextFields in actionscript 3.0. Like many others, my text disappears
This sounds like a problem many others have posted about, but there's a nuance
Like many web applications (business) the customer wants a form that will search across
I'm trying to make a little client-server script like many others that I've done
Like many others I was excited to hear that Mockito now works with Android

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.