On the many to many field,
Great info, I'll look into those.
On combining the fields,
'Thumbs' is really Thumbnail images of 'Images'.
However, not all 'Images' have 'Thumbs'
Thinking that 3 possibly blank fields in 'Images' is more efficient
than 9 fields in a different table for each actual
Ok, I'm just getting back to a project I had to put on hold for a
while.
I recently read an article on problems new Django users fall into, and
I think I hit one.
The bottom of my 'Systems' model looks like this:
keyboard = models.CharField(max_length=80)
cart = models.CharField(
return self.name
def get_thumb(self):
return self.imagesmall.filter(primary=True)[0]
Should I continue this way or should (how could ) I re-work the
System, Image and Thumb models to do the job?
I'm thinking I need another descriptor on the Image model.
Oh, 'primary
On Sep 26, 1:53 pm, bruno desthuilliers
<[EMAIL PROTECTED]> wrote:
>
> # relative import is simpler and safer
> import models
>
> # using introspection
> from django.db.models import Model
> for name in dir(models):
> obj = getattr(models, name)
> if obj is not Model and issubclass(obj,
Converting a .96 site I was working on to the 1.0 set-up.
Is there a quick way to list all my models in the admin?
Or do I have to :
from HCVGM.systems.models import System
admin.site.register(System)
for every one?
b.t.w. I presume the
class Admin:
pass
in the Models.py is
On Sep 16, 2:30 am, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
>
> Sorry, my mistake. filter() always gives you a queryset - because
> there might be more than one instance of the related model that fits
> the criteria - so you can't jut reference the location/width directly.
> The best way is to
On Sep 15, 5:21 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> Probably the easiest solution, if you know you're
> always going to be requesting a certain lookup, is to define a custom
> method on the model:
>
> class System(models.Model):
> ... field declarations ...
>
> def get_heade
On Sep 15, 4:13 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> So, putting that all together:
>
> {% for pic in info.system_pictures.all %}
> {% ifequal pic.image_category.name 'Header_Pic' %}
>
> {% endifequal %}
> {% endfor %}
>
Sweet! That works.
Thanks!
I'll try to rememb
Using Fedora 8, Django version 0.96.3
I'm currently trying to pull two specific images from a list of images
associated with a model.
Currently the Models are like this:
class ImageCat(models.Model):
name = models.CharField(maxlength=80)
class Image(models.Model):
name = models.Ch
On Sep 12, 8:32 am, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> You need the ifchanged tag:
>
>
> {% for items in list %}
> {% if changed items.0 %}{{ items.0 }}{% endifchanged %} td>{{ items.1 }}
> {% endfor %}
>
Thats what I went with!
Looks like it would use less processor cycles to do t
Is there a way to see if a filed changes between iterations?
That is, I pass the Systems list to the template sorted by
Manufacturer and name. The template then only displays the new
Manufacturer name when it changes?
I thought I saw something like that somewhere, but can't find it
now
Lanc
Currently using Django version 0.96.3, on a Fedora 8 system.
I've currently set-up models for 'Manufacturer' and 'System'. System
has a Foreignkey to Manufacturer.
I'd like to display a list like so:
Manu A
System a
System b
System c
Manu B
System a
System b
System c
Etc...
charfield just to get it to render at all.
Lance
On May 21, 7:41 pm, "Adam Gomaa" <[EMAIL PROTECTED]> wrote:
> Lance, it's also not clear to me what exactly you need. Are you using
> ModelForm? If not, what do you mean by the 'auto generated' form? I
> think
k three people. It could
> have one m2m or 3 fks to Person depending on the strictness of the
> requirement for 3 and the business logic it supports. If you went this
> route, you could present a user with a form for ThreeRelatedPeople and they
> could choose three existing or create
I'm trying to make a Form where 3 people need to be inputed. All three
need to have a Title.(EG. Mr. Mrs. etc.)
I tried making the Title fields in the database be a key to a table of
title selections. The sql generation had no trouble with that, but the
Form generator doesn't like it at all...
I
15 matches
Mail list logo