Hi,
I have 2 list and want to iterate as one in template.
How can I do it.
example->
list1 = [10,20,30,30]
list2 = [aa,bb,cc,dd]
{% for item in list1 and item1 in list2 %}
{{item}} {{item1}}
{% endfor%} {% endfor %}
which is wrong.
How can I fix this.
I cant do this:
{% for item in list1 %}
{%
Bummer I'd have to resort to overloading the renderer, but I guess if
that's what it would take.
Personally I'll just fall back to the three manual checkboxes and
putting the validation code in my clean method.
Thanks again Richard, glad you found a solution.
For those who wish to overload the
Found it:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin
Thanks anyway... :-)
Diogo
On May 27, 6:16 pm, diogobaeder wrote:
> Thanks a lot, V! That answers my question...
>
> I agree with you at the architecture point... could you provide a URL
>
I know the first thing to ever do, before jumping into another
project, is to check what's already been done. I know I shouldn't
reinvent the wheel if it's already in progress elsewhere. But, I
sometimes forget.
So, before I start jumping into creating custom fields for gene
sequences, fo
On Thursday 28 May 2009 06:52:34 Kenneth Gonsalves wrote:
> [version: django svn trunk]
> I have a model with imagefield named 'photo'. I want to display the image
> if it exists. My template code is:
>
> {% if p.photo.url %}
>
I am a moron - it should be:
{% if p.photo %}
--
regards
k
hi,
[version: django svn trunk]
I have a model with imagefield named 'photo'. I want to display the image if it
exists. My template code is:
{% if p.photo.url %}
but I get this error:
"Caught an exception while rendering: The 'photo' attribute has no file
associated with it"
obvio
On May 28, 2009, at 4:02 AM, Kevin Fullerton wrote:
>
> I'm working with django.contrib.comments at the moment, and so far
> most
> things are working as expected.
>
> I'm building the submission form using {% get_comment_form for
> object as
> form %} and have added the following as part of
Hello,
I have somewhat of a strange situation:
Each user has his own calendar and own set of events, and I want the
event categories to be models like Assignment, FieldTrip, Test/Quiz,
etc. I want it like this so that I can make the event on the rendered
calendar a link to the assignment p
View:
def edit_operation(request, op_id):
from forms import OpBaseForm
from django.forms.models import modelformset_factory
OpBaseFormSet = modelformset_factory(OpBase, form=OpBaseForm)
op = Operation.objects.get(pk=op_id)
formset = OpBaseFormSet(queryset=op.opbase_set.all())
Thank you Tom and Daniel. Starting to see some light here.
Mike
On May 28, 1:25 am, Daniel Roseman
wrote:
> On May 27, 2:59 pm, Tom Evans wrote:
>
>
>
> > On Wed, 2009-05-27 at 06:27 -0700, adelaide_mike wrote:
> > > Very beginner here.
>
> > > My model has two classes, Suburb, the parent, an
Hi Graham,
I've spent 2 times 45 min recently for reading howtos on writing own
middleware and after that have decided to postpone this grownup's magic :)
I mean that Karen hit the right level for a middling person like I am. It
worked out in about 2 minutes.
Said that, I am actually very thankf
Oops, the title of this thread should have been "instance" instead of
"initial".
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.co
On May 28, 5:42 am, Valery Khamenya wrote:
> Hi Karen,
>
> I appreciate very much your reply, thank you.
>
> the line is injected, it does logging fine, let's wait for the next
> occurrence. (yep, things are not reproducible)
Also see:
http://code.google.com/p/modwsgi/wiki/DebuggingTechniq
On Wed, May 27, 2009 at 4:04 PM, kammi-agk wrote:
>
> I've got the same problem. It seems not just to be a warning. My
> tables weren't created either.
> Is there any solution for that problem in between?
>
>
> On 2 Mai, 00:57, nbv4 wrote:
> > The problem was it wasn't creating the tables like i
Hopefully somebody here can help me. I got the latest svn version from
Google Code. I configured it (I think :) and started it up. Now I'm getting
an exception when it hits the compressed_css tag. Any help would be greatly
appreciated, because I'm at a loss.
I've included the error that comes u
I've noticed that the url:
http://example.com/http%3A%2F%2Ftest.org%2Fvocab%23FOAF/
becomes:
http://example.com/http://test.org/vocab#FOAF/
once it goes in the WSGIRequestHandler.
But this results in an invalid url. Is this an oversight or is there
something in the HTTP spec that says otherw
I've got the same problem. It seems not just to be a warning. My
tables weren't created either.
Is there any solution for that problem in between?
On 2 Mai, 00:57, nbv4 wrote:
> The problem was it wasn't creating the tables like it should, all it
> did was spit out that warning. I assumed that
I'm having a problem trying to figure something out - I'll give an
example of what I'm trying to do. I have a base model "Person" that
stores generic info on a person. For this "Person" model, I have a
form that I use when I don't know what type of person the user is. It
serves as a generic form t
I'm working with django.contrib.comments at the moment, and so far most
things are working as expected.
I'm building the submission form using {% get_comment_form for object as
form %} and have added the following as part of the form
As I understand it, that should force comments to redirect t
All,
Is there an easy way to include "conditional fields" in forms within the
Django framework. By "conditional fields", I mean fields that are shown
or not shown depending on earlier choices the user made in the form.
What would be the canonical way to implement this?
Thanks for your considerat
On Wed, May 27, 2009 at 4:18 PM, MartinBorthiry
wrote:
>
>
>
> On May 27, 6:11 pm, Alex Gaynor wrote:
> > On Wed, May 27, 2009 at 4:07 PM, MartinBorthiry
> > wrote:
> >
> >
> >
> >
> >
> > > Hello,
> >
> > > I have this model with a manyToMany relationship:
> >
> > > class Group(BaseClass):
> >
On May 27, 6:11 pm, Alex Gaynor wrote:
> On Wed, May 27, 2009 at 4:07 PM, MartinBorthiry
> wrote:
>
>
>
>
>
> > Hello,
>
> > I have this model with a manyToMany relationship:
>
> > class Group(BaseClass):
> > ...
> > members = models.ManyToManyField
> > (Client ,through='Membership',rela
Thanks a lot, V! That answers my question...
I agree with you at the architecture point... could you provide a URL
to documentation concerning specific form validation inside the admin
site?
Diogo
On May 27, 5:36 am, V wrote:
> On May 27, 5:56 am, Diogo Baeder wrote:
>
> > Hi,
>
> > I've go
On Wed, May 27, 2009 at 4:07 PM, MartinBorthiry
wrote:
>
> Hello,
>
> I have this model with a manyToMany relationship:
>
> class Group(BaseClass):
> ...
>members = models.ManyToManyField
> (Client ,through='Membership',related_name="members"
> , blank=
Figured it out. Of course, now I feel like an idiot...
FILEBROWSER_PATH_SERVER = '/path/to/my/filebrowser'
Adding this and other 'FILEBROWSER' settings to my project settings.py
should have been obvious.
Thanks for being kind!
On May 27, 12:05 am, patrickk wrote:
> I don´t quite understand yo
On Wed, May 27, 2009 at 4:04 PM, jrs_66 wrote:
>
> Hi,
>
> I've been playing a bit lately with SQLAlchemy. It seems to provide
> much more power/flexibility than the somewhat clunky Django ORM. It
> doesn't, however, allow me to use ModelForms or the Admin interface,
> which are a nice time sav
Hello,
I have this model with a manyToMany relationship:
class Group(BaseClass):
...
members = models.ManyToManyField
(Client ,through='Membership',related_name="members"
, blank=True)
.
class Membership(BaseClass):
client = models.Forei
Hi,
I've been playing a bit lately with SQLAlchemy. It seems to provide
much more power/flexibility than the somewhat clunky Django ORM. It
doesn't, however, allow me to use ModelForms or the Admin interface,
which are a nice time saver. Is there any red flag I should be aware
of in possibly u
On May 27, 1:29 pm, Nagy Viktor wrote:
> Hi,
>
> I've put together a nifty export to csv application. You can check it out
> athttps://launchpad.net/django-export-csv
>
> To get the code immediately just run: bzr branch lp:django-export-csv
> an overview file and tests are included as well
>
> I
On Wed, May 27, 2009 at 3:31 PM, Jim wrote:
>
> Hello,
>
> Suppose that I have a form ShowLatestUpdates that shows some things
> from a database. An hour later, the list of things to show is
> different. But the form shows the data from when it was initialized.
> Something like
> ShowLatestUpd
Hello,
Suppose that I have a form ShowLatestUpdates that shows some things
from a database. An hour later, the list of things to show is
different. But the form shows the data from when it was initialized.
Something like
ShowLatestUpdates().update()
doesn't work, I expect because it initializ
On Wed, May 27, 2009 at 3:10 PM, Bobby Roberts wrote:
>
> On May 27, 4:08 pm, Bobby Roberts wrote:
> > hi group... I thought slugs were unique, or supposed to be? Here's
> > what i'm doing:
> >
> > in forms.py
> > slug = forms.SlugField(required=True,widget=forms.TextInput(attrs=
> > {'clas
On May 27, 4:08 pm, Bobby Roberts wrote:
> hi group... I thought slugs were unique, or supposed to be? Here's
> what i'm doing:
>
> in forms.py
> slug = forms.SlugField(required=True,widget=forms.TextInput(attrs=
> {'class':'slug','id':'slug'}))
>
> in models.py:
> url_slug = models.Slug
hi group... I thought slugs were unique, or supposed to be? Here's
what i'm doing:
in forms.py
slug = forms.SlugField(required=True,widget=forms.TextInput(attrs=
{'class':'slug','id':'slug'}))
in models.py:
url_slug = models.SlugField (blank=False,
max_length=254,unique=True)
I can c
I'm writing a view to edit a model that has ManyToMany fields. The
form appears with all the fields properly filled out based on the
existing model instance, except the ManyToMany fields show all the
options but none are selected. My question is, what do I have to do to
have the form appear ex
Hi Karen,
I appreciate very much your reply, thank you.
the line is injected, it does logging fine, let's wait for the next
occurrence. (yep, things are not reproducible)
best regards
--
Valery A.Khamenya
On Wed, May 27, 2009 at 5:51 PM, Karen Tracey wrote:
> On Wed, May 27, 2009 at 10:23 AM
I am working on an application which needs to work like so:
A user enters search criteria in a search form and when submit is
clicked, if any records match the criteria, the user is taken to the
first record in the results set. The user can click "Next" to go to
the next record in the result set,
On Tuesday 26 May 2009 07:21:16 pm tekion wrote:
> Part 3 tutorial from django site, suggest the below method of
> optimizing urls.
> urlpatterns = patterns('mysite.polls.views',
> (r'^polls/$', 'index'),
> (r'^polls/(?P\d+)/$', 'detail'),
> (r'^polls/(?P\d+)/results/$', 'results'),
>
Hi,
I've put together a nifty export to csv application. You can check it out at
https://launchpad.net/django-export-csv
To get the code immediately just run: bzr branch lp:django-export-csv
an overview file and tests are included as well
If there is interest, I might add date_based "subviews".
On May 27, 2:59 pm, Tom Evans wrote:
> On Wed, 2009-05-27 at 06:27 -0700, adelaide_mike wrote:
> > Very beginner here.
>
> > My model has two classes, Suburb, the parent, and Street, the child:
>
> > class Suburb(models.Model):
> > suburb_name = models.CharField(max_length=72)
> >
On May 27, 8:23 am, Konstantin S wrote:
> On May 26, 9:28 pm, Steve Howell wrote:
>
> [...]
> > Perhaps you can try to step through the code in the debugger. The top-
> > level method involved in reversing URLs are not super complicated.
> > You can set a breakpoint in django/core/urlresolver.
On Wed, May 27, 2009 at 10:23 AM, Valery Khamenya wrote:
> Hi Karen,
>
> thanks for reply. I am looking in log files that I believe are created by
> apache, at least they are created via usual apache statement like:
>
> ...
> CustomLog /var/www/mysite/logs/access.log combined
> ...
>
> In this
On May 26, 9:28 pm, Steve Howell wrote:
>
> From the docs you might want to take advantage of the name= parameter
> in your URLS setup and do something like {% url 'add_media_action'
> %}. Not sure about the quoting, as the docs are vague about quoting
> literals.
>
> '''
> New in Django 1.0: Pl
On Wed, May 27, 2009 at 9:58 AM, mettwoch wrote:
>
> Thanks Alex, but then I wonder if it would be reasonable to move this
> kind of simple rules to a "view" in the database and let Django access
> the view rather than the raw table.
>
> Any experience with that?
>
> Marc
>
> On May 27, 4:49 pm,
Thanks Alex, but then I wonder if it would be reasonable to move this
kind of simple rules to a "view" in the database and let Django access
the view rather than the raw table.
Any experience with that?
Marc
On May 27, 4:49 pm, Alex Gaynor wrote:
> On Wed, May 27, 2009 at 9:45 AM, mettwoch wr
On Wed, May 27, 2009 at 9:45 AM, mettwoch wrote:
>
> Hi Group,
>
> I wonder if there's a way to aggregate an expression like:
>
>Sum("quantity*price")
>
> on a model having "quantity" and "price" fields.
>
> Marc
> >
>
No, there isn't currently a way to do this, besides writing a custom
a
Hi Group,
I wonder if there's a way to aggregate an expression like:
Sum("quantity*price")
on a model having "quantity" and "price" fields.
Marc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django user
On Wed, 2009-05-27 at 08:30 -0500, Alex Gaynor wrote:
> Because of the way SQL works when filtering on a many to many / or
> reverse foreign key in certain ways you can get duplicates, you can
> use distinct();
> http://docs.djangoproject.com/en/dev/ref/models/querysets/#distinct to
> remove these
Hi Karen,
thanks for reply. I am looking in log files that I believe are created by
apache, at least they are created via usual apache statement like:
...
CustomLog /var/www/mysite/logs/access.log combined
...
In this sense, yes, I do see only a single HTTP-request in logs, but can
track mult
On Wed, May 27, 2009 at 7:59 AM, Valery Khamenya wrote:
> Hi Graham,
>
> I do not do touch anymore. However multiple view func calls per single
> HTTP-request still happen.
>
It's far more likely that Django is being routed multiple HTTP requests than
that Django is calling your view function mu
On Wed, 2009-05-27 at 06:27 -0700, adelaide_mike wrote:
> Very beginner here.
>
> My model has two classes, Suburb, the parent, and Street, the child:
>
> class Suburb(models.Model):
> suburb_name = models.CharField(max_length=72)
> postcode = models.CharField(max_len
On Tue, May 26, 2009 at 4:12 PM, neridaj wrote:
>
> Is it only possible to access the methods of the associated User
> object, and not the attributes? Even though I can access the full name
> using get_full_name() I would still like to change the ordering to
> last_name i.e., ordering = ['last_na
On Wed, May 27, 2009 at 5:17 AM, Daniel Watkins wrote:
>
> Hello all,
>
> I'm seeing the following behaviour:
> In [2]: Project.objects.all()
> Out[2]: [, ,
> , ,
> , ]
>
> In [3]: Project.objects.filter(trainingprogramme__isnull=False)
> Out[3]: [, (Distributions)>]
>
>
Thanks. I've set extra=0 and added an element to the list, and
now the last form on the page is half-initialized - the date is set
but the time is not!
What could cause that??
On May 26, 9:20 pm, Sam Chuparkoff wrote:
> On Tue, 2009-05-26 at 17:27 -0700, adrian wrote:
> > This code creates a f
Very beginner here.
My model has two classes, Suburb, the parent, and Street, the child:
class Suburb(models.Model):
suburb_name = models.CharField(max_length=72)
postcode = models.CharField(max_length=4)
def __unicode__(self):
Hi Graham,
I do not do touch anymore. However multiple view func calls per single
HTTP-request still happen.
best regards
--
Valery A.Khamenya
On Wed, May 27, 2009 at 1:47 PM, Graham Dumpleton <
graham.dumple...@gmail.com> wrote:
>
>
>
> On May 27, 9:11 pm, Valery wrote:
> > Hi Graham
> >
> >
On May 27, 9:11 pm, Valery wrote:
> Hi Graham
>
> the issue is still here even after mod_python is removed. I still
> register multiple calls of my view function for a single HTTP-request
> (proved via Django log file). For example, 25 calls per HTTP request
> today.
>
> And you can't believe,
Hi Graham
the issue is still here even after mod_python is removed. I still
register multiple calls of my view function for a single HTTP-request
(proved via Django log file). For example, 25 calls per HTTP request
today.
And you can't believe, as always -- "I did nothing special!" (c)
No one g
Hello all,
I'm seeing the following behaviour:
In [2]: Project.objects.all()
Out[2]: [, ,
, ,
, ]
In [3]: Project.objects.filter(trainingprogramme__isnull=False)
Out[3]: [, ]
In [18]: [p for p in Project.objects.all() if
list(p.trainingprogramme_set.all()) != []
2009/5/27 Andy Mikhailenko
>
> User behaviour can be formalized as actions + objects. Some actions
> span multiple objects.
> Admin is a great tool that corresponds the *structure* of data. It
> allows to view and edit all your base for great justice. Err, all your
> database for zero cost. Out of
User behaviour can be formalized as actions + objects. Some actions
span multiple objects.
Admin is a great tool that corresponds the *structure* of data. It
allows to view and edit all your base for great justice. Err, all your
database for zero cost. Out of the box. Nice!
However, "editing an ob
well I'll be damned. I didn't see it here:
http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ So I
assumed it couldn't do it...
On May 27, 5:31 am, Daniel Roseman
wrote:
> On May 27, 9:55 am, nbv4 wrote:
>
> > I have a model which has about 4 fields. One of those fields is a
> > fore
On May 27, 9:55 am, nbv4 wrote:
> I have a model which has about 4 fields. One of those fields is a
> foreign key to another model which has over 40,000 objects in the
> database. When I create a 'stock' ModelForm of this model, and display
> it in a template, it wants to create a with 40,000 it
On May 27, 6:13 pm, emy_66 wrote:
> My django site isn't able to read my environmental variable - PATH -
> when run by mod_python. In my .profile file my path is /usr/local/
> ncbi:/usr/local/bin. This gives me access to programs I call using
> subprocess from django. Could I get your advice as
On May 27, 4:54 pm, Ben Welsh wrote:
> The nabble link I provided has a lot of that stuff. The answers are prefork,
> mod_python and the following. If you would recommend a switch to mod_wsgi,
> could you please recommend the best guides for how and why? I'm always
> interested in reading more
Hey Retro,
My boss managed to get this working so I can't take the credit but
this works and it's pretty useful. Basically, he's overriding the
widget renderer and making each "choice" a separate list item, giving
each "choice" it's own ID, making it much easier to use CSS to format
the choices i
Thanks v
What you said echoes what I found on a posting on djangosnippet.org
about populating the choices in the init field. It works fine now.
On May 26, 9:30 am, V wrote:
> On May 25, 1:27 pm, Simon Davies wrote:
>
>
>
> > I have a choices field called status in my model form which can be s
I have a model which has about 4 fields. One of those fields is a
foreign key to another model which has over 40,000 objects in the
database. When I create a 'stock' ModelForm of this model, and display
it in a template, it wants to create a with 40,000 items. I
have created a custom ModelForm fo
On May 26, 1:08 pm, "Daniele Procida"
wrote:
> Does something exist there something along the lines of:
>
> prepopulated_fields = {
> "author": ([something to retrieve currently-logged-in user from
> authmod.User],)
> }
>
> Thanks,
>
> Daniele
you should simply pass a
On May 27, 5:56 am, Diogo Baeder wrote:
> Hi,
>
> I've got two fields, in a model object: "from_date" and "to_date". How
> can I make the admin controller or model validate if the "from_date"
> field has always a lower value than "to_date"? Both are
> "django.db.models.DateField", but how can I c
In your form sub-class class you'll need to override the clean method
to check for duplicate entries and raise a validation error if they
exists:
from somewhere import models
from somewhere import forms
class myForm(forms.ModelForm):
some_unique_field = forms.CharField()
class M
My django site isn't able to read my environmental variable - PATH -
when run by mod_python. In my .profile file my path is /usr/local/
ncbi:/usr/local/bin. This gives me access to programs I call using
subprocess from django. Could I get your advice as to what I should
do? A search on google tell
I don´t quite understand your question.
fb_settings is imported with the filebrowser-views ... not sure if
that answers your question.
patrick
On May 27, 4:01 am, "Bob N." wrote:
> OK, so how do I get the fb_settings to appear in the runtime Settings?
>
> On May 26, 12:51 am, patrickk wrote:
73 matches
Mail list logo