Re: Saving a ModelForm for the current user?

2010-04-18 Thread David Lindquist
return render_to_response(...) On Apr 18, 7:52 am, David Lindquist wrote: > Thanks Georg. I will give that a try. > > On Apr 18, 7:45 am, "ge...@aquarianhouse.com" > > > > > > wrote: > > ok now i got it :) > > > i would do this: &

Re: Saving a ModelForm for the current user?

2010-04-18 Thread David Lindquist
=False) > m.user = request.user > m.save() > > something like this :) > > On Apr 18, 4:32 pm, David Lindquist wrote: > > > > > > > Thanks for the reply. > > > The problem I have with that solution is that it occurs after form > > validation take

Re: Saving a ModelForm for the current user?

2010-04-18 Thread David Lindquist
another way to accomplish this? On Apr 18, 3:14 am, "ge...@aquarianhouse.com" wrote: > use commit=False > > m = form.save(commit=False) > m.user = request.user > m.save() > > On Apr 18, 6:06 am, David Lindquist wrote: > > > > > > > Greetings, > &

Saving a ModelForm for the current user?

2010-04-17 Thread David Lindquist
Greetings, I am trying to solve what seems like an easy problem, but the solution eludes me even after many Google searches. I have a simple model: class Site(models.Model): user = models.ForeignKey(User) url = models.URLField() class Meta: unique_together = (('user', 'url')

Re: Bug in manage.py?

2009-07-13 Thread David Lindquist
D'oh! OK, I am an idiot. I did not create the app with `manage.py startapp`. I simply created the directory on the command line. Django does in fact complain. Guess I got what I deserved ;) On Jul 13, 4:01 pm, David Lindquist wrote: > Hi Everyone, > > I discovered by accident th

Bug in manage.py?

2009-07-13 Thread David Lindquist
Hi Everyone, I discovered by accident that if you have an app with the same name as the project, then `python manage.py shell` (and similar commands) cannot import the settings file. I assume this is due to how Django updates sys.path. I would expect Django update sys.path to look in the project

Re: Odd ORM behavior

2009-03-26 Thread David Lindquist
Thanks Karen! I knew it had to be something newb-ish I was doing. :) On Mar 26, 2009, at 10:04 AM, Karen Tracey wrote: > On Thu, Mar 26, 2009 at 12:53 PM, David Lindquist > wrote: > > I am noticing some odd SQL being generated for certain queries. For > example, if I type the f

Odd ORM behavior

2009-03-26 Thread David Lindquist
I am noticing some odd SQL being generated for certain queries. For example, if I type the following in the shell: >>> TroubleCode.objects.all()[:5] and then I look at the db queries: >>> from django.db import connection >>> connection.queries I get the desired query, plus 5 extra queries

Re: will dmigrations be merged into django codebase?

2009-03-25 Thread David Lindquist
On Mar 25, 2009, at 4:54 PM, Russell Keith-Magee wrote: > > On Thu, Mar 26, 2009 at 8:42 AM, Joshua Partogi > wrote: >> >> Is there any chance dmigrations >> (http://code.google.com/p/dmigrations/) will be merged into django >> codebase? Because it removes the pain for db migrations :-D > > d

Re: OT: svn and '$Id$'

2009-03-24 Thread David Lindquist
On Mar 24, 2009, at 10:09 AM, Alan wrote: > Hi there, > > It's a bit off topic but I guess appropriate anyway. > > So I want to use '$Id$' in my *.py files where '$Id$' got replaced > when I commit my files via svn. > > But I googled and I still couldn't make it work. Can somebody tell > to m

Re: OT: svn and '$Id$'

2009-03-24 Thread David Lindquist
On Mar 24, 2009, at 10:09 AM, Alan wrote: > Hi there, > > It's a bit off topic but I guess appropriate anyway. > > So I want to use '$Id$' in my *.py files where '$Id$' got replaced > when I commit my files via svn. > > But I googled and I still couldn't make it work. Can somebody tell > to m

sites framework with multiple machines

2009-01-27 Thread David Lindquist
I have a client that maintains several hundred small web sites running on dozens of different machines all over the world. These sites have common data (footers, privacy policy pages, etc.) he would like to manage through a single CMS. Currently, he uploads all the changes manually using F

list all context variables?

2009-01-14 Thread David Lindquist
Is there an easy way to see a list of all the context variables and their values available in a given template? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send emai

Re: Where are all the Django jobs?

2009-01-12 Thread David Lindquist
n who > influences what gets used in various situations. It's in those > situations that you'll get to grab your favorite tool: Django. > > Jon Loyens > Thinktiv, Inc. > > On Jan 11, 1:14 am, Malcolm Tredinnick > wrote: >> On Sat, 2009-01-10 at 15:38 -0700, D

Where are all the Django jobs?

2009-01-10 Thread David Lindquist
First, I understand that the world economy is in a slump, and that the job market as a whole has not fared well of late. But even before the recent downturn, I noticed that there are precious few jobs in Django development (yes, I know about DjangoGigs.com). A simple keyword search on popu

Re: Returning large files from a view

2009-01-07 Thread David Lindquist
On Jan 7, 2009, at 4:15 PM, bruno desthuilliers wrote: > > On 7 jan, 23:37, David Lindquist wrote: >> I would like to return a binary file from a view, and so far I have >> something like this: >> >> def my_file(request): >> file_data = open("/pat

Returning large files from a view

2009-01-07 Thread David Lindquist
I would like to return a binary file from a view, and so far I have something like this: def my_file(request): file_data = open("/path/to/file", "rb").read() response = HttpResponse(file_data, mimetype="application/ whatever") response['Content-Disposition'] = 'attachment; file

Re: order by field length?

2008-12-16 Thread David Lindquist
Perfect. Exactly what I needed. Thank you Russ On Dec 16, 5:22 pm, "Russell Keith-Magee" wrote: > On Wed, Dec 17, 2008 at 9:04 AM, David Lindquist > > wrote: > > > I encountered a scenario where I need to query the database for a > > list of names sor

order by field length?

2008-12-16 Thread David Lindquist
I encountered a scenario where I need to query the database for a list of names sorted by length. In SQL this is easy: SELECT name from distributors_distributor ORDER BY LENGTH(name) Instead of writing raw SQL in my view, I am doing this: names = [x['name'] for x in Distributor.objects.values

Re: No documentation link on admin interface.

2008-12-12 Thread David Lindquist
On Dec 12, 2008, at 5:05 PM, waltbrad wrote: > > I'm using 1.0 -- I keep reading that there is supposed to be one in > the upper right hand corner. I finally had to use Google images to > find an illustration. > > But I don't have that link displayed. I do have the "change > password / logout"

Re: Generate a simple news archive list?

2008-12-10 Thread David Lindquist
Perfect! I can't believe I overlooked that in the documentation. Thanks Brian On Dec 10, 2:15 pm, Brian Neal <[EMAIL PROTECTED]> wrote: > On Dec 10, 2:31 pm, David Lindquist <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > I am building a simple news

Generate a simple news archive list?

2008-12-10 Thread David Lindquist
Hello, I am building a simple news app for my employer's website. I am using Django's date-based generic views for the various pages. I want to have a sidebar listing the archive by year and month like this: 2008 - November - December 2009 - January with each item linking to its view (year, m