There's even a shortcut for that!
http://www.djangoproject.com/documentation/models/get_or_create/
On Jun 21, 4:03 am, soniiic wrote:
> if you'd like to create a book you could have also tried:
>
> def getBook(request, bookID):
> try:
> book = Books.objects.get(id=bookID)
> catch Book.DoesN
On Sep 27, 7:09 am, Steve Holden <[EMAIL PROTECTED]> wrote:
> > I couldn't get that to work, but the following did:
>
> > (r'^contact/$', login_required(ContactFormWizard([ContactFormPartOne,
> > ContactFormPartTwo])))
>
> > But it complained it couldn't find the __name__ attribute, so I ad
On Sep 27, 3:23 am, Donn <[EMAIL PROTECTED]> wrote:
> The thing about them is I see a lot of db hits happening. Each letter (or two)
> pulls another query on the back end. Ouch. ( I think)
It depends. In the most basic model, yes, but if the underlying data
isn't changing rapidly, you can set up
an I get the context processor to see the URL parameters?
-Aaron
On Sep 24, 12:47 pm, Rajesh Dhawan <[EMAIL PROTECTED]> wrote:
> On Sep 24, 11:41 am, Beals <[EMAIL PROTECTED]> wrote:
>
>
>
> > I've started to use the FormPreview app in contrib, which has mostly
>
I've started to use the FormPreview app in contrib, which has mostly
worked out well (though it's a little strange to me to move all my
logic into the form, rather than the view). My only issue now is with
the context.
Some background:
1) Most of my URLs are backed by views, and I have context p
ced this is taking
place).
-Aaron
On May 8, 7:03 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Thu, May 8, 2008 at 3:51 PM, Beals <[EMAIL PROTECTED]> wrote:
> > Correction: request.FILES does exist -- it just wasn't getting printed
> > out with "
newforms way of
handling uploads, and therefore is checking for request.FILES and
writing the file out ourselves passé?
On May 8, 3:43 pm, Beals <[EMAIL PROTECTED]> wrote:
> A while back, I looked for code snippets for uploading files. Almost
> every site I found contained something
A while back, I looked for code snippets for uploading files. Almost
every site I found contained something like the following:
if 'file' in request.FILES:
file = request.FILES['file']
filename = file['filename']
fd = open('%s/%s' % (MEDIA_ROOT, filename), 'wb')
fd.write(file['co
8 matches
Mail list logo