You need a little more power than what you're doing. My initial
reaction would be to use operator and Q objects:
from django.db.models import Q
import operator
Q_user_search = reduce(operator.or_, [Q(first = first, last=last)
for (first, last) in authorList])
Authors.objects.filte
On 5/25/07, Adam Fast <[EMAIL PROTECTED]> wrote:
> Thanks, that's awesome.
>
> HOWEVER, I'm sorry to hear you did it the save as PDF many times way...I'd
> like to show you a better way though. In Acrobat Pro, do File->Create
> PDF->From Web Page. Give it
... or better still, use the source. Th
On 5/24/07, wesman <[EMAIL PROTECTED]> wrote:
> I just don't want to have to write this stuff all again and
> maintain two copies of it - can I use multi-inheritance and create a
> model that is sub-classed from my "job" class and the models class?
Sure. The only time you'll run into problems is
Your proposed solution is exactly what I did. I think the official
term is a 'mixin class'. It's worked out really well so far.In my
case the mixin class looks for the Event class defined in the model
for various settings. In your case they might contain a mapping
between your mixin model d
hi - I am a total django newbie - in fact, I've done not much more
than install it - I have an important question that I can't seem to
find an answer to in the FAQ - perhaps someone here can help, because
without being able to do this, django might not work for me :(
Anyway
I have a softwar
Thanks, that's awesome.
HOWEVER, I'm sorry to hear you did it the save as PDF many times way...I'd
like to show you a better way though. In Acrobat Pro, do File->Create
PDF->From Web Page. Give it http://www.djangoproject.com/documentation and
however many link levels you'd like deep, step away
I'm looking for a gallery plugin for my community dragonboat website.
Anyone have any ideas where I can find one so that my users can start
posting their own pictures?
Thanks,
Robotooo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
Please help the newbie!
I have a list of authors:
authorList=( ('john','doe') , ('jane','smith') )
If I want to filter a table of authors (containing 'first' and 'last'
fields) by their last name only, that much I know:
Authors.objects.filter( last_in=[ last for (first,last) in
If, like me, you're constantly referring to the docs on the web site
when developing, you may enjoy the following: a single PDF of all the
web docs from djangoproject.com. If you'd like a copy, it is available
at the URL below.
http://bnomis.googlepages.com/
Simon
--~--~-~--~~-
Sorry, I meant to send this to the list.
If it's small enough, you can just do a standard python sort:
def sort_function(x, y):
return cmp(x.calculated_field, y.calculated_field)
query_list = list(queryset)
query_list.sort(sort_function)
If you want to use a Schwartzian tra
> If I have a model that returns calculated fields, how would I sort a
> query set on them?
>
> Assume the query sets are relatively small (< 100) for now.
Give this condition (a small set of data) and no need to slice
the results on the server based on this order, it can be done
purely in pytho
H... that is intriguing. Probably overkill for my immediate needs,
but I see how a simplified version might do it for me. And definitely
opens up some intriguing possibilities.
John, how do you think you'd hook a dyno up to the app... that could
be VERY useful, given this little app's future.
Thanks all... replied once to this, and it went to never never land.
These are all along the same lines... Tim's suggestion is right on the
money as to what I need ( changes in the model code and nowhere
else). I'll try it out as soon as my DBA modifies the tables, which
is hopefully soon.
On M
> I'm just moving an application that we were writing over to the GeoDjango
> branch
Welcome!
> However I am unable to add a new one using the admin ...
> when attempting to create a new instance.
You found a bug in WKTField -- good catch.
> Any help would be much appreciated. Thanks
It ha
Tim,
Brilliant idea. I'm a car nut and what you've built would allow a
Dyno to be plugged into his django app and record all the data for a
particular car, and then just have a view that pulled out the max hp
or torque.
Very coolmultiple measurements associated with a given vehicle:
>
> class
If I have a model that returns calculated fields, how would I sort a
query set on them?
Assume the query sets are relatively small (< 100) for now.
Is this possible?
Thanks
john
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
I had one yesterday that took a while to figure out.
Every page that I visited gave me a similar error. Something like this :
Request Method: GET
Request URL:[host]/db/camps/
Exception Type: SyntaxError
Exception Value:invalid syntax (views.py, line 76)
Exception Locati
On Thu, 2007-05-24 at 20:50 +, rogerdpack wrote:
> So it seems that if I run python manage.py syncdb
> and it errs
> it says
> django.contrib.admin: name 'User' is not defined
> django.contrib.auth: name 'User' is not defined
>
> turns out thta in django/contrib/auth/models.py on line 200 it
On Thu, 2007-05-24 at 20:20 +, Christian Schmidt wrote:
> Hi,
>
> I have a form to upload a picture and i try to validate it in
> newforms. But i can not read the content-type. I get the error
> "'unicode' object has no attribute 'get'".
>
> I use Python 2.5. This is my code:
>
> view.py
>
On Thu, 2007-05-24 at 19:00 +0200, Olivier Guilyardi wrote:
> Hi,
>
> In my urls.py I have the following entry:
>
> url(r'^items/download/(?P[0-9A-Za-z._:%?-]+)\.(?P[0-9a-z]+)$',
> web_view.item_export,
> name="telemeta-item-export"),
>
> In my template:
> {% url telemeta-item-e
On Thu, 2007-05-24 at 09:13 -0700, sandro dentella wrote:
> Hi Malcom,
>
> I really welcome this branch and thank you all for the effort.
>
> Before I consider a bug what follows I'd ask if this should entitle
> me to use
> non ASCII letters in tests with test.client.
>
>I tried somet
On 5/24/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
> thanks david. it´s working now (although I´m having problems
> interpreting the stats, but that´s another question).
This should help:
http://www.rkblog.rk.edu.pl/w/p/django-profiling-hotshot-and-kcachegrind/
--~--~-~--~~-
On May 24, 2:03 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> To accomplish this we are going to add a 'deleted_flag' to each table,
> and set it to 0 if it is not deleted, and 1 if it is deleted.
Just as an aside, when I use this approach I find it handy to use a
date field, 'deletedate'
> To accomplish this we are going to add a 'deleted_flag' to
> each table, and set it to 0 if it is not deleted, and 1 if it
> is deleted.
>
> Rather than going to every function I am displaying items (
> 99% of the time I'm using .filter then some filter ), is there
> a way to tell it in the mod
On 5/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Rather than going to every function I am displaying items ( 99% of the
> time I'm using .filter then some filter ), is there a way to tell it
> in the model to always append delete_flag=0 to any of the .filter
> parameters I am passing in,
Our CIO has just told us that we need to modify our application to
perform 'logical' deletes on all items, instead of actually deleting
them from the system as we've been doing.
To accomplish this we are going to add a 'deleted_flag' to each table,
and set it to 0 if it is not deleted, and 1 if i
hello,
i would say that yes it is a bug. i have seen many bugs in the reverse
resolver code. for example, it crashes (throws a python exception) if
a regex pattern contains question marks (optional elements) and i am
sure it has a lot more. my personal opinoin is that this code is
simply a hack.
So it seems that if I run python manage.py syncdb
and it errs
it says
django.contrib.admin: name 'User' is not defined
django.contrib.auth: name 'User' is not defined
turns out thta in django/contrib/auth/models.py on line 200 it uses
"User" in error (it was my own fault==a typo).
Anyway anyone
Hi,
I have a form to upload a picture and i try to validate it in
newforms. But i can not read the content-type. I get the error
"'unicode' object has no attribute 'get'".
I use Python 2.5. This is my code:
view.py
...
postdata = request.POST.copy()
if 'bild' in request.FILES:
postdata.
Malcolm Tredinnick wrote:
> The unicode branch, [1], is now at a point where it is essentially
> feature-complete and could do with a bit of heavy testing from the wider
> community.
Switched my site today to the branch. Works like a charm (translations,
admin, multilingual content).
--~--~
> First, hp and torque are both kinda meaningless unless you know where
> they're at in the powerband, so I need hp "@" rpm (wherever the HP
> peak is). Same for torque: torque lb.ft. @ rpm.
>
> Ideally, what I'd like is something that stores the values separately
> (I can always return the value
I've started work on an automotive site. For fairly obvious reasons, I
need to have horsepower and torque in the database. This presents a
couple of issues.
First, hp and torque are both kinda meaningless unless you know where
they're at in the powerband, so I need hp "@" rpm (wherever the HP
pea
>
> What does the line "return HttpResponseRedirect("/places/edit/%i/" %
> new_place.id)" mean? Why do we redirect to .../edit/... ? Does this
> mean I have to create a view for this url? I am very confused about
> this and I need clarification. Thanks.
>
The "/places/edit/%i/" will simply be
Thanks for your work! Definitely will test new branch soon & will tell
the results.
--~--~-~--~~~---~--~~
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@googlegroup
On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote:
...
> Oh I'll probably just be doing stuff like:
>
> {% if perms.lab.add_experiment %}
> < a href="something">Click to add experiment.
...
This should work.
> Also I should ask:
> return render_to_response('lab/user.html', data)
Tim Chase wrote:
> you might be able to get by with a point-and-drool GUI editor
Am I the only one who finds this hysterically funny? B-D
--
Nicola Larosa - http://www.tekNico.net/
I have a wonderful boyfriend. So how am I going to write a tortured
break-up song? My life is really good and I
I used to use tinymce too, but it doesn't generate well formed xhtml,
and I found http://www.wymeditor.org/ which looks great, it's still
very simple, but it has a lot of interesting features, and now It'll
become a jquery plugin, and that's great because I use to work with
jquery.
Anyway, I must
Hello,
I have a custom middleware class that would be used project-wide. I've
put it in the 'middleware' subdirectory of my project because it
doesn't really belong to any app.
The question is where to put tests for such code that exists outside
of any application? Django default test runner only
Hi,
In my urls.py I have the following entry:
url(r'^items/download/(?P[0-9A-Za-z._:%?-]+)\.(?P[0-9a-z]+)$',
web_view.item_export,
name="telemeta-item-export"),
In my template:
{% url telemeta-item-export item.id|urlencode,format.extension %}
For item.id = "BM.001:006" and form
thanks david. it´s working now (although I´m having problems
interpreting the stats, but that´s another question).
for everyone who´s reading this, here´s more about the python-
profiler on debian:
http://mail.python.org/pipermail/tutor/2005-March/036677.html
thanks,
patrick
Am 24.05.2007 u
> I guess you're looking for any permissions that are for the 'lab' app?
>
> Consider moving this into the view or writing a template tag-- There's
> not an easy way to do str.startswith in a template, which is what
> you'd need here.
I thought you could do {% if perms.lab %} for "any permission
Hi everyone. for the code below at
http://www.djangoproject.com/documentation/forms/
def create_place(request):
manipulator = Place.AddManipulator()
if request.method == 'POST':
# If data was POSTed, we're trying to create a new Place.
new_data = request.POST.copy()
Hi Malcom,
I really welcome this branch and thank you all for the effort.
Before I consider a bug what follows I'd ask if this should entitle
me to use
non ASCII letters in tests with test.client.
I tried something like self.client.get(url, dict(name=u'F\xf2')) to
get back
an error f
Patrickk,
On 24 May 2007, at 2:15 pm, patrickk wrote:
I´m just trying to do some profiling based on
http://code.djangoproject.com/wiki/ProfilingDjango
when trying to import hotshot.stats I´m getting this:
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/
On Apr 13, 10:46 am, "temnoregg" <[EMAIL PROTECTED]> wrote:
> i sent you private mail that I am interested, but without response...
Sorry. Your last message disappeared somewhere in my inbox.
I've refactored the code to separate the news from features (like
interviews or longer articles), and I
Hi
I use tinymce too, what rich text editor would you use (just to know
another options)?
Best regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dja
Index page doesn't need a view. Generally it is a static page, if it
have some dynamic data, it access through template tags. So, I follow
this structure:
project/
project/templates/
project/templates/main/
project/templates/main/base.html
project/templates/main/index.html
project/templates
Right, but if you will notice there is more than just the text in the
block.
So if I didn't put anything in the header block I would have to
include the DIV with the id=header each time as opposed to just the
block with my header text.
On May 24, 2:06 am, Michael Newman <[EMAIL PROTECTED]> wrote
No, I have tried that and it looks for a header variable in your
template context. It doesn't check if the block exists.
On May 23, 11:15 pm, David Robinson <[EMAIL PROTECTED]> wrote:
> I'm probably missing something about your question, and please excuse me
> if that's the case, but wouldn't you
You are right, I didn't know about add javascript in the model
definition, is good to know it :-)
I was thinking about doing an admin zone using a bit more of Ajax, and
autoload a select widget depending of a previous select... stuff like
that.
First I thought that I could create a second admin z
I´m just trying to do some profiling based on
http://code.djangoproject.com/wiki/ProfilingDjango
when trying to import hotshot.stats I´m getting this:
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/hotshot/stats.py", line 3, in ?
import profile
Import
On May 24, 7:30 am, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 5/23/07, Kelvin Nicholson <[EMAIL PROTECTED]> wrote:
>
>
>
> > Peter Pluta wrote:
>
> > > I don't really have any programming experience outside of hacking up a few
> ...
>
> > Don't forget to look into:http://www.diveintopython.or
Hi folks,
The unicode branch, [1], is now at a point where it is essentially
feature-complete and could do with a bit of heavy testing from the wider
community.
So if you have some applications that work against Django's current
trunk and would like to try them out on the unicode branch, I'd
app
> Hello, I need to hack a little bit the admin app, I'd like to use a
> custom widget (Rich text editor) in some places. I think I'll have to
> modify the admin code, is it right?
Most browser based WYSIWYG editors I've ever tried allow you to
implement them with only a little bit of javascript s
On Thu, 2007-05-24 at 13:13 +0200, Bram - Smartelectronix wrote:
> Hello Malcolm,
>
> Malcolm Tredinnick wrote:
> > Pleasee file a ticket with a small, self-contained, repeatable example
> > that demonstrates the problem. Reporting ticket son the mailing list is
> > a good way to have them forgot
Hello, I need to hack a little bit the admin app, I'd like to use a
custom widget (Rich text editor) in some places. I think I'll have to
modify the admin code, is it right?
After this, I'll probably need to make some changes in the admin zone,
s I have to rewrite some code. I think there is two p
We have used Django along side Java applications by using Jython and
HTTP requests from the Java to Django and vice versa. So if your
colleagues need more "serious" application features there are ways to
plug them into Django (although I'm sure some people might not agree
with the method) :)
On
On 5/23/07, Kelvin Nicholson <[EMAIL PROTECTED]> wrote:
>
> Peter Pluta wrote:
> >
> > I don't really have any programming experience outside of hacking up a few
...
>
> Don't forget to look into: http://www.diveintopython.org/
I love DiP, but I definitely feel it assumes you know a good bit
abo
Hi!
The documentation here:
http://www.djangoproject.com/documentation/apache_auth/
describes how to serve media files from Apache to authenticated users.
How to implement anti-robot protection here?
When user wants to download a file I show him some picture with code on
it and then I want to gi
Hello Malcolm,
Malcolm Tredinnick wrote:
> Pleasee file a ticket with a small, self-contained, repeatable example
> that demonstrates the problem. Reporting ticket son the mailing list is
> a good way to have them forgotten about.
>
> I did test JSON serialisation of decimals, so it doesn't fail
On 5/23/07, oliver <[EMAIL PROTECTED]> wrote:
>
> I have given up on komodo for now and moved to WingIDE.
> It does the code completion quite well, not to the extend that i would
> prefer as in including django specific functions. (if any one knows
> how to do that in wingide ??? would be handy!)
thanks Kelvin it really worked. thank you very much
Dushyant Sharma
--~--~-~--~~~---~--~~
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.com
To unsubs
I use .96, UTF-8.
I couldn't update a user instance with strings containing unicode
special characters in my views but it worked with the admin interface.
Some of you may encounter this problem, so here is the solution...
I got this error :
UnicodeEncodeError at /profile/xxx/edit/
'ascii' code
Peter Pluta wrote:
>
> I don't really have any programming experience outside of hacking up a few
> lines of php, but it'd like to start learning python and the django web
> framework. I haven't been able to find too many intuitive guides like those
> for php, so i'd thought i'd ask here. Does an
now when i start admin page it
> shows plain page without any look and feel.
[snip]
>
> Alias /media/ "/usr/local/lib/python2.5/site-packages/django/contrib/
> admin/media/"
>
My .02: are you running the media files off the same server as django?
You might need to try:
2007/5/23, David Larlet <[EMAIL PROTECTED]>:
> Hi,
>
> I'm juste curious, where did you put your homepage view when you've
> got a project with a lot of apps? Is there a best practice here?
>
Thanks a lot for your answers!
David
--~--~-~--~~~---~--~~
You received
c = Choice.objects.filter(choice=1)
c
> [, , ]
c.size.name
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'QuerySet' object has no attribute 'size'
>
> I still can't access the size and price's tied to style number 89b. I
> thought that c.size.nam
67 matches
Mail list logo