#21053: Missing related fields
-------------------------------------+-------------------------------------
Reporter: joshua.fialkoff@… | Owner: grue
Type: Uncategorized | Status: closed
Component: Database layer | Version: 1.5
(models, ORM) | Resolution:
Severity: Normal | worksforme
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by grue):
* status: assigned => closed
* resolution: => worksforme
Comment:
I've been unable to replicate this. Could you provide any additional
information or test cases that would allow me to reproduce this bug?
models.py:
{{{
from django.db import models
class CaseModel(models.Model):
case = models.CharField(max_length=100)
class Meta:
abstract = True
class Note(CaseModel):
name = models.CharField(max_length=100)
notes = models.TextField(blank=True)
@property
def shortened_notes(self):
if len(self.notes) > 100:
return self.notes[:100] + '...'
return self.notes
class Document(CaseModel):
name = models.CharField(max_length=100)
upc = models.CharField(max_length=100, verbose_name="UPC")
file = models.FileField(upload_to="prvate/documents/")
notes = models.TextField(blank=True)
@property
def shortened_notes(self):
if len(self.notes) > 100:
return self.notes[:100] + '...'
return self.notes
class AttachTo(models.Model):
class Meta:
abstract = True
class NoteAttachTo(AttachTo):
class Meta:
verbose_name = 'Attach To'
verbose_name_plural = 'Attach to'
unique_together = ('note', 'attach_to_type', 'attach_to_id')
note = models.ForeignKey(Note)
class DocumentAttachTo(AttachTo):
class Meta:
verbose_name = 'Attach To'
verbose_name_plural = 'Attach to'
unique_together = ('document', 'attach_to_type', 'attach_to_id')
document = models.ForeignKey(Document)
}}}
console output:
{{{
In [1]: from cases.models import Note, Document
In [2]: Note._meta.get_all_field_names()
Out[2]: ['case', u'id', 'name', 'noteattachto', 'notes']
In [3]: Document._meta.get_all_field_names()
Out[3]: ['case', 'documentattachto', 'file', u'id', 'name', 'notes',
'upc']
}}}
python version: Python 2.7.3
pip freeze:
{{{
Django==1.5.2
argparse==1.2.1
ipython==1.0.0
wsgiref==0.1.2
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/21053#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/085.56057b55a6bb414d0197043724c2bf36%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.