I've done something similar for an e-commerce store. We maintiain the
number of times the product is viewed via search results as well as
the individual product page, as two separate numbers.
I update the fields in the managing views, e.g.:
product.page_view += 1
product.save()
or
for p in re
FWIW, I don't see a security issue with exposing a surrogate primary
key to the public...
If you're hung up on the issue, though, take Tom's advice and use a
slug for each house as an unique key. You might find the street
address of a house to be a good slug candidate...
On Apr 11, 6:28 pm, ydj
7;re deploying against lighttpd I would
guess the concepts are similar.
I guess you don't actually /need/ to serve up your static content via
Apache, the above urls.py entry will work fine under Apache. It's
more a matter of you /should/ (see the static_files link, they give a
bet
Your previous description sounds pretty close. Check your URLs in
your HTML (mentioned by Karen Tracey in this thread).
As a quick reference, here are the relevant entries in my settings.py:
import os
ROOT_DIR = os.path.normpath(os.path.dirname(__file__))
MEDIA_ROOT = os.path.join(ROOT_DIR, 'me
ssion and right before you push the variable into
the template, to see if it's making it through the redirect.
If it is, then the issue is with your template, if it's not then the
issue is with the session.
Doug Van Horn
http://maydigital.com/
On Apr 29, 12:04 am, Brandon Taylor
See http://www.djangoproject.com/documentation/newforms/#accessing-clean-data,
check the 'Note' section.
This was a problem in the old newforms where you couldn't have a field
called 'data' due to the clean_ functions clashing with the
clean_data dictionary.
Also see:
http://code.djangoproject.c
It looks like you have it there in your snippet, you just need to
define your 'selected_a' var. Maybe something like:
if 'a1' in kwargs:
selected_a = kwargs['a1']
Then set your b1 choices based on the group and optional a attribute.
On Apr 30, 4:58 pm, ydjango <[EMAIL PROTECTED]> wrote
you said, you can be as religious about this as you want, but at
the end of the day, getting something functional to the user is all
that really matters (many of them don't even look at the URLs).
doug.
On Jun 18, 10:31 pm, Vasiliy Gladkov <[EMAIL PROTECTED]> wrote:
> urls.py for my a
del. That's probably not what you're looking for, though.
Maybe someone else will post something more helpful. :-)
Doug Van Horn
http://www.maydigital.com/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
s', 'The
Eggs'))
class FoodForm(forms.Form):
food = forms.ChoiceField(choices=FOODS, label='Favorite Food')
Then just render the form field like you normally would:
{{ form.food }}
Check it for syntax, but I'm pre
;ll help.
You could also set up a new, simple project with just the one app to
see if you can replicate it. I couldn't.
Oh, I'm on the HEAD at v5005.
Doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Grou
done this before in PostgreSQL. I don't know how MySql would
handle something like this.
FWIW,
doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, se
I'm not a DBA by
trade, I'm a code monkey. Take the time to read up on the subject.
The Wikipedia pages are a good start. :-)
In my personal experience, I can not think of a database I've worked
with in my career that used natural keys (15 years experience, so you
can frame that sta
I use rimuhosting.com. I'm pretty sure they have a Data Center in
London, so that might be the right up your alley.
I'm in St. Louis, where Slicehost is located, but they have a
ridiculous waiting list. So I can't even try them out.
I've been happy with Rimu, though.
d
It's probably a little bit more advanced, and it's certainly not a
tutorial, but the Python Challenge (http://www.pythonchallenge.com/)
is a good way to get familiar with the language and its tools.
I think I made it through 17 or so when I was first learning Pyth
;t want to dump all that in the page at once. In that case I would
use javascript and an XMLHttpRequest to pull the filtered names from
the server, avoiding a page refresh.
Either way, I don't think I'd add a new form field. If I did, I'm not
sure it would be a Django addition.
Have you considered OpenID? I'm no expert but it might provide you
with the authentication you're looking for, without having to collect
passwords.
doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Group
On Oct 15, 10:01 am, Rytis Sileika <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I was just wondering, what are the best practices to setup/manage
> django projects?
[snip]
> Thanks!
>
> Rytis
To expand on Chris' answer, here's what I would recommend:
Create your project in Subversion (or CVS, or what ha
'])
You could also hang code-friendly values off your Foo object so you
could do:
class Foo(Model):
foo_display = TYPE_KEYS['foo display']
Foo.objects.filter(type=Foo.foo_display)
I'd push for the more readable keys.
doug.
--~--~-~--~~~---~--~-
lso use an index if available, at least
in Postgres. E.g.,
select * from foo where type = 'F%'; --Uses 'type' index if available
See the following: http://www.postgresql.org/docs/8.2/static/indexes.html
Read that chapter if you're a little light on database e
directory from my
uploaded content, made available via a custom MEDIA_PREFIX setting
(inspired by ADMIN_MEDIA_PREFIX).
One last note, there's a link at the bottom of my post to Marty's
patch. Here it is if you'd rather just head t
"/mysite/secondview/?foo=%(foo)s&bar=%
(bar)s") % request
Or you could store the data in the user session. Or you could just do
your work in the first view. ;-)
doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the G
On Oct 17, 6:47 am, Mathieu Poussin <[EMAIL PROTECTED]> wrote:
> Hello ,
> i have a question,
> by default , django add a slash at the end of the url , like that
> :http://my/documents/hello->http://my/documents/hello/
>
> it's possible to add .html instead of that ? like that
> :http://my/docum
On Oct 17, 2:23 am, Manoj Govindan <[EMAIL PROTECTED]> wrote:
> How many here follow the django axiom of 'one project, multiple apps'?
> If you do, how do you control the sources? Do you map one project to
> one source code repository or do individual apps get their own
> repositories?
I've foun
On Oct 16, 11:19 pm, Greg <[EMAIL PROTECTED]> wrote:
> Michael,
> Yea I'm already using stringformat in my template. However, in my
> view code is where I create the order. When the order is added in the
> view and I then look at it in the admin the price is displayed as 74.0
> instead of 74.00.
On Oct 17, 9:44 am, Greg <[EMAIL PROTECTED]> wrote:
> Doug,
> Thanks for the reply. It's weird, because in my admin when I show the
> amount in my list_display (list_display = ('b_name', 'thirdtime',
> 'amount', 'customer',
it with many apps, but for my projects and the
way I was working them, I didn't see the advantage.
Go with multiple apps and see how it works for you. Just write lots
of tests so you can refactor later without fear.
doug.
--~--~-~--~~~---~--~~
You receive
ent"."event_from_date") = 1) ORDER BY
"app_event"."event_from_date" ASC, "app_event"."title" ASC',
'time': '0.001'},
{'sql': u'SELECT
"app_event"."id","app_event"."event_f
On Dec 5, 5:31 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> I'm running into a funny issue when testing with SQLite3 (Python 2.5).
>
> I have a model with the following (simplified):
>
> class Event(models.Model):
> event_title = models.CharField()
> ev
On Dec 5, 8:29 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> On Dec 5, 5:31 pm, Doug Van Horn <[EMAIL PROTECTED]> wrote:
> [snip snip snip]
I opened:
http://code.djangoproject.com/ticket/6141
and added some patches. Hopefully it'll get looked
nvironment'. However, I've read posts
here before of people claiming to /never/ use postgres schemas. I
interpret that to mean that having multiple databases in a cluster does
not cost much...
Remember, if you have an opinion you'd like to sha
Nevermind. I found Ticket #3089
[http://code.djangoproject.com/ticket/3089] after a little Google-ing.
I'll be interested in seeing what that one is all about.
Meanwhile, I'll continue to repeat to myself: "Google is my friend."
Thanks.
--~--~-~--~~~---~--~~
it or has some
pointers on what I could do to shed some light on the problem. Thanks
for your help...
Doug Van Horn
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to thi
David Abrahams wrote:
...One problem is that the name of the Django
project folder (and thus root module) always seems to creep into the
code in the app-specific directories.
IANADE (django-expert), but from what I've gleaned you can put the path
of each individual application into the python
uest
Handle your base case, where there is no 'last_request' (and thus no
last_seen), and you should be good.
Hope that helps.
And remember the advice listed by an earlier post-er. Design your
algorithm on paper. Think it through. Write some psuedo code. Run
some mental
+ hour old last_request. Next, I
should update the 'last_request' variable to now."
Please apply a liberal amount of sodium chloride to this as I haven't
done this in the past and I certainly haven't coded and tested it.
But, from the psuedo-code ab
On Jan 31, 4:51 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> How would you go about using seperate subdomains for certain apps in a
> project? What I would like to do is something like this:
>
> urlpatterns = patterns('',
> (r'^weblog\.[a-z0-9-]+\.[a-z0-9-]{3}',
> include('mysite.blog.
For what it's worth, I have a similar concept in storing the contents
of a shopping cart. I created a 'ShoppingCart' object which can hold
items and their quantities, plus it adds some convenience methods like
getting the list of items, the total cost, etc. I store this object in
the user's sess
nto SQL mode
and doing my own thing? Are there plans to provide & and | operators
on QuerySet objects? It seems like that'd be a pretty big undertaking,
but pretty frickin sweet if done well :-D.
Anyway, just asking. Thanks!
doug.
--~--~-~--~~~---~--~~
Yo
I wish I could edit my post. I see that & and | do work. I posted to
early.
I think you can pretty much disregard my post. I'm probably going to
have to get clever in joining up my data for 'relevence'.
Sorry for the disturbance. I'll be sure to google better next time.
--~--~-~--~
Thanks! I ended up seeing that after my original post. I knew I was
missing something.
Unfortunately that behavior does exactly what you would expect, one
query, yielding mixed results. In other words, if I search for 'zo' my
results would be ordered ['Bozo', 'Zorro']. I'd like for the result
I posted this here to:
http://www.djangoproject.com/documentation/db_api/
It seems that when you pass a Q() object into .filter() or .exclude(),
you end up with the same results. That is, the context of the method,
filter or exclude, is ignored when it receives a Q object.
For example:
In [1]:
I'm not sure if this has been discussed. My searches yielded no fruit.
I have page components that are common across many of my pages. Here
are a few of them:
== A user specific menu, cached in the session.
== A shopping cart, cached in the session.
== A list of recently visited items, c
I'm no expert either, but this seems to work for me:
fp = StringIO()
myImage.save(fp, 'jpeg') # or whatever format
self.save_thumbnail_file(myName, fp.getvalue())
Nice thread. I was just fixin' to get to this for my dem
I've been kicking around Django for a few months now and the one thing
I've been trying to figure out is how to unit test my code. I
understand how to go about testing the models (non-django provided
functionality) and any other 'domain' objects I may have, but I'm
struggling with how to test the
orking with Django, I'd
appreciate it!
FYI, I've toyed with SPE, but I'm finding my expertise with Eclipse
makes me more productive with PyDev.
doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
&
For the record, I'm using IDE rather loosely. I'm certainly not
looking for a VB-esque tool. At one point I was slinging Java in Emacs
with JDE. Now I find Eclipse extremely useful. It pretty much stays
out of the way. I get me editors with autocomplete, Ant deploys, and
external run targets
kind of thinking/approach
makes sense in the Django framework? Is it 'pythonic', as they say?
It seems somewhat OO to me, and I like encapsulating the behavior
inside a class. I guess I'm just looking for some seasoned expert
opinions. Well, any opinions really.
Thanks!
doug.
--~
yntax change to one application
can ripple through the other 9. Java contamination or no, that's not
good code.
Not to belabor the point, but I think the concern has merit.
doug.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
he model
holding the URLs would be that an application's URLs are not always
oriented around one particular model. So you're not really covered in,
say, a wizard workflow.
Anyway, back to slinging Java for another 8 hours. w00t!
doug.
--~--~-~--~~~---~--~---
I'm going to type out loud for a little bit. I'm hoping to better
define the problem so we can think about solutions more clearly (or go
find ones as solved by other frameworks).
Django has the concept of an application, a reusable chunk of
functionality which can be reused in many different pro
> I hate to say it, but Routes and most of the other schemes presented
> _do_ feel over-engineered. The current URL patterns system is fast
> and clean.
I actually agree 100%. And my earlier post indeed smacks of
overengineering. And in my current smallish project I don't intend to
do any of t
amples
they are at:
http://showmedo.com/videotutorials/django
I tried JAVA web development before Django
I find Django much more intuitive easier to code in
Both JAVA and Django are for perfectionists,
only Django is for perfectionists with time deadlines :-)
good luck with the transition
Doug
On 7
301 - 353 of 353 matches
Mail list logo