what is wrong with this model

2005-08-26 Thread Krzysztof Drozd
when i get persons/add in djangos admin interface i get: There's been an error: Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/django-1.0.0-py2.3.egg/django/core/handlers/base.py", line 64, in get_response response = callback(request, **param_dict) File "/usr

Re: list_display = ForeignKey?

2005-08-26 Thread J. Davis
Ok, I've updated to the new Model syntax as shown below and I'm still getting "No sites matched your search criteria" in the admin page when I put a foreign key in the list_display definition. Everything works great as soon as I take "thing" out of the list_display. I've also tried adding db_col

Re: IMPORTANT: Django model syntax is changing

2005-08-26 Thread Jason F. McBrayer
On Fri, 2005-08-26 at 13:33 -0500, Adrian Holovaty wrote: > On 8/26/05, Jason F. McBrayer <[EMAIL PROTECTED]> wrote: > > > In [1]: from django.models.engulf import feeds, users, articles, categorys > > > In [2]: c = categorys.get_list(user_id__exact=1) > > You want categorys.get_list(user__id__ex

Re: Different fieldsets for the same fields in admin?

2005-08-26 Thread Adrian Holovaty
On 8/26/05, paolo <[EMAIL PROTECTED]> wrote: > Hi, I'd like to know if it is possible to have different fieldsets for > the same fields, subdivided by some criterion. > > admin = meta.Admin( > fields = ( > ('category1', { > 'classes': 'collapse', > 'fields': ('name', '

Re: IMPORTANT: Django model syntax is changing

2005-08-26 Thread Adrian Holovaty
On 8/26/05, Jason F. McBrayer <[EMAIL PROTECTED]> wrote: > > In [1]: from django.models.engulf import feeds, users, articles, categorys > > In [2]: c = categorys.get_list(user_id__exact=1) You want categorys.get_list(user__id__exact=1) -- a subtle change. With the new syntax, calling code never r

Re: Choices or lookup-tables

2005-08-26 Thread Adrian Holovaty
On 8/26/05, Maniac <[EMAIL PROTECTED]> wrote: > What should I consider when choosing between them? I suppose choices > tuple is easier to work with when making views since Django > automatically generates for it (or am I wrong here?). On the > other hand lookup table is more flexible since I can

Re: IMPORTANT: Django model syntax is changing

2005-08-26 Thread Jason F. McBrayer
The new syntax breaks get_list() for me. Here's an excerpt from my model: class Category(meta.Model): name = meta.CharField("Name of Category", maxlength=255) user = meta.ForeignKey(User) feed = meta.ManyToManyField(Feed, filter_interface=meta.VERTICAL) class META: admin

Different fieldsets for the same fields in admin?

2005-08-26 Thread paolo
Hi, I'd like to know if it is possible to have different fieldsets for the same fields, subdivided by some criterion. For example, the screen for adding a recipe referring to the following model results in 5 "generic" (not grouped by any particular criterion) fields. I'd like that for each categor

Choices or lookup-tables

2005-08-26 Thread Maniac
Hi! I'm creating a model 'Print' with a field 'paper_type' that would contain a value from a paper types list. As I understand I can make it two different ways: 1. Create a PaperType table and refer to it from Print with a foreign key: class PaperType: name=meta.CharField(maxlength=20)

Re: Class reconfiguration broken Foreign Keys?

2005-08-26 Thread [EMAIL PROTECTED]
Thanks, that seemed to do the trick. I definitely prefer the new syntax. Tom

Re: Show auxiliary data in admin interface for a model

2005-08-26 Thread paolo
I realized that it was enough to have a string containing both the component name and the price. In this way in the admin page for adding a new configuration (that shows the components list too, due to edit_inline=True) will be shown a combobox with, as said, the string 'comp name -- price' obtain

Re: Show auxiliary data in admin interface for a model

2005-08-26 Thread Adrian Holovaty
On 8/26/05, paolo <[EMAIL PROTECTED]> wrote: > I'd like that once a user select or change a component from the > component's listbox, its price appears somewhere. I'd like to avoid the > javascript solution, as probably it wouldn't be trivial and I don't > know javascript well.. So I thought to ch

Re: Class reconfiguration broken Foreign Keys?

2005-08-26 Thread Adrian Holovaty
On 8/26/05, xtian <[EMAIL PROTECTED]> wrote: > I think that line should be > job = meta.ForeignKey(Job, null=True) > > The _id is implied - it's part of the machinery that links your Log to > your Job. Semantically, your log is linked to a job, not a jobid. Yeah, xtian is right -- it should be

Re: Show auxiliary data in admin interface for a model

2005-08-26 Thread xtian
On 8/26/05, paolo <[EMAIL PROTECTED]> wrote: > ... So I thought to change __repr__ to return a > tuple containing self.code and self.price, but some problems arise. > ... Hi paolo - __repr__ has to return a string - if that was what you wanted, you could use string formatting to include the pric

Show auxiliary data in admin interface for a model

2005-08-26 Thread paolo
Using the following model it is possible to add an arbitrary number of components (with a quantity) to configurations. class Configuration(meta.Model): pass fields definition. class META: pass meta definition class Component(meta.Model): code = meta.CharField('Code'

Re: Class reconfiguration broken Foreign Keys?

2005-08-26 Thread xtian
I think that line should be job = metaForeignKey(Job, null=True) The _id is implied - it's part of the machinery that links your Log to your Job. Semantically, your log is linked to a job, not a jobid. On 8/26/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Seems like my ForeignKeys are

Class reconfiguration broken Foreign Keys?

2005-08-26 Thread [EMAIL PROTECTED]
Seems like my ForeignKeys aren't working any more. This is my model (abbreviated): --- class Log(meta.Model): id = meta.AutoField(primary_key=True) jobid = meta.ForeignKey(Job, null=True) status = meta.CharField(maxlength=1, default='U') timestamp