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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:11:50+00:00 2026-05-28T14:11:50+00:00

I have a Model in Django. It has a Group and inside the group

  • 0

I have a Model in Django. It has a Group and inside the group are Cameras.

class Groups(models.Model):
    groupName = models.CharField(max_length=255)

class Cameras(models.Model):
    group = models.ForeignKey(Groups)
    cameraID = models.IntegerField()

When I try to remove a Camera or set of cameras in the model.

camera = Cameras.objects.filter(cameraID=int(camID))
camera.delete()

It removes any camera with an ID Greater than 0. But If I have a camera ID of ‘0’ It fails to remove. Any ideas why this would be.

  • 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-28T14:11:51+00:00Added an answer on May 28, 2026 at 2:11 pm

    Try use camera = Cameras.objects.get(pk=camID) then you know for sure you’ve only got one object. You can then camera.delete()
    You also don’t need all the ‘;’ characters in your code.

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

Sidebar

Related Questions

I have these Django models: class Group(models.Model): name = models.CharField(max_length=100) parent_group = models.ManyToManyField("self", blank=True)
I have the following Django and Flex code: Django class Author(models.Model): name = models.CharField(max_length=30)
I have this model in django: class JournalsGeneral(models.Model): jid = models.AutoField(primary_key=True) code = models.CharField(Code,
I have two models class Employer(models.Model): name = models.CharField(max_length=300, blank=False) id = models.IntegerField() status
I have two models in Django: groups and entries. Groups has a many-to-many field
Assume I have a Django model with the following fields: class Gizmo(models.Model): date_created =
I have created a Django model called Person, which has got a 'user' ForeignKey
I have a simple Django model resembling: class Address(models.Model): blah class MemberData(models.Model): user =
I have 3 django models, where the first has a foreign key to the
I have a django app with models as follows: A Question model An Answer

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.