﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14036	foreignKey doesn't work properly in admin - last current svn revision (1.3 pre alpha)	Federico Capoano	nobody	"Trying to save an item in the admin that has a simple foreignKey I receive an error saying I break null constraint ""id_category"" - maybe should be category_id? Downgrading to revision 13315 fixed the problem.

This is the part of model interested: 


{{{
class Category(OrderedModel):
    """""" Categories for the locations """"""
       
    name = models.CharField(max_length=50)
    meta_description = models.CharField('meta description', max_length=160, blank=True, help_text='Max 160 characters.')
    meta_keywords = models.CharField('meta keywords', max_length=20, blank=True)

    created = models.DateTimeField('created', auto_now_add=True)
    modified = models.DateTimeField('modified', auto_now=True)
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        db_table='locations_category'
        verbose_name = 'Category'
        verbose_name_plural = 'Categories'
        #ordering = ('ordering','created')
        
class Location(OrderedModel):
    """""" Categories for the locations """"""
    
    category = models.ForeignKey(Category)
    name = models.CharField(max_length=100)
    description = models.TextField()
    meta_description = models.CharField('meta description', max_length=160, blank=True, help_text='Max 160 characters.')
    meta_keywords = models.CharField('meta keywords', max_length=20, blank=True)

    created = models.DateTimeField('created', auto_now_add=True)
    modified = models.DateTimeField('modified', auto_now=True)
    
    def __unicode__(self):
        return self.name
    
    class Meta:
        db_table='locations_location'
        verbose_name = 'Location'
        verbose_name_plural = 'Locations'
        #ordering = ('ordering','created')
}}}

When in the admin I tried to save a location i got that error. 
Probably you already noticed?"		closed	contrib.admin	dev		invalid	foreignKey foreign key id		Unreviewed	0	0	0	0	0	0
