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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:52:32+00:00 2026-05-12T11:52:32+00:00

im trying to make Categories and Subcategories, im checking this models but i have

  • 0

im trying to make Categories and Subcategories, im checking this models
but i have this error:

Truncated incorrect DOUBLE value: 'nacionales'

where the “nacionales” is the parent Category, i know that my problem maybe are in the urls.py, but the true, i dont know how set the urls for this case…

my model.py:

# from ...
class Categoria(models.Model):
    titulo = models.CharField(max_length=75, unique=True)
    slug = models.SlugField(max_length=200,unique=True)
    parent = models.ForeignKey('self', blank=True, null=True, related_name='child')

# functions....

my views.py:

# from ... 

def noticias_categoria(request,parent_id,child):
    categoria = get_object_or_404(Categoria,parent=parent_id,slug=child)    
    return object_list(request, queryset=categoria.noticia_set.all(), paginate_by=20,
                       template_name='categorias/categoria_list.html', 
                       extra_context={'categoria':categoria})

my Category urls.py:

# from ...
url(r'^(?P<parent_id>[-\w]+)/(?P<child>[-\w]+)/$',
                            noticias_categoria,
                            name='noticia_detail'
                            ),

my url.py:

(r'^categorias/', include('categorias.urls')),

Thanks guys

  • 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-12T11:52:32+00:00Added an answer on May 12, 2026 at 11:52 am

    It seems like you’re passing in the string value of the parent category – nacionales – where the function is expecting the numeric ID.

    Either use an ID for parent_id, or rename it to parent and write the first line of the function like this:

    categoria = get_object_or_404(Categoria, parent__titulo=parent, slug=child)  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some trouble trying to make this work. I have 2 models, User_Pro
I've spent hours trying to make this work. No solutions from the search have
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a small countdown timer in my app but it's not working.
this is my code, i am trying to make a simple 3 nodes select
I have the following XML. I'm trying to make a static button underneath my
I have a list of topic categories that looks something like this mockup: http://www.problemio.com/problems/categories.php
I have the following db and php. I am trying to make a unordered
I am trying to make something like this site has: http://www.eventipity.com/ When you press

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.