Re: quickest way to print template names

2009-05-17 Thread Sam Chuparkoff
On Sat, 2009-05-16 at 23:37 -0500, Alex Gaynor wrote: > There isn't a better solution, a Template doesn't store the file it > was rendered from (especially since that doesn't make sense for all > template loaders, such as if you render a template from a string), nor > does the context inherently h

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 10:41 -0700, Bobby Roberts wrote: > from django import forms > from django.contrib.auth.models import User > > # pull a recordset of the users > userdata = User.objects.all() > > def myuserlist(self): > for i in userdata: > self[i.id]='%s %s' %(i.first_name,i.la

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 18:43 -0700, Bobby Roberts wrote: > in my view i have this: > > > if request.method=='POST': > form=FrmIdMessage(request.POST) > if form.is_valid(): #process valid form here > assert False, request.POST.get('posted_to','') > [snip] You sho

Re: Seeking Example of MultipleChoiceField Example with dynamic Choices

2009-05-17 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 20:01 -0700, Bobby Roberts wrote: > yeah i'm still lost... You don't need to change your form, just use form.cleaned_data in your view. Same example, a few more lines: >>> # our form ... >>> from django import forms >>> from django.contrib.auth.models import User >>> >>>

Re: Does a django social sharing widget app exist?

2009-05-18 Thread Sam Chuparkoff
On Sun, 2009-05-17 at 22:47 -0700, Aaron Maxwell wrote: > If this exists, google doesn't seem to know about it. I haven't looked at this, but here's a link: http://tylerlesmann.com/2009/mar/09/announcing-django-sociable/ sdc --~--~-~--~~~---~--~~ You received

Re: RequiredIfOtherFieldEquals error

2009-05-18 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 01:03 -0700, Christian Martín Reinhold wrote: > Hello I am kind of new with django and I am trying to adapt a piece of > code to the 1.0 version. > > datetime = models.DateTimeField(blank=True, null=True, > validator_list=[RequiredIfOtherFieldEquals('status', '2',("A

Re: User attribute access from within profile model

2009-05-18 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 17:12 -0700, neri...@gmail.com wrote: > I have an Employee profile associated with Users who are staff, how do > I return the associated user attributes from within the profile model > i.e., 'full_name' from Users? Anytime I try to access the User > attributes from within the

Re: MultiValueField with required=True problem

2009-05-19 Thread Sam Chuparkoff
On Mon, 2009-05-18 at 10:13 -0700, [CPR]-AL.exe wrote: > I've created a field+widget set that i use to render a number of > checkboxes and a TextInput with comma-separated values. > > The problem is, when i set required = True, I get a ValidationError if > only checkboxes are selected (but i don'

Re: User attribute access from within profile model

2009-05-19 Thread Sam Chuparkoff
On Tue, 2009-05-19 at 12:12 -0700, neridaj wrote: > There are attributes for first_name and last_name, why wouldn't > user.first_name work? I'd expect an AttributeError is you are accessing an attribute that doesn't exist. Thus my assumption. sdc --~--~-~--~~~---~-

Fwd: Best Django host

2009-05-20 Thread Sam Kuper
eamhost; but it's also fiddly to set up.* My approach would be to set up a new user in the Dreamhost panel, and set up Django under that user's shell account. Then assign the domains you want to use Django for to that user, and Bob's your uncle. Sam * If you're having dif

Re: MultiValueField with required=True problem

2009-05-20 Thread Sam Chuparkoff
On Wed, 2009-05-20 at 07:09 -0700, [CPR]-AL.exe wrote: > So, what is the best way to throw a ValidationError only if None of > values a entered in subclassed field? I don't know if you understood my post or read the code for MultiValueField. MultiValueField is designed to check for empty values a

Re: Installing django

2009-05-20 Thread Sam Chuparkoff
On Tue, 2009-05-19 at 11:06 -0700, LeonTheCleaner wrote: > Hi, > > I am trying to install django by using this: > > http://wiki.dreamhost.com/Django > > but there are a few things I don't understand. I see you asked another question about the best django host, and got a lot of replies to that

Re: Installing django

2009-05-20 Thread Sam Kuper
the quotes). If it's there, fine. If not, you may need to create it yourself. Thanks in advance. OK :) Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group

Re: django captcha

2009-05-20 Thread Sam Kuper
ere to download. You can download this by checking out the head of the project's subversion repository. Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to t

Re: Ignoring Definite/Indefinite Articles when Sorting

2009-05-21 Thread Sam Chuparkoff
On May 21, 10:10 pm, Darryl Ross wrote: > I have searched around but not really found an answer to this. For a > project I am working on the customer wants a list of publications to be > sorted alphabetically, but ignoring the definite/indefinite articles > "the/a/an". You could create a new fie

Re: Cannot reload a Django models module within a "manage.py shell" session

2009-05-21 Thread Sam Chuparkoff
Reloading your models module is not going to give you different model classes, because django tracks these classes by name. This is why the tutorial instructs you to start a new shell after you've modified your models. sdc --~--~-~--~~~---~--~~ You received this

Re: abstract and isinstance()

2009-05-22 Thread Sam Chuparkoff
On Fri, 2009-05-22 at 10:36 -0700, shadfc wrote: > I've got a few classes that inherit from an abstract class. At some > point, I want to check and make sure that an object is an instance of > the base class, but this always seems to fail. I've posted what I know > and what I think may be relevan

Re: adding errors to forms

2009-05-23 Thread Sam Chuparkoff
The reference you want is here: http://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors Note particularly those first few paragraphs under 'Form subclasses and modifying field errors', and examples below. sdc --~--~-~--~~~--

Re: please provide a html download of the doc

2009-05-23 Thread Sam Chuparkoff
Email me privately and I will send you the html docs. sdc --~--~-~--~~~---~--~~ 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 unsubscribe from

Re: running django with wsgi over apache

2009-05-23 Thread Sam Chuparkoff
On Sat, 2009-05-23 at 16:55 -0300, Gabriel wrote: > I can make django work under wsgi. > > I configured apache to run wsgi and the test script works. > > This is the vhost conf: > > > ServerName test.banshee.lnx > DocumentRoot "/home/www/python" > ErrorLog /home/gabriel/pywks/test/

Re: running django with wsgi over apache

2009-05-24 Thread Sam Chuparkoff
On Sun, 2009-05-24 at 13:27 -0300, Gabriel wrote: > The problem was with one of the applications 'profile'. It seems it > already exists somewhere. Correct, there is a standard python module called profile. $ python Python 2.6.2 (r262:71600, May 7 2009, 21:32:12) [GCC 4.1.2 (Gentoo 4.1.2 p1.0.

Re: Revisit Django trunk and Python 2.6

2009-05-24 Thread Sam Kuper
If you need to use mysqldb, you may have problems. At least, I ran into snags last time I tried to use Django trunk with mysqldb and Python 2.6, and dropped back to 2.5.x --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Problems with excluding user-field from form

2009-05-24 Thread Sam Chuparkoff
On May 24, 5:49 pm, Martin wrote: > Hi, > > I'm struggling with a simple edit-form. My model has a user-FK and > authenticated users can 'create' objects of this model with a form. > Pretty simple. They should be able to edit these objects later, but of > course not change the value of the user-f

Re: abstract model with save method

2009-05-25 Thread Sam Chuparkoff
On Mon, 2009-05-25 at 09:42 -0700, Viktor wrote: > super(self.__class__, self).save(force_insert, force_update) This line at least is bad. You want: super(AcceptedRoleAbstract, self).save(force_insert, force_update) Do post again as per Karen's request if you're still having trouble.

When to use admin, and when not to.

2009-05-25 Thread Sam Kuper
s out of the admin app entirely, and reserving the latter only for Facebook staff. Or would you take some other approach? Please explain your answer, and link to documentation where relevant. Many thanks! Sam --~--~-~--~~~---~--~~ You received this message becaus

Re: When to use admin, and when not to.

2009-05-25 Thread Sam Kuper
2009/5/26 Alex Gaynor > On Mon, May 25, 2009 at 7:51 PM, Sam Kuper > wrote: > >> Suppose you were re-writing Facebook in Django. >> >> Would you handle the complex profile and privacy settings pages by: >> >> A) exposing the relevant admin pages to users,

Re: Pass result of a template filter to tag

2009-05-26 Thread Sam Kuper
2009/5/26 Bojan Mihelac > is there a way to pass result of a template filter to some tag for > further processing? > > {% some_tag content|textile %} > > The best I came so far is something like: > > {% textile content as content2 %} > {% some_tag content2 %} > > With this textile, or any other f

Re: When to use admin, and when not to.

2009-05-26 Thread Sam Kuper
rough understanding of when it is appropriate to give users access to (parts of) the admin, and when it isn't. Many thanks, Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&qu

Re: When to use admin, and when not to.

2009-05-26 Thread Sam Kuper
ferent look and feel to that offered to the site's administrators. Does anyone else share my feelings? Is there a third way? E.g. subclassing the admin's functionality for front end users? Thanks, Sam --~--~-~--~~~---~--~~ You received this message be

Re: When to use admin, and when not to.

2009-05-26 Thread Sam Kuper
Thanks so much for the comprehensive reply! All best, Sam 2009/5/26 Sieker Adi Jörg > > On 26.05.2009, at 14:28, Sam Kuper wrote: > > > 2009/5/26 Sieker Adi Jörg > > In my humble opinion. As soon as you mention users, the admin is the > > wrong tool. > > con

Re: initial data for formset

2009-05-26 Thread Sam Chuparkoff
On Tue, 2009-05-26 at 17:27 -0700, adrian wrote: > This code creates a formset and populates fields with copies of > date and start_time. > The problem is, if num_events is X then it creates X forms but it only > populates X-1 (it leaves the last one uninitialized). My question > is why, and h

Re: URL conf question .....

2009-05-26 Thread Sam Chuparkoff
On May 26, 10:21 pm, tekion wrote: > But what if > you do not have a common prefix, would it still work?  Thanks. Sure, here is the reference: http://docs.djangoproject.com/en/dev/topics/http/urls/#multiple-view-prefixes sdc --~--~-~--~~~---~--~~ You received t

Re: When to use admin, and when not to.

2009-05-27 Thread Sam Kuper
ks for this take on the issue, Andy! I'm starting to feel consensus here... :) Sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

Re: form adding

2009-06-01 Thread Sam Chuparkoff
On Sun, 2009-05-31 at 23:45 -0700, samira wrote: > I exactly do like when I use Django 0.96. > for example this: > > Class AccountAdd(forms.Form): > accountNo = forms.IntegerField(min_value=1, required=True, > widget=forms.TextInput(attrs={'size':'10'})) > > def __init__(self, data=None,

Re: filtering the join table in a many-to-many relationship

2009-06-01 Thread Sam Chuparkoff
On Mon, 2009-06-01 at 16:01 -0700, Ben Adida wrote: > I have a ManyToMany self relationship with a custom join table (I > don't think the self-reference is important to the problem, but it > might be, so I'm mentioning it): > > class Documents > related_docs = models.ManyToManyField("self", > t

One to Many+foreign key Query: best way to build the optimal result

2009-06-17 Thread Sam Walters
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

Re: Development and deployment wit Git

2009-09-13 Thread Sam Lai
2009/9/14 mr.tinn : > fyi http://delicious.com/tag/git+tutorial > have fun Once you have read the tutorial, I started my repo on the server, then git cloned it locally. When I finish doing any work locally, I git push it back up to the server. The reason I started it on the server first was becau

Re: Windows compatible?

2009-09-23 Thread Sam Lai
2009/9/24 Tim : > > Is there a Windows version of Django? > Django doesn't care what operating system you run, as long as Python runs on it (and Python runs on most operating systems, including Windows, OSX and Linux). The instructions here should get you started - http://docs.djangoproject.com/

Re: The emergence of captcha after several incorrect logins

2009-09-25 Thread Sam Lai
Not much you can do apart from track IP addresses and enable recaptcha for it for a certain period of time. The client can manipulate everything else they send to you. Sure you'll end up annoying some innocent people, but because you're only enabling it for a limited period of time, it shouldn't

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Sam Lai
xshell.psc1" -command ". 'C:\path\to\the\script\newMailbox.ps1' " (The PSConsoleFile parameter is needed so PowerShell loads the Exchange cmdlets. Replace with the necessary parameters.) One concern is that depending on how long that script takes to work, the web re

Re: Creating Exchange 2007 Mailboxes via Django

2009-10-06 Thread Sam Lai
2009/10/7 StevenC : > > Thank you all for your feedback. > > Python is not going to be the best interface to use and i have chosen > to go with C#, something i want to learn and much more achievable. As for .NET, if you're used to something like Django or most PHP frameworks, you might want to ch

Re: efficiently deleting content based on how old it is

2009-10-11 Thread Sam Lai
2009/10/11 buttman : > > you could also do it this way: > > http://pythonblog300246943.blogspot.com/2009/09/cron-jobs-with-django-made-easy.html Is there really much point to this instead of just putting all that into a .py file and using cron to call the .py file instead? There doesn't seem to b

Re: Paging, 0-50, 51-100, 101-132

2009-10-11 Thread Sam Lai
2009/10/11 The Danny Bos : > > > I had a read of that, is good but seems overly basic for what I'm > trying to achieve. > > Basically a list of links like so on the Template: > > Link: Cards 0-50 > Link: Cards 51-100 > Link: Cards 101-132 > > Know what I mean? > My biggest question being, how can

Re: [django-tagging] machinetags with namespaces and values, a ready-to-use branch

2009-10-15 Thread Sam Lai
2009/10/15 Gregor Müllegger : > Hi django-users, > > in the last week i took a quick look over the django-tagging issue tracker and > found the interesting issue #14 "Support for machine tags". This seems to be > the oldest unclosed issue for django-tagging. This thrilled me so much that i > wante

help, insert into a foreign key produces unusual 'invalid keyword argument' error

2009-10-15 Thread Sam Walters
nt_id = models.IntegerField() name = models.CharField(max_length=120) class Meta: db_table = u'events_category' cheers ---sam --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Re: Django methodologies and best practices

2009-10-19 Thread Sam Lai
2009/10/20 Shakefu : > So ... I feel slightly guilty about asking this, because I might as > well be throwing napalm on the stove but which editors/IDEs/whatever > do people prefer for their Djangoing? Don't mean to rain on your parade, but this topic's been done to death, even recently - here'

Re: Remote developer opportunity

2009-11-02 Thread Sam Lai
2009/11/2 Chris Withers : > > It was probably a mistake. Google groups is pretty annoying in the way > it sets the Reply-To header to the list address... Isn't that a generally desired option though? The likelihood of me wanting to reply privately is much smaller than me wanting to reply to the e

Mod_wsgi from source + centos 4.8 compile issue

2009-11-05 Thread Sam Walters
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

Re: Django web flow

2009-11-08 Thread Sam Lai
2009/11/9 Lana : > > Hi! > > Does Django have some sort of web flow similar to the Spring web flow > in Java?  If it doesn't, what is the best strategy to implement web > flow in your opinion - by using only Django session framework or by > implementing database backened flow using only sessionId?

Re: admin templates issue

2009-12-04 Thread Sam Lai
2009/12/4 gentlestone : > I've tried to folow the tutorial and customize the admin template and > made a copy of 'change_form.html' template into the 'templates/admin' > directory in my project. I also set the > TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), > 'templates').replace('\\','/

Re: New to django, python, etc. - ForeignKey question

2009-12-05 Thread Sam Lai
The error is occurring here as you have mentioned - rolestartdate = models.DateField(default = \ Project.objects.get (pk=project.id).startdate) You're right that Django creates an attribute named id for every model without a primary key explicitly specified, but I s

Re: Parsing XML in the template? (New to Django and Python)

2009-12-05 Thread Sam Lai
it to the list videos_context. You could then access them in your template like this (assuming there's a name field in your Video model): {% for v in videos %} {{ v.video.name }} {% endfor %} The alternate way of doing this is to make a tag filter, see http://docs.djangoproject.com/en/dev/howto/custom-t

Re: Parsing XML in the template? (New to Django and Python)

2009-12-05 Thread Sam Lai
ngo docs link I gave should be easy enough. Feel free to post questions if you get stuck though. > Thanks again, I appreciate your help. > Matt > > On Dec 5, 10:07 pm, Sam Lai wrote: >> See inline. >> >> 2009/12/6 sleepjunk : >> >> > Hello :) I am wor

Re: Parsing XML in the template? (New to Django and Python)

2009-12-06 Thread Sam Lai
2009/12/7 sleepjunk : > Thanks so much for your help. I'm sorry to ask another question, but I > am getting an error and have spent a few hours trying to figure it > out. Googling has not helped me. > > Environment: > > Request Method: GET > Request URL: http://127.0.0.1:8000/ > Django Version: 1.1

Re: Performance monitoring

2009-12-09 Thread Sam Walters
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

Need help: customise a multi-key dictionary sort to put None objects at the end.

2009-12-16 Thread Sam Walters
before. Changed from: None A Aa Ab C D To: A Aa Ab C D None Any help would be appreciated so I can have a day off for christmas. -sam -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us..

Re: Need help: customise a multi-key dictionary sort to put None objects at the end.

2009-12-17 Thread Sam Walters
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: >> >&

Re: Working for a startup.

2010-04-22 Thread Sam Lai
On 22 April 2010 15:40, Joe Goldthwaite wrote: > I’d like examples of large systems written in Django or other open source > frameworks.  I’d also like stories about companies who tried .net switched > over to open source.  It seems like there was a big Microsoft project on > some stock exchange p

Re: Interesting Django or Python Issue

2010-04-28 Thread Sam Lai
Maybe database connections aren't closing properly? Don't know where to start looking though. A few weeks ago, I saw something similar (more Django and postgresql processes than usual, not doing anything special), but it hasn't happened since. Thinking about it, it happened when I was reindexing/u

Re: django with mod_wsgi on centos

2010-05-10 Thread Sam Walters
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,

Re: how to display an image inside Django

2010-05-12 Thread Sam Walters
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,

Re: css files are not loading properly for admin screens

2010-05-19 Thread Sam Lai
Your Django instance isn't set up properly to serve media. Have you configured your web server (Apache, nginx, Cherokee etc.) to serve media? If so, what URLs are they mapped to? You need to set that into the MEDIA_URL variable, e.g. /media/. What you have now doesn't look right. MEDIA_ROOT tells

Re: IronPython AssertionError

2010-05-24 Thread Sam Lai
Inline. On 21 May 2010 15:46, Russell Keith-Magee wrote: > On Fri, May 21, 2010 at 1:47 AM, Joe D wrote: >> Has anyone had any luck running Django on IronPython ? > > Testing under IronPython hasn't been part of our regular testing > regimen, so I can't comment on the level of compatibility. > >

Re: Google maps like app for Django for small area?

2010-06-02 Thread Sam Walters
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

Re: Django external access [Windows]

2010-06-05 Thread Sam Lai
By default, the Django development server does not allow hosts to connect unless it is localhost (127.0.0.1) or a local IP (192.168.1.101 in your case). Doing this is a *bad idea*, as indicated by the docs - http://docs.djangoproject.com/en/1.2/ref/django-admin/#djadmin-runserver If you really do

Re: Django external access [Windows]

2010-06-05 Thread Sam Lai
Oops. Seems like you've tried that already. Have you checked your Windows firewall settings? On 6 June 2010 13:53, Sam Lai wrote: > By default, the Django development server does not allow hosts to > connect unless it is localhost (127.0.0.1) or a local IP > (192.168.1.10

Re: Django external access [Windows]

2010-06-05 Thread Sam Lai
w people (including > myself) will learn about this project. They will only see the > interfaces at certain stages when I give out notifications. > I am sure in Linux there isn't any problem with overriding the > restriction. > It's so weird with XP. > > Hahaha > >

Re: design question - forms as meta-data to a model

2010-06-06 Thread Sam Lai
In the SQL world, you would probably store each form field value for each submission as a row (or the entire form submission in a single field, serialized to some known form; some DBs natively have an XML field which might be useful). In the noSQL world, however, this kind of situation is easier (

Re: error about django and mssql

2010-06-08 Thread Sam Lai
If you provide the entire error message, it might help. The excerpt you provided looks like it wasn't copied properly from the console - it is missing characters from the start of each line. 2010/6/8 CCC : > . > I use mssql not mysql > > On 6月8日, 下午3时57分, kanniga sivasubraman

Re: error about django and mssql

2010-06-08 Thread Sam Lai
. > and unluckly django can't connect the newset mssql2008 success... > > On 6月8日, 下午4时48分, Sam Lai wrote: >> If you provide the entire error message, it might help. >> >> The excerpt you provided looks like it wasn't copied properly from the >> con

Re: Error I continue to get

2010-06-10 Thread Sam Lai
That error message looks like Windows to me. try adding the word python at the start of that command. If you are indeed on Windows, how did you install Python? The easiest one I've used is the ActiveState's ActivePython distribution for Windows; sets everything up properly, including proper file e

Re: error : python manage.py shell

2010-06-11 Thread Sam Lai
Check your indentation of that particular line, and all of the lines above. In Python, indentation matters, and it all needs to line up accordingly. We can't really help anymore without you showing us more code, which is difficult due to the way email messes with leading spaces. You can try postin

Re: Error I continue to get

2010-06-19 Thread Sam Lai
3:40 pm, Kenneth Gonsalves wrote: >> On Friday 11 June 2010 12:05:50 Sam Lai wrote: >> >> > Thaterrormessage looks like Windows to me. try adding the word >> > python at the start of that command. >> >> yes, it did not look like a linuxerrormessage - alth

Re: A Django project life cycle

2010-06-20 Thread Sam Lai
The onion model on the Django middleware documentation page might also help - http://docs.djangoproject.com/en/dev/topics/http/middleware/ The rest of it (how it is handled from the WSGI handler etc.) is really an internal matter. Unless you want to contribute to Django or create some custom vers

Re: A Django project life cycle

2010-06-20 Thread Sam Lai
I can't really help you because I don't know the internal life cycle either. I'd just start with reading through the code, which isn't really that hard (and it is what I've been doing for my custom admin form behaviour). If you have specific questions, you could post it here (or if it looks like y

Re: A Django project life cycle

2010-06-20 Thread Sam Lai
If you want to run a piece of code on receiving a view HTTP request, and a piece of code just before the response is sent to the user, look into Django middleware (http://docs.djangoproject.com/en/dev/topics/http/middleware/). That is what it is specifically designed to do. If instead you want to

Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 17:04, Kenneth Gonsalves wrote: > On Monday 21 June 2010 12:24:58 Torsten Bronger wrote: >> > Also, is this recommended practice, to use "www-data" as the >> > backend database username? >> >> No, not recommended, but not forbidden either. >> > > should be forbidden - one does not

Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 19:47, Kenneth Gonsalves wrote: > On Monday 21 June 2010 13:39:42 Sam Lai wrote: >> > should be forbidden - one does not want apache to have direct access to >> > the database >> >> Storing a password in plaintext file makes me uneasy, even though

Re: PostgreSQL backend - Ident authentication failed?

2010-06-21 Thread Sam Lai
On 21 June 2010 20:16, Kenneth Gonsalves wrote: > On Monday 21 June 2010 15:37:50 Sam Lai wrote: >> >> You do bring up a interesting point though, and I don't know much >> >> about the architecture of Apache and how holes are exploited when they >> >&

Re: Newbie Question about django-admin.py startproject

2010-06-22 Thread Sam Lai
'import django' is a command for the Python interpreter. 'django-admin.py startproject testsite' is a standard shell command. Just open up a console window, and type the latter into it. If it doesn't work, it means your PATH variable doesn't contain the Django sources. On 23 June 2010 15:27, Jac

Re: Parameters

2010-06-30 Thread Sam Lai
You need to serialize those variables and deliver them to the client to store as a cookie. That way, when a call to draw_graph is made, it will receive the cookie as part of the request, and you can get the parameters. If there is too much data, you should write those variables to the database, an

Re: cleaning html with bleach

2010-06-30 Thread Sam Lai
Nice find - I did pretty much the same thing, but using lxml.Cleaner. This seems more configurable; I'm probably going to change mine over to this instead. Generally the rule with script injection is to scrub and filter on output, because that's the last line of defense. However, for situations li

Nginx-fcgi setup guidance needed to render certain views with HTTPS.

2010-07-01 Thread Sam Walters
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

Re: Nginx-fcgi setup guidance needed to render certain views with HTTPS.[solved]

2010-07-19 Thread Sam Walters
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

Re: overriding model.save()

2010-08-05 Thread Sam Lai
On 5 August 2010 03:05, Sells, Fred wrote: > I would like to prevent saving a new value if the database contains a > specific value.  This is on a per field, per record basis. > > If I override the save() method; is there a way to find the existing (in > the DB) values and the new (to be stored) v

Re: Linkedin Search

2010-08-07 Thread Sam Lai
On 7 August 2010 22:53, kostia wrote: > I would like to know what search engines are used in web sites like > Facebook, Linkedin, Twitter and so on. > > Are they simplistic database queries or sophisticated search solutions? I'd say all three of those sites use custom search engines, possibly bui

Re: Django on Mac OS X

2010-08-08 Thread Sam Lai
2010/8/9 Daniel França : > I tried to reinstall everything... installing python+postgres from ports > and I get the Symbol not found: _PQbackendPID error again from psycopg. > I guess the best solution is run Ubuntu on a virtual machine or my project > will be stuck forever. > python+psycopg on mac

Re: do QuerySet joins still suck?

2010-08-10 Thread Sam Walters
addons for that: http://code.google.com/p/django-selectreverse/ Does a good job of avoiding the n+1 problem for most situations. Hope this helps cheers sam. On Wed, Aug 11, 2010 at 4:36 PM, Daniel Roseman wrote: > On Aug 11, 2:28 am, Phlip wrote: >> >  orders = Order.objects.filter

Re: mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread Sam Lai
On 14 August 2010 15:39, John Yeukhon Wong wrote: > I noticed that if I have two of them co-exist simultaneously > WSGIScriptAlias / "f:/public/testproject/apache/django.wsgi" > WSGIScriptAlias /testproject "f:/public/testproject/apache/hello.wsgi" > > I will get nothing but the same default blue

Re: mod_wsgi+Apache+Postregsql on Windows

2010-08-13 Thread Sam Lai
I haven't watched Graham's video, but here's what I typically do. On 14 August 2010 15:39, John Yeukhon Wong wrote: > I do plan to deploy the project on a UNIX server in the future, and I > still do want to follow up with the previous discussion: > > So in general, > > 1. When I write a django pr

Re: Django Setup

2010-08-17 Thread Sam Lai
On 18 August 2010 07:29, Marty wrote: > Runing on Windows 7 > First time user of Django and Python.  Got python installed at f: > \python27,  downloaded DJango tar file.  Used WInRAR to extract. > Copied all of DJANGO into Python27 You actually don't need to do that; setup.py automatically copies

Re: Migration: AlreadyRegistered

2010-08-17 Thread Sam Lai
It means somehow you're calling this line in an admin.py file twice - admin.site.register(Entity) Check the admin.py file for the app that contains the Entity model. On 18 August 2010 10:57, Christos Jonathan Hayward < christos.jonathan.hayw...@gmail.com> wrote: > I am trying to migrate from on

Re: Migration: AlreadyRegistered

2010-08-17 Thread Sam Lai
tos Jonathan Hayward < > christos.jonathan.hayw...@gmail.com> wrote: > >> Thank you; I'm not seeing how. My admin.py reads: >> >> import django.contrib.admin >> import directory.models >> import tagging >> >> django.contrib.admin.autodiscover() >> django.cont

Re: geodjango: windows installer for geos dependency?

2010-08-17 Thread Sam Lai
Quick Google tells me that PostGIS contains GEOS 3.2.0. I know you're not using PostgreSQL, but installing that might do the trick, or if you don't want to pollute your server, you can probably extract it from the setup somehow. http://postgis.refractions.net/download/windows/#windbinaries On 18

Re: duplicate post_save signals

2010-08-18 Thread Sam Lai
I was looking at this over the weekend as well; isn't a problem for me but it seems that the post_save signal is triggered even when commit=False. Therefore when the object is saved again with commit=True, it is fired again. I didn't really investigate this so I could be wrong, but might be someth

Re: What's the best way to custom the add page (in django admin site)

2010-08-24 Thread Sam Lai
On 23 August 2010 22:38, Yangmin Li wrote: > sorry for the previous incomplete message. > Here is what I want to ask, thanks in advanced. > I have a model called request, after registered in admin backend, user can > add new request object in admin pages. > I want to modify the request-add page to

Re: virtualenv and standalone scripts

2010-08-24 Thread Sam Lai
On 24 August 2010 06:54, Oivvio Polite wrote: > Following advice on this list I've moved to virtualenv+pip to manage my > django stack, which so far is working out nicely. > > But what should I do about standalone scripts? Say I have a project > called mysite. If I'm in a virtualenv and execute a

Help with Geodjango+Postgres to find a Point, variance in decimal places

2010-08-24 Thread Sam Walters
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

Re: method on the User model?

2010-08-24 Thread Sam Lai
You need to look at SQL aggregates. See here - http://docs.djangoproject.com/en/dev/topics/db/aggregation/ On 25 August 2010 14:44, Joel Klabo wrote: > I am trying to find a way to get a list of users ranked by the most > "drinks". The drink model has a User field so I am doing this to get > the

Re: windows7, django-admin.py, system variables, no module named django.core

2010-08-25 Thread Sam Lai
If you want to understand why you are getting the error, start by understanding Python modules - http://docs.python.org/tutorial/modules.html Hint - you can't just copy a script around and expect it to work. The script depends on other files to make it all happen. If in python, you type, import

<    1   2   3   4   5   6   >