very gnarly bug that
I need to step through line at a time watching variables...
good luck
tom
---------- Tom Smith
---
[EMAIL PROTECTED] http://everythingability.comhttp://
theotherblog.com
mobile: +44 (0)7720 288285 land
foreign key relationships weren't shown.. The first base for me would
be able to view a model in Workbench, that'd be great...
regards
tom
--------
Tom Smith
http://www.everythingability.com
yahoo, aim, skyp
LOGGED IN GO GET THE PAGE
resp2 = opener.open('http://localhost:8771/admin/bah/awmerchant/175/')
print resp2.read()
Tom Smith
http://www.everythingability.com
yahoo, aim, skype: ever
I'd like to be able to "catch" when creating a new object... fix a
few things up then let the normal thing happen... for example...
class myObj(models.model):
def __init__(self, **kwargs):
t = kwargs['title']
t = "Offer:
rls')), )
. of course I can get the domain out of the SERVER_NAME, but then
setting urlpatterns doesn't actually DO anything does it?
regards
tom
Tom Smith
http://www.theotherblog.com
yahoo, aim, skyp
rls')), )
. of course I can get the domain out of the SERVER_NAME, but then
setting urlpatterns doesn't actually DO anything does it?
regards
tom
Tom Smith
http://www.theotherblog.com
yahoo, aim, skyp
A! We can figure out where/if it belongs
> in django core later. Where's the code? ^_^;;;
I'm working on it ;-)
Tom Smith
http://www.everythingability.com
yahoo, aim, skype: everythingability
mob: +44 (0) 7720 288 285
On 21 Mar 2007, at 22:58, Scott Paul Robertson wrote:
>
> I've got an hour and a half. I was planning to only hit the high
> points,
> then leave references to other things, and maybe mention briefly why
> they should care.
>
> Thanks for the suggestions (this goes to everyone)
For me... the h
> It becomes less useful as you get more
> experienced, because there is no "one size fits all" approach to
> application layout.
You wouldn't say that if you'd seen my code... I'd love to be guided
on application layout, in fact, it was only at the end of my first
django project that I think
On 22 Mar 2007, at 06:57, Malcolm Tredinnick wrote:
>
> On Wed, 2007-03-21 at 23:36 -0700, [EMAIL PROTECTED] wrote:
>>> Hmm... if we do it, this feels like something that should be kept
>>> separate from the standard manage.py;
I don't mind "where" this functionality "lives"... and really don't
app + "/" + "templates")
# create the stylesheet
f = open( app + "/" + "templates/stylesheet.css" , 'w')
f.write('''body{
}''')
f.close()
# create a base template that has links to style sheet and all the meta base tags I need.
fname = app + "/" + "templates/base.html"
print "creating a base.html and example.html template"
f = open( fname , 'w')
f.write('')
f.write('''http://www.w3.org/TR/2000/REC-xhtml1-2126/DTD/xhtml1-transitional.dtd";>
http://www.w3.org/1999/xhtml";>
{%block page_title%}Untitled{%endblock%}
{%block header%}Navigation goes here{%endblock%}
{%block content%}{%endblock%}
''')
f.close()
# create a template that extends that template, not used anywhere...
f = open( app + "/" + "templates/example.html" , 'w')
f.write('''{% extends "base.html" %}
{% load humanize %}
{%block header%} {%endblock%}
{%block content%}
Bla bla
{%endblock%}
''')
f.close()
do("mkdir " + app + "/" + "static")
#DO URLS
### CREATING FOLDERS AND FILES
print r"remember to add... (r'^"+ app +"/', include('"+project+"." + app + ".urls')),"
print " to your main urls.py file!"
print
print "Now edit your models and views and urls before running python manage.py syncdb"
Tom Smith http://www.theotherblog.com
On 4 Feb 2007, at 16:44, Ramiro Morales wrote:
> See tickets #2210 and 2076 where a patch is proposed to solve the
> problem.
I tried to patch it.. like this...
>>cd /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/
site-packages/Django-0.95-py2.4.egg/django/db/models
>>patch
On 4 Feb 2007, at 17:51, Don Arbow wrote:
> class Meta:
> ordering = ('pagerank',)
Except that I'd have quite like to sort by other attributes as
well... default ordering is ok but it'd be nice to be able to swap
ordering on the fly wouldn't it...
I kinda half expected this to work...
I have a model that looks roughly like this...
class Client(models.Model):
name = models.CharField(maxlength=200, default='')
class Competitor(models.Model):
client = models.ForeignKey(Client)
site = models.ForeignKey(Site)
class Site(models.Model):
client = models.ForeignKe
I'm probably missing some basic python convensions about importing
modules, but...I've been trying to work with my model and get it all
working before working with the views. Normally, when working with
normal python scripts I'd do something like this..
import google_utils as g
print g.sear
I'm having trouble on deciding where to start with this problem. I
only have one port to use on TextDrive.
I have .co.uk site running using Django (under FastCGI). I want to
duplicate the site and change the content for the .com US version,
making modifications to the model/code/template
I have a similar solution/problem...
Firstly, my "solution" was to create a method in my vews.py like this...
def my_render(request, template, dict):
url_time = 0
try:
for query in connection.queries:
log( query['time'] + "\t" + query['sql'
Essentially I think the problem is this...
I am trying to do an ORDER BY on a pre-populated (and indexed) column
called random_number... I created this column because RAND() is so
slow...
It is the ORDER BY which is causing all the slow downs... If I do a
select without the order by it is
Really what I need to do is "re-order" the database rows (for good)
by the random_number column... note.. I am not using RAND() at all...
Hey, this gives me an idea...
Given I have price ranges 1-2, 2-5, 5-10 etc... and the prices are
all like 1.99, 1.96 etc... What if I precalculate a value
On 18 Nov 2006, at 19:35, Jeremy Dunck wrote:
> This isn't a Django question, but indexes only work well when there's
> a large distribution of values. If lots of your products are in that
> price range, you're still ordering by loads of randoms. Try assigning
> (as a column value) a random int
On 18 Nov 2006, at 18:59, tonemcd wrote:
>
> Perhaps something from here will help?
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/59883
>
> Where your list is an xrange(min...max) of id's from your database
> table. That is, do it in python, not with your database...
Ah sorry, for
On 19 Nov 2006, at 05:35, coulix wrote:
> mikeb i have the same problem it takes few minutes to come back and i
> see a lot of python process waiting for whatever.
> kill kill all ect have no effects.
> But once it runs its all good.
I have never found that the "touching" thing ever worked, but
Hello.
When in mysql I do a...
explain select title from burningahole_product where ( price >10 and
price<20) order by random_number limit 10;
... I get...
++-+--+---
+++-
+--+-
On 16 Nov 2006, at 02:29, Jay Parlar wrote:
> Well, here's the way I do it. On my development machine, I do all my
> hacking out of a SVN working directory. When I get everything working
> how I want it locally, I do my 'svn commit', then login to my
> production server.
>
> From there, I have an
On 13 Nov 2006, at 17:21, Jay Parlar wrote:If you're on a unix-like system, you should be able to just do a 'touch' on your .fcgi file.I tried the touching trick (on main.fcgi and django-fcgi.py) and it doesn't work... is there another way to "refresh" django without having to kill the root python
I have been making changes to my code an not seeing the changes
happen...
How do I restart django under Lighttpd/FastCGI so that changes to my
model etc stick?
Thanks
tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Goog
On 13 Nov 2006, at 13:14, Ivan Sagalaev wrote:Tom Smith wrote: For example, I have made a change to my models.py file and I am logging all sql to a log file... But when I sit and watch it, the OLD sql is still getting executed... Could it be that having caching turned on is causing this? Does
Hello...
I am running Django using Lighttp and FCGI and I am not quite sure
about it conceptually,
For example, I have made a change to my models.py file and I am
logging all sql to a log file... But when I sit and watch it, the OLD
sql is still getting executed...
Could it be that having
I get this on a page called, funnily enough, "amp"
Is it a bug?
TemplateSyntaxError: Caught an exception while rendering:
Original Traceback (most recent call last):
File "/users/home/tomsmith/domains/burningahole.co.uk/django/
django/template/__init__.py", line 706, in render_node
re
Now I know that it is always hard to comment on specifics but I have
just discovered something very strange on my server and could
someone please help...
I am running Django on Textdrive which requires Lightpd. I went
through the setup... and boy that was difficult, so many config files
I have a lovely little django driven database site that is fine
except for one thing...
ever so occassionaly there is a sql call that goes
select * from product
Now, I don't call that explicitly... but it does happen... and I have
a million products and it kills mysqld... shaboom!
> Just to establish that we are all on the same page: are you seeing the
> error when you use exactly the model example you posted yesterday and
> cut and paste the queryset constructor that Rajesh posted? That should
> be working.
No, it fails for me, we are on the same page.
> If that is fail
On 11 Oct 2006, at 18:59, Rajesh Dhawan wrote:Hi, This still works for me! The only change I made to your model was to add a "class Admin: pass" to your ProductWord class so that I could add a ProductWord test object through the Admin UI. My results in the shell: from my_app.models import Produ
Oops... replied to wrong thread...
here it is...
It has a lot of stuff... but the core is simple enough, like this...
class Product(models.Model):
title = models.CharField(maxlength=200, db_index=True)
url = models.URLField(maxlength=250, db_index=True, unique=True)
It has a lot of stuff... but the core is simple enough, like this...
class Product(models.Model):
title = models.CharField(maxlength=200, db_index=True)
url = models.URLField(maxlength=250, db_index=True, unique=True)
class Word(models.Model):
va
On 10 Oct 2006, at 22:11, RajeshD wrote:
>
> See if this helps:
>
> Product.objects.filter
> (productword__fk_word__value__exact='thomas').distinct()
When I try that... I get...
TypeError: Cannot resolve keyword 'productword' into field
--~--~-~--~~~---~--~~
Y
Or to put it more simply... all I'm trying to do is this...
Select * from myapp_product, myapp_productword, myapp_word
where
myapp_productword.fk_product_id = myapp_product.id
and
myapp_productword.fk_word_id = myapp_word.id
and
value = 'assam'
order by title
..returning Product objects...
--
On 10 Oct 2006, at 17:51, Ramdas S wrote:
> Hi,
>
>
> I need to add a few columns to some of the tables in a live
> application. We have new requirements.
>
> I propose to do the same by adding a column to the MySQL table using .
>
>
>
> ALTER TABLE table_name ADD new_field_name VARCHAR(60);
>
My model is like this...
class Product(models.Model):
class Word(models.Model):
value = models.CharField(maxlength=200, core=True, unique=True)
class ProductWord(models.Model):
fk_word = models.ForeignKey(Word , core=True)
fk_product = models.ForeignKey(Produc
With about a million records I can't imagine doing it any other way...
I want to find my top 100 words (by product_count) then sort them
alphabetically to make a tag cloud...
thanks...
--~--~-~--~~~---~--~~
You received this message because you are subscr
On 10 Oct 2006, at 15:08, Tom Smith wrote:
>
> Sorry for what is probably a simple python question, but if I have a
> list of Products and I have searched for 100 of them ordered by x...
>
> then how do I then sort the QuerySet returned by title?
>
> I can
Sorry for what is probably a simple python question, but if I have a
list of Products and I have searched for 100 of them ordered by x...
then how do I then sort the QuerySet returned by title?
I can't do an .. object_list = products.items().sort('title')
because I have already done a [:100]
Hang on...
I realise I should have a ManyToMany thing going on... apologies
--~--~-~--~~~---~--~~
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
I am really struggling with this...
class Product(models.Model):
snip...
class Word(models.Model):
value = models.CharField(maxlength=200, core=True, unique=True)
class ProductWord(models.Model):
fk_word = models.ForeignKey(Word, core=True)
fk_product = models.
In trying to do some custom SQLto search for words (so "Three" but
not "Threesome")
... but because the call adds quotes.. I have had to do this...
for word in words:
sql = """select count(*) from myapp_product WHERE title
LIKE (%s)
AND title RLIKE %s """
On 6 Oct 2006, at 21:26, RajeshD wrote:
>
>> for word in words:
>> q = q.filter( Q(title__icontains=word) )
>>
> Try something like this instead of the above:
>
> q_fragment = Q(title__icontains=words[0])
> for word in words[1:]
> q_fragment = q_fragment | Q(title__icontains=w
I am trying to iterate through a list of strings to create...
OR titile LIKE '%This%' OR title LIKE '%That%'
q= Product.objects.filter( some stuff )
for word in words:
q = q.filter( Q(title__icontains=word) )
return q[:10]
...but the contains Queries get AND-ed together...
thank
When I turn on caching... and use...
CACHE_MIDDLEWARE_ANONYMOUS_ONLY= True
...then, if I am logged into the admin part of my site... all pages
are not cached...
Is this right? I'd prefer it if the Admin screens weren't cached but
the rest were
regards
tom
--~--~-~--~~
I am trying to get the best out of the caching abilities of Django
but I have unusual needs...And the caching is showing unusual
behaviour...
When I added caching... a url like this /x/y/z/ returned results
OK... but I wanted the cache to work for MOST pages but not ones
where some person
On 4 Oct 2006, at 17:09, Andy Dustman wrote:On 10/4/06, Tom Smith <[EMAIL PROTECTED]> wrote: If I am looking for titles like "Anal Sex" or "Being Anal" then howdo I construct this, ahem, query... to not return "Analysis" or"Analog"? Two options:
Events (Spanish)) The Complete Psychological Works of Sigmund Freud: "New Introductory Lectures on Psycho-analysis" and Other Works Vol 22..probably...On 4 Oct 2006, at 17:01, John DeRosa wrote:heh. so do we get to guess what your django-based site is about? Tom Smith wrote: If I am look
I couldn't quite work out how to do that... there's not enough
guidance... so I created a method in Views.py like this...
def add_defaults(the_dict={}):
the_dict['BASE_URL'] = "/burningahole/"
the_dict['STATIC_URL'] = STATIC_URL
...etc
return the_dict
...and
If I am looking for titles like "Anal Sex" or "Being Anal" then how
do I construct this, ahem, query... to not return "Analysis" or
"Analog"?
I tried adding spaces to the end of the word but it doesn't seem to
help...
object_list = Product.objects.filter( Q(title__contains=word + " ")| Q
As everyone knows (or as yet to learn) the success of many
technologies is down to how snazzy the end result is...
So it surprises me that I can't find any reference to anyone uses
MochKit (or any other client-based toolkit) with Django... in fact
that seems to be be the key differentiator
Wouldn't it be nice if I could...
>>> python manage.py sync-urls-to-views.py
...and have some output that creates all the functions (with params)
called for me... even if only splatted to screen
Wouldn't it be nice if if perhaps in reverse I could...
>>> python manage.py sync-views-to
On 28 Sep 2006, at 00:56, Steven Armstrong wrote:
>
> On 09/27/06 23:49, Tom Smith wrote:
>> Thanks, it all seems to work except for when I store a list of
>> objects in the database and try to get it out I get a string (that
>> looks like a list of ob
Thanks, it all seems to work except for when I store a list of
objects in the database and try to get it out I get a string (that
looks like a list of objects)
>>> products = Product.objects.filter(title__contains='Dog')[:10]
>>> sub = Subscription(email=&q
My service provider requires it for SMTP... I have set the EMAIL_PORT
but the email doesn't seem to go...
My message content is HTML (is this ok?)
My last error is... Connection unexpectedly closed, but I've also
had...SMTP AUTH extension not supported by server (for gmail)... (60,
'Operat
Hello
currently I am storing a list of python instances in the
request.session but would like to make a persistent copy of this list
and store it permanently...
I don't want to just make the timeout of the session a long time in
the future, because each user could have multiple lists of o
On 10 Sep 2006, at 16:52, Allan Henderson wrote:
>
> Complete newbie problem here but i can't seem to get django to show
> any images or stylesheets etc.
>
> In urls.py:
>
> (r'^images/(?P.*)$', 'django.views.static.serve',
> {'document_root': '/Users/whitebook/django/django_projects/mysit
Hello,
I'm trying to write a very simple script that takes a list of URLs
for images and gets their data... resizes them to 110x110 (hopefully
preserving aspect ratio) and then puts that data into an ImageField
obj...
any pointers gratefully received
tom
--~--~-~--~~---
Nearly there with this code...
from PIL import Image,ImageFile
def get_image(src):
import urllib
fp = urllib.urlopen(src, "rb")
p = ImageFile.Parser()
while 1:
s = fp.read(1024)
print ".",
if not s:
Can someone show me how to get x number of chars from a variable in a
template please...
I've tried...
{{product.title | ljust 40}}
and other formats but can't get it to work...
thanks
--~--~-~--~~~---~--~~
You received this message because you are subs
On 24 Sep 2006, at 19:41, [EMAIL PROTECTED] wrote:File > Launch > give it the path to manage.py runserver and debug from there Sorry but when I do that... it just sits there doing nothing..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
For me at least is...
A long time ago, I used to use a programming language that let me set
breakpoints and when the code stopped, I could inspect all the
variables, change them (the code would roll back to where the
earliest change was)... call non-existent functions which would raise
an
I have a model that is trying to join (sloppily) across 3 tables.
KnownCategories are a "group by catalog" reduction of Product.catalog
(because I thought it would be quicker but I don't know if I'm
right)...they should join like this...
Product.catalog <--> KnownCategory.fk_name <-
At the moment I am learning django and so far, almost everything about it feels fantastic. Except for this...A lot of the time I need to change the database model as I go... I have millions of records and have problems dumping all the data out re-sync-ing the database and then importing the data ag
Whilst playing with the MacOS X Gui Tools, I re-discovered mysql
Views. They would be massively useful to me... for example I could
have a query that inserted into a view which would mean django
wouldn't have to be performing complex queries on-the-fly.
The questions are:
1. Can Dja
My MacOS X Django Development environment.
I have found the easiest to be to install MAMP, which has Apache
(which at the moment I don't use) and MySQL built in ... It has a
nice GUI.. http://www.mamp.info/
Then install the MySQL python module mentioned//
http://pythonmac.org/packages/py24-
If I have a class Catalog which relates to a class Product... in the
admin interface I'd like to specify a function (to be used to
navigate to related products) rather than a field... like this...
class Catalog(models.Model):
name = models.CharField(maxlength=200, core=True, db_index
Whilst writing what is below I realized that if a template extends
itself (accident...oops!) it completely crashes the server... maybe
this could be trapped somehow...
> I have a base.html template which has HTML and defines a block
> "content", like this...
>
> Hello
> {% block c
On 18 Sep 2006, at 16:26, James Bennett wrote:p.exclude() returns a new QuerySet with the filtering, so you need to grab the return value, like this: if len(notsitelist)>=1: print "excluding sites: ", notsitelist p = p.exclude(fk_site__in=notsitelist) That was it... silly me, just missed i
On 18 Sep 2006, at 16:27, Michael Radziej wrote: Is there way to do p.get_query(.)p.show_sql() I really don't get what this is supposed to mean, it just looks like seriously broken syntax. Not really.. having built and manipulated (with exludes, filters, order etc.) I'd quite like to peep at the
> Query sets are not executed on the database until you iterate, or
> otherwise try to extract data from them.
>
> o = Recipe.objects
> o2 = o.filter(xx)
> o3 = o2.filter(yy)
> o4 = o3.filter(zz)
>
> print o4
>
> will result in just 1 query getting issued to the database - the final
> query with t
On 16 Sep 2006, at 12:42, Malcolm Tredinnick wrote:
>
> On Sat, 2006-09-16 at 12:25 +0100, Tom Smith wrote:
>> How would I build an "AND" query...
>>
>> for example...
>>
>> words = ['chicken', 'beef', 'lamb']
>>
On 16 Sep 2006, at 13:39, Malcolm Tredinnick wrote:Are you sure it's really getting to that last line and not returning somewhere earlier?Yes... Does request.META['HTTP_REFERER'] contain something sensible? This won't be the cause of the problem, but it's worth checking.Most of the time... sometime
I would really like to be able in my views.py file to do a...
def do_something(request, x):
#do something that changes some session vars here...
#now go back to where you were
return HttpResponseRedirect(request.META['HTTP_REFERER'] )
.. but I always get...
ValueError
Ex
How would I build an "AND" query...
for example...
words = ['chicken', 'beef', 'lamb']
Recipe.objects.exclude(title__contains=words)
I don't want to do 3 queries...
thanks
tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
On 8 Sep 2006, at 22:53, James Bennett wrote:
>
> On 9/8/06, tom smith <[EMAIL PROTECTED]> wrote:
>> Then because the sql has a % in it.. django complains...
>
> The '%' needs to be escaped, because it's a special character in this
> context. Make i
So...
Because there aren't quite enough examples that show how to build
pythonic model queries... I'm using the pump-raw-sql at django...
The only problem is that when my sql contains
wordsql = wordsql + " AND (title not like ' %" + word +"%') "
cursor.execute(sql)
Then because the sql has a
80 matches
Mail list logo