tle': loc.location.title, 'id':
> loc.location.id, 'state_id': loc.state.id, 'name': loc.name} \
> for loc in locations.iterator()
> ]
>
> render_to_response('template.htm', {'results': results})
>
> I run a query si
Hi
I am using django 1.0 to redevelop a website.
I have read http://docs.djangoproject.com/en/1.0/topics/db/queries/ and cant
work out how to do my query except using raw sql. It would be great to be
able to use the django query api so i can stack queries more easily.
Just one working example woul
ign key relationship work
with the current schema then I will move it as you have suggested.
Do you know how to build the admin.py to circumvent this issue?
On Mon, Jun 29, 2009 at 6:51 PM, Daniel Roseman wrote:
>
> On Jun 29, 4:57 am, Sam Walters wrote:
> > Hi
> > I am using d
It should not matter. Any modern Linux Distro which supports the
dependencies will be no different.
The only conceivable way this question makes sense is if you want to make
install or deployment easy. In which case use something thats based on a
debian, fedora type distro where there is heaps of
Hi Django world
I keep getting problems accessing and storing data in foreignkey and
one-to-one relationships.
Error is basically of the form:
"AttributeError
Exception Value: 'DirectoryAdmin' object has no attribute 'abbrev'"
The models.py file is here:
http://pastebin.com/mcc4ee45
The SQL it pr
Hi fellow Django users.
This is the first time necessity has required me to look at overriding
functionality in the django code.
I need to replace the and tags in a choicefield using radio
buttons with tags as my project has very specific formatting
requirements for this form.
I basically do
Thanks David
This example is exactly what i was hoping for.
I hope something like this gets put into a tutorial because i guess
many people would need to control exactly what their form looks like.
Cheers
-Sam
On Tue, Aug 4, 2009 at 11:00 PM, David De La Harpe
Golden wrote:
>
> Sam W
Hi
Its probably not the browser. I am using firefox 3.5 on an eee pc and
the documentation is fine. This is with Javascript disabled using
noscript however i just turned it on again and no noticable difference
in top readings
*You should look at the install addons of firefox, eg: some plugin
whic
Vim in conjunction with Git - most powerful + extensible editor out
there in my humble opinion.
On Thu, Sep 10, 2009 at 7:46 PM, boyombo wrote:
>
> Vim + pydiction + django.vim
>
> On Sep 10, 1:31 pm, eka wrote:
>> Vim + RopeVim + Omincompletion + taglist + tasklist + python_fn
>>
>> On Sep 10,
Here is the essentials from my models.py file:
class Event (models.Model):
contact = models.CharField(max_length=100)
email = models.CharField(max_length=100)
url = mod
Hi, im using django 1.0+mysql
I get an unexpected error:
"'event' is an invalid keyword argument for this function"
I get using a django view which used to work for moving data into the
mysql db by saving a foreign key
instance of 'Event' in 'Category'.
1. The model is:
class Event (models.Model
Hi
I am trying to get mod_wsgi installed on a production server.
Apache: 1.3.37
Kernel: 2.6.17.13-vs2.0.2.1vs-1.00
Os: CentOS 4.8
Following instructions from:
http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide
at the point with:
./configure --with-apxs=/usr/local/apache/bin/apxs
--with
You can always place some more performance testing code inside your views:
import time
t = time.time()
search_time=0.00
#
#place some code which hits the database here
#
search_time+=time.time()-t
search_time="%.3f"%(search_time)
This does not test the memory footprint of your
Hi I have been reading stuff like:
http://wiki.python.org/moin/SortingListsOfDictionaries
I want to sort a list of dictionaries (alphanumeric values) by
multiple keys (achieved with code below). However I would like to
customise the comparator to put empty objects last.
eg:
def orderBasedOnDepa
Thanks Daniel
Yes, it was multiple keys not just 'department'.
Will have a go and do some more reading on lambda.
cheers
-sam
On Thu, Dec 17, 2009 at 8:38 PM, Daniel Roseman wrote:
> On Dec 17, 6:23 am, Sam Walters wrote:
>> Hi I have been reading stuff like:
>>
>&
Yes, +1 to forgetting to update permissions at some stage of the game.
Best approarch to all this stuff is to make an interactive bash script
so wen you update a production server you just run the script.
Or document the steps, its often the smaller obvious steps which catch
people out.
On Mon,
Specifically what do you want to do?
1. Write a form to upload and display an image?
2. Dynamically display/generate an image? eg:
http://effbot.org/zone/django-pil.htm
3. hyperlink an image from a templates folder or media folder? (with
either django test server or a production server)
On Tue,
http://geodjango.org/
On Thu, Jun 3, 2010 at 11:35 AM, Stodge wrote:
> Is there a Django app (or SDK/API/technology/etc) that can recreate
> Google maps for a small area (say 60 square miles) with all maps
> stored locally on the server? Thanks
>
> --
> You received this message because you are
Hi Django Users
I have been looking to make some of my views secured by SSL, i have
made a certificate for testing.
For the views which require https i rewrite the url and redirect using
a decorator.
In theory this should redirect and nginx will server the views through https.
Instead what i fin
2, 2010 at 12:48 PM, Sam Walters wrote:
> Hi Django Users
>
> I have been looking to make some of my views secured by SSL, i have
> made a certificate for testing.
>
> For the views which require https i rewrite the url and redirect using
> a decorator.
> In theory this sho
I dont think they do.
The only time i use raw sql + joins is for performance... eg:
When you have a model and for each instance of that model it has a
reverse foreignkey relationship where you would have to call:
_set.all()
in a for loop thus making heaps of sql queries.
There are 3rd party addo
Hi fellow Django developers
I have Lat/Lng points stored in my db:
class Airfield(models.Model):
point = models.PointField(srid=4326)
I noticed when i query on my development server with postgresql i DONT
have to have the EXACT number of decimal places to find that point.
(what i want)
Howev
the old
> server, your representations of the number were precise enough to be
> identical, but on the new server, there is enough precision in the database
> to represent different numbers.
>
>
>
> "Reinout van Rees" wrote:
>
>>On 08/25/2010 02:57 AM, Sa
I have used geoip in conjunction with the rest of the geodjango
functionality. However you shouldnt have to deal with all the extra
complexity of geodjango (which isnt too bad one you get used to it ;).
Basically the process involves querying 2 IP's , getting a 'Point' for
each and then calculatin
I concurr.
I have seen:
/phpMyAdmin/scripts/setup.php
/phpmyadmin/
/user/soapCaller.bs
I guess there are security holes in old versions of phpmyadmin. Some
sort of content management with setup.php left unconfigured/unsecured
so the bots are just checking out all of those url's.
sam_w
On Thu, O
Also for all your tree related needs there is Django Treebeard:
https://tabo.pe/projects/django-treebeard/
On Thu, Oct 7, 2010 at 2:51 AM, Cesar Canassa wrote:
> I had the same issue a few months ago.
> My only answer to you is that is not worth to develop this all for self.
> There is a great
Read up on how linux programs work the file system becomes intuitive.
Also try this:
python -c "from distutils.sysconfig import get_python_lib; print
get_python_lib()"
cheers
sam_w
On Fri, Nov 19, 2010 at 3:08 AM, Kenneth Gonsalves wrote:
> On Thu, 2010-11-18 at 06:10 -0800, sheeptick wrote:
Hi
I have reached the optimisation stage of my project.
I am trying to work out how to reduce the turnaround time for my queries.
I implemented 'db_index=True' for the fields where i determined there
should be a performance boost by indexing that particular field.
This has not really improved the
Thanks for the replies.
Yes, there is the option of going to raw MySQL. However the project
requirements mean i can't use raw SQL. (portability, readability)
>From what i can see using django's db API i have to execute the
queries 500 times.
I am very familiar with the query documentation and i kn
ue hundreds of SQL queries.
"
Yes this seems to be the best way, do you have any links where i can
see how various people have implemented this? Would be good to write a
'pythonic' solution
cheers
-sam
2010/1/4 Tomasz Zieliński :
> On 31 Gru 2009, 01:56, Sam Walters wrote:
&
Thanks Koen
I had suspected such things would exist but couldnt find them.
I will take a look at this. Looks like a neat addon which would
greatly help my project turnaround time.
cheers
Sam
On Wed, Jan 6, 2010 at 11:07 PM, koenb wrote:
>
> On 31 dec 2009, 01:56, Sam Walters wrote:
>
Hi
The widget source code is here, its pretty easy to see wats going on,
if im dealing with forms i spend a lot of time in here:
http://code.djangoproject.com/browser/django/trunk/django/forms/widgets.py
And the docs are here:
http://docs.djangoproject.com/en/1.1/ref/forms/widgets/#ref-forms-widge
Is it just me or is asking for 5+ years for django unlikely.
http://en.wikipedia.org/wiki/Django_%28web_framework%29
"released publicly under a BSD license in July 2005"
On Mon, Jan 25, 2010 at 2:13 PM, James Matthews wrote:
> People should research before posting. But I always enjoy these
There probably isnt a good whole tutorial. Which looks at the
operation from client side to server side...
You should read about writing your own autocomplete field in JS.
And for server side look at writing a view which returns a JSON or
list of options which corresponds with the JS / JS framework
Hi Peter
If you want someone who is very good at python/django you could also
try contacting the people here:
http://www.newcastlelug.org/wiki/doku.php
cheer
sam_w
On Mon, Feb 22, 2010 at 4:15 PM, Peter wrote:
> Hi all
>
> Please see:
>
> http://tinyurl.com/djangojob
>
> for a job being adve
Yes, this conversation hits the nail on the head.
'select related' only works with forward facing keys.
http://code.google.com/p/django-selectreverse/ is a resonably good
piece of code to improve performance:
using a structure like:
class model1(model.Models) 1<* class model2(model.Models
http://pastebin.com/dFW6MdBm
Hi
I have a raw MySQL query which im using for performance reasons.
It works great except under one condition. When i want to apply a
filter based on a directories related table 'tags'. In SQL i use this:
`directory_directorytag`.`name` = '%s'
now typically i would w
en you would probably be down to
> one main query plus a lot of cache lookups.
>
> Also you were on the right track when using addresses =
> Address.objects.filter(directory__in=directories). I've often used
> that kind of queries to reduce (1 + many queries) down to (2 + lots of
> dic
Seriously why bother?
http://www.wxpython.org/
The whole front end of django is too web-centric. So the only thing
that might be of use is if you have an existing web application which
heavily uses the django ORM and you want back end consistency with a
desktop GUI application that shares thee sa
Ok lets see. At the moment:
Editor:
vim + http://code.google.com/p/trespams-vim/
sometimes gedit or kate
Editor console *this has been really useful:
yakuake
Debug client-side:
firebug, yslow, a windows computer with ie7
Version system:
git
OS:
develop on apto-sid (debian unstable), deploy on
Ok :)
Thankyou.
Yes ill try something like that when i have the time later this year!
On Sun, Aug 28, 2011 at 7:31 PM, Simon Connah wrote:
>
> On 28 Aug 2011, at 04:41, Sam Walters wrote:
>
>> Debug client-side:
>> firebug, yslow, a windows computer with ie7
>
> R
Yes. I mostly use vim+yakuake. I really like gedit and have used it
for large projects too.
Notably: I will try this gedit-django-project pluggin as it never
hurts to know your way around multiple IDE's.
sam_w
--
You received this message because you are subscribed to the Google Groups
"Django
I second this. Not something you would implement in django. Would
handle that with the web server front end. Eg: i used to get requests
to phpmyadmin login url requests (i assume thats because that software
is a security issue). So i got nginx to return a minimal 404 message
instead of the full 404
Hi
Helping people get started at work with PostgreSQL ad the most common
problem coming from MySQL users is they have trouble connecting to the
database:
setting up hg_hba.conf and some of the basic operations are different
to MySQL which confuses them.
I dont think there is an easiest way. Nginx+
Hi
In addition to the previous advice i would also check /etc/init.d/cron to
see if the daemon is running.
make sure you have the correct date+time settings in your shell eg: 'date'
command.
also run some sort of primitive debug command like:
* * * * * touch "/tmp/$(date +\%d-\%m-\%Y-\%T)"
for a
Hi
In addition to what has already been said.
Make use of command line search tools. Hoe to search through all the python
files using BASH is a good example.
eg: In one of my projects i have to find all the places where a particular
class is called or instantiated: 'LocationAirfieldLookup'
find
Its not specific to django however i have a few small projects on the
horizon where i could really save time spent on the things im not good at:
Graphic design CSS layouts, choosing fonts, colours that look good.
What are the tools people are using for this these days? What are strong
points of t
like "20 web designer tools" and you'll get
>> one of those blog posts that lists them all.
>>
>> And if you have time check out this list https://github.com/**
>> dypsilon/frontend-dev-**bookmarks<https://github.com/dypsilon/frontend-dev-bookmarks>.
The worst change i've had to make was a long time ago when we had to send
CSRF Token with Ajax calls because of a security exploit.
Had to write an entire regular expression and apply it to multiple template
files. Took perhaps 40 minutes.
However i can see some of the really old django snippets o
Hi
I make a shell script as i performs the steps for the first time.
Basically it means learning bash or something similar.
Disadvantage is its pretty inflexible however if its exactly the same
linux distro every time then its not too bad.
cheers
sam_w
On Mon, May 23, 2011 at 5:24 PM, Malcolm B
Hi
Also you can download a project from one of the many sites that have
source code. Look at a git tree and see the commit dates would give an
idea of how long it takes to build a project, how many people were
involved, how specialized their role was etc.
cheers
sam_w
On Sat, Jul 23, 2011 at 3:1
If a modern linux OS is crashing then it will likely /var/log whats
going wrong. The phrasing of this issue seems to indicate lack of
experience or familiarity with the linux os or unix model of os.
Thats no problem if you are keen to learn the principles of the OS you
will get better at using the
Hi i dont see what is complex about this.
On Wed, Aug 3, 2011 at 6:35 AM, Michał Sawicz wrote:
> Hi all,
>
> I'd like to pick your brainz about how would you approach constructing
> and rendering a complex table with headers, row/colspanning cells in a
> most clean way that rids the view of rende
Dont know specifically about sql lite.
I have used django orm with postgres spatial db to find points within
a 'convex hull' bounding box shape:
from django.contrib.gis.geos import GEOSGeometry, Polygon, LineString,
Point, LinearRing
from django.contrib.gis.measure import D
coords_in = simplejs
Hi,
I think you are looking to override the widget render() method to
build multiple HTML form elements?
Here is a good example:
http://k0001.wordpress.com/2007/11/15/dual-password-field-with-django/
I have built heaps of these things, usually a choicefield + charfield,
charfield + charfield, ch
Hi,
Personally I would map the priority of every character in a dict and
pass this to sorted:
dd = { "cha1": 1,
"char2": 2,
"char3": 3,
"char4": 4,
}
result = sorted(mylist, key=lambda x:dd[x[0]])
Point being if the db query isnt too slow you could use python.
cheers
sam_w
Hi,
My approach with regard to:
> frameworks I'm used to have at least a well structed API documention listing
> all methods and members of classes with some comment attached to them. They
> also show the class heirachy, quick and simple.
I just look at the source itself for this.
cheers
sam_w
at the very least use mysqldump on you db or a table before you play
with the code.
though depending on what you are doing backup should be even more
structured than ad-hoc sql dumps.
http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/
On Mon, Jan 17, 2011 at 10
Hi
This also depends how server-side oriented you want this to be?
Its good to learn geodjango. (that way if your calculation areas of
polygons, loading layers you can just make this python+server side
instead of writing it in javascript.
Also with lots of ajax related request/response designs so
Hi fellow Django users.
Its great news that 1.3 is out.
I have been using the development branch on one machine for a month or
so before this release so fiddling with some of the new features.
Very happy about the class based views.
Static file handling is so-so, *never really had issues with the
hey
use:
str.isdigit()
http://www.tutorialspoint.com/python/string_isdigit.htm
what is idDigit() ? is that a call to a method somewhere else.
and arent you trying to validate numberofapples = request.POST['numberofapples']
not playerid?
Personally if this is form data you are trying to validate
Yes, this is really a client-side related issue.
To try and answer your question what would be involved on the django
side of things:
Basically you want django to deal with any submission from one of
these fields as either a from or modelform so you can run clean() and
validate the input.
Beyond
Hi Yongzhen,
Looks like you're trying to run two mis-configured web servers.
if you're on linux stop the nginx process eg: /etc/init.d/nginx stop
The stuff you've submitted is for apache: Send us the contents of the
apache log file showing the error.
Perhaps *if the error is long* use http://pas
Hi hank23
request.POST would be immutable.
"QueryDict instances are immutable, unless you create a copy() of
them. That means you can't change attributes of request.POST and
request.GET directly."
http://docs.djangoproject.com/en/dev/ref/request-response/
So I'm
> wondering if there is somethin
py of
>> request.POST (request.POST.copy()) like this:
>>
>> request.POST['title'] = record.title
>>
>> I actually call sub views from the main view which processes this
>> screen, display the data as shown above as well as capture the changes
>> to the
Hi
I dont usually deal with Apache+WSGI (usually fcgi + nginx)
However your script:
WSGIScriptAlias /wsgi /var/www/wsgi-scripts
One of my apache sites:
WSGIScriptAlias / /home/hvv00/hvv/wsgi/hvv.wsgi
Point directly this directly to the file.
Note: You wont need to chmod 777 anything
S
I dont understand so you render a view with a form once and you get
form errors on the initial view?
Or
Is there a POST/GET with formdata being submitted generating this
issue? *which would be by design as fas as i can tell you want form
verification to work
Note:
http://docs.djangoproject.com/e
Hi Andy
I dont combine them... however:
I was using a couple of decorators for almost every view in one
project. Ended up putting them in middleware.
Are these decorators for every view? Maybe you should consider middleware too.
cheers
sam_w
On Mon, Apr 4, 2011 at 3:26 AM, andy wrote:
> Do you
Yes it already exists {{MEDIA_URL}}
Thats what the settings.py file does...
There is a bunch of stuff you can read about in the docs:
http://docs.djangoproject.com/en/1.3/howto/static-files/
Also for some of my own deployments there are a bunch of static file
servers so i just put these into se
Hey
Block tags dont work like that.
{%if choice1 == 2 %}
{% include "sometemplate.html" %}
{%endif%}
instead of:
{%if choice1 == 2 %} {%block two%}
> The temperature in {{city}} is {{temperature}}°
>
> {%endblock two%} {% endif %}
I hope that was what you were thinking...
http://docs.d
Hi Vincent
Yes.
Look at the HTTP Headers.
Just in case you need to read the docs on 1.2.5 which identified the
CSRF AJAX issue.
http://www.djangoproject.com/weblog/2011/feb/08/security/
Also looking at the request in firebug you can see the 'X-CSRFToken'
needs to be added as an attribute with t
Use python imaging:
http://www.pythonware.com/products/pil/
You can return a response with an image of the graph.
response = HttpResponse(status=200, mimetype="image/gif")
background.save(response, "GIF")
return response
There is no 'best practice for this' Some people i know use flash.
However
PM, nai wrote:
> You have to bear with me but where does background come from? So I can
> use the save() method from the PIL library is that right?
>
> And I can do something like this:
>
> return render_to_response('template.html', {'graph':response})
>
I mis-read this... basically you have one view and in the template you
are rendering you put HTML:
so that path will call your other views which return content as
content_type='image/png' or whatever specific format you're using.
what i was suggesting is you could have:
So in your urls.p
Postgres uses a unix style user model. Its intuitive once you understand it:
I would seriously advise you to read the tutorial for this:
http://www.postgresql.org/docs/manuals/
FInd out the version you are using too.
Specifically:
1.2. Architectural Fundamentals
onwards.
That error just means
Hi
If this is a sequence then why not use python list comprehensions,
nest them together and concatenate the different parts into a string.
http://docs.python.org/tutorial/datastructures.html#nested-list-comprehensions
you could even do it with recursive method calls.
Point is. If its not 'random+
Hello
With this sort of problem it depends on the dimensions of your data. What
kind of data is associated with a user? Is this just editing a user profile
like the built in django 'user' or is there a lot more?
My approach to this sort of stuff is a straightfoward initial HTTP response
with your
Did you perhaps change the schema of the database after you had created it.
Eg: added null=True as a constraint after creating the table?
If so check the db sheme using:
python manage.py sqlall
It sounds simple enough. You will have to go into the db shell and update
your schema manually.
usin
Hi
Presumably you have had a look at logging docs and its not good enough?
https://docs.djangoproject.com/en/1.10/topics/logging/
With these sort of project requirements the way i have solved this in the
past is to:
*Work out who needs to receive certain messages. Draw a grid with all
useful messa
79 matches
Mail list logo