Re: Django Standalone Template

2011-10-30 Thread SmileyChris
Take a read through this section of the docs:
https://docs.djangoproject.com/en/1.3/ref/templates/api/#loading-templates

Specifically, those templates are found via the app_directories.Loader.
So you'd run loader.get_template('admin/base.html') to get that template. 
The reason that it's in a subdirectory is to avoid conflicts with other 
applications (since they may want to use their own 'base.html' template.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/koe1y5vye7kJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Regression in blocktrans tag parsing between 1.2 and 1.3

2011-10-27 Thread SmileyChris
I think this may be that the previous format worked but wasn't really 
supported.

The 1.2 documentation on the blocktrans 
tagsays:

> Designate and bind a counter value with the name count

[...] 

A more complex example:
> {% blocktrans with article.price as amount count i.length as years %}


Your "working in 1.3" example isn't correct -- the 'and' is superfluous (in 
fact, I'm surprised it worked).
Your "working in 1.2" example should only be binding a single value with 
count, as shown in the 1.2 documentation.

So it sounds like this is a case of things working which probably shouldn't 
have to begin with...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/sq_F6ruqfksJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: name conflicts in static files

2011-10-17 Thread SmileyChris
The first app in INSTALLED_APPS wins, just like how name conflicts with 
templates work.

You can use the following command to check what static file gets picked:
https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#findstatic

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/HGVsS40mVKsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Receiving [Django] ERROR via email even if DEBUG = True

2011-07-20 Thread SmileyChris
It certainly sounds like DEBUG isn't actually True.

To test, from a manage.py shell:
from django.conf import settings
assert settings.DEBUG

No error there?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/viU9aA1_eHgJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How to disable specific field validaton in form?

2011-07-20 Thread SmileyChris
Would it be acceptable to just not bind the form at all in the situation 
where you want to return the more complex form? Something like:

YourForm(initial=dict(request.POST.items()))

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/Z9FzXfAkSfcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: problem with BooleanField form

2011-07-20 Thread SmileyChris
It should definitely be {'share': True} if you've checked the box and 
submitted the form.

Have you ensured your checkbox inside the form tag you're submitting in 
HTML?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/SvpPbOOrypAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django-ttag -- an easier way to write template tags

2011-01-13 Thread SmileyChris
I'm looking for feedback on django-ttag.

Here are the docs: http://packages.python.org/django-ttag/index.html.
They aren't completely finished, but should be readable and understandable.

Read through the docs, or better still, take it for a spin then let me know 
what you think.
For the industrious types, feel free to fork 
https://github.com/lincolnloop/django-ttag and make improvements to the code 
or docs!

-- 
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 this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: model best practice

2011-01-13 Thread SmileyChris
Alternatively, you can just split your models module into a package 
containing multiple models. You'll just need to manually set the app_name on 
the Meta class of each app, since isn't automagically set for classes 
defined outside of the models module. 

-- 
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 this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Look up model instance by id

2010-07-14 Thread SmileyChris
You've also got a shortcut method for the common case of raising 404
if the object doesn't exist:
http://docs.djangoproject.com/en/dev/topics/http/shortcuts/#get-object-or-404

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Managing static content / basically handling images best practices

2010-07-14 Thread SmileyChris
This is kind of an aside to your question, but I think you'll find it
useful...

There are two types of static media that you'll want to have served
separately to your dynamic django application:

* project static media
* uploaded media

I like to keep these two separate. My preferred way to do this is to
use STATIC_ROOT/STATIC_URL for the project static media, retaining the
default MEDIA_* settings for uploaded media only.

When using the built-in development server, it is fine to use it to
serve your static media. When you shift to a full webservice stack,
for your static media you'll make your web service bypass the django
wsgi app or use a seperate web service altogether.

One final catch is when you need to develop a stand-alone apps which
needs to have its own media files.

A nice solution to serving all the your static media easily in the dev
server, and collating all your app's static media to a single location
is http://bitbucket.org/jezdez/django-staticfiles/src

On Jul 15, 2:33 am, reduxdj  wrote:
> I want to use ImageField for users to upload static content and I need
> a little advice from a some django pros on how to do this in a dev
> enviornment. I notice the disclaimer that django dev server should not
> used to serve static content, or it shouldn't be.  So...
>
> What's the best practice for this then?
> Right now, I love the simplicity of the django dev webserver, should i
> switch the devserver to nginx?
> Does that have the ability to know when i make a change to a python
> file without a server restart necessary?
> Is there anything else I should know.
>
> Thanks so much,
> Patrick

-- 
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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorl thumbnail: messed-up thumb file path

2009-12-06 Thread SmileyChris
upload_to should not have a trailing slash

On Dec 7, 5:16 am, omat  wrote:
> The model is as simple as can be:
>
> class Provider(models.Model):
>     name = models.CharField(max_length=100)
>     logo = models.ImageField(upload_to='logo/',
>                              blank=True, null=True)
>
> Thanks.
>
> --
> omat
>
> On Dec 6, 4:45 pm, Kenneth Gonsalves  wrote:
>
>
>
> > On Sunday 06 Dec 2009 4:27:47 pm omat wrote:
>
> > > Sorl thumbnail is creating invalid directories for thumbnails in my
> > > development environment (mac os x, django dev server).
>
> > do not blame Sorl thumbnail - please post that part of your model that shows
> > 'upload_to' setting.
> > --
> > regards
> > Kenneth Gonsalves
> > Senior Project Officer
> > NRC-FOSShttp://nrcfosshelpline.in/web/

--

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...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: remember me on this computer vs SESSION_EXPIRE_AT_BROWSER_CLOSE

2009-01-31 Thread SmileyChris

You're on the right track. As the docs state, you can then override
the site-wide setting:
http://docs.djangoproject.com/en/dev/topics/http/sessions/#browser-length-sessions-vs-persistent-sessions

Steve's comment about requiring a "huge session store" is not really
too much of an issue. It's your responsibility to keep the session
table clean:
http://docs.djangoproject.com/en/dev/topics/http/sessions/#clearing-the-session-table

On Feb 1, 9:29 am, felix  wrote:
> I'm trying to implement the standard option "remember me on this computer"
>
> which in practice means expire the session or not at the end of the session
>
> it looks like django's auth uses a sitewide setting
> SESSION_EXPIRE_AT_BROWSER_CLOSE
>
> does anybody know the best way to approach this ?   is it the
> SessionMiddleware that should be replaced ?
>
>      felix :    crucial-systems.com
--~--~-~--~~~---~--~~
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 this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Avoiding the ThreadLocals hack - anything new in NewForms-Admin?

2008-04-23 Thread SmileyChris

How about this:

Set your model's user field so editable=False
Sub-class ModelAdmin
Override its `save_add` method, setting form.data['user'] =
request.user then calling the super method
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multi-page search result

2008-01-27 Thread SmileyChris

Using the low-level cache [1] sounds like it'd work fine for you.

from django.core.cache import cache
key = 'complex-results-%s' % request.session.id
results = cache.get(key)
if results is None:
results = list(YourComplexQuery)
cache.set(key, results, 60*15)
# then just use pagination to get the page [2]

[1] http://www.djangoproject.com/documentation/cache/#the-low-level-cache-api
[2] http://www.djangoproject.com/documentation/models/pagination/
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SESSION_SAVE_EVERY_REQUEST creates new session?

2008-01-04 Thread SmileyChris



On Jan 5, 6:33 pm, Peter Rowell <[EMAIL PROTECTED]> wrote:
> > only save sessions which have been modified
>
> Actually, the code in the sessions/middleware is:
>  if modified or settings.SESSION_SAVE_EVERY_REQUEST:
> so the whole point is to save it whether it's modified or not.

This wasn't related to your issue, just wanted to put out something
I'd been chewing on.
Specifically, there's no point in saving a session if it's empty and
hasn't been modified.

>
> But then you mentioned:
>
> > perhaps a misconfigured COOKIE_PATH
>
> Does "not configured" count as misconfigured? :-)
> Sheesh, do I ever feel stoopid.

No, I was just wondering whether you had set some weird setting -- the
defaults work fine for most.

> I just checked the site cookies with WebDeveloper Toolbar and the
> sessionid Host looks perfectly valid:
>
> So, that doesn't seem to be a problem ... is it?
>
> So, I'm back to ... what's with all of the rapid session creation?

Well if it's creating the cookie fine, then I'm not really sure!
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: SESSION_SAVE_EVERY_REQUEST creates new session?

2008-01-04 Thread SmileyChris

Hi Peter,

I've been delving around in that code recently. The only thing I can
think of is that your cookies aren't getting received (perhaps a
misconfigured COOKIE_PATH or one of the other related settings?) so a
new session is getting created and sent each request.

As a side note, I've been thinking that the SAVE_EVERY_REQUEST method
could be optimized to only save sessions which have been modified or
are not empty. Not that it will fix your problem, just wanted to
mention it.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Django... False promises?

2008-01-04 Thread SmileyChris

On Jan 5, 4:09 am, "Marcelo Sanches" <[EMAIL PROTECTED]> wrote:
> I agree ! After trying to configure the django cache system  I notice that
> the online docs are wrong and the django book have the correct information
> about the order of  MIDDLEWARE_CLASSES.
>
> ONLINE DOCS YOU WILL FIND:
> ...
>
> DJANGO BOOK YOU WILL FIND THE CORRECT INFORMATION
> ...

Are you sure? I think that the online docs are actually correct here...
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: syncdb problem: ValueError: list.remove(x): x not in list

2008-01-01 Thread SmileyChris



On Jan 2, 2:06 pm, crybaby <[EMAIL PROTECTED]> wrote:
> I have commented out this from settings.py,
> #'django.contrib.contenttypes',
>
> and syncdb and fixtures are working.
>
> I am running python 2.4.3 on Fedora 6 and django svn revision # 6980.
>
> What impact commenting out contenttypes would have on django project?

Sounds like a bug. Please open a ticket with as much information as
possible:
http://code.djangoproject.com/timeline

(fill in the settings page [1] or register [2] to avoid the spam
filter)

[1] http://code.djangoproject.com/settings
[2] http://www.djangoproject.com/accounts/register/
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: using queryset and extra_context

2007-12-30 Thread SmileyChris

On Dec 30, 3:43 am, Florian Lindner <[EMAIL PROTECTED]> wrote:
> My problem is that I want to pass the info_dict to the generic view
> and the CommentForm as extra_context.
>
> How can I do this? I think I somehow mix up the dictionaries

Try this:

dict(info_dict, extra_context={'CommentForm':CommentForm})

--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Redirect base.html to index.html

2007-12-30 Thread SmileyChris



On Dec 31, 7:03 am, goober <[EMAIL PROTECTED]> wrote:
> The Apache server is setup to look forhttp://localhost. I created an
> index.html soft link pointing to the base.html file in the template
> directory. When I bring up the browser, I get a error message "Page
> not found" even though the index.html is pointing to base.html which
> has all the CSS and miscellaneous URL links.

I don't think you get how Django works. Template files are not served
directly based on the url requested.

>
> Do you have any suggestions on how to fix this simple problem?

Read http://www.djangoproject.com/documentation/url_dispatch/

But you should probably do the tutorial first...
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Is there a setting which will provide RequestContext to each view autmatically?

2007-12-16 Thread SmileyChris

from django.views.generic.simple import direct_to_template

view:
   return direct_to_template(request, 'template.htm', extra_context)

On top of that, use a context_processor (follow alex's link)
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Standard python objects in request.session possible?

2007-12-15 Thread SmileyChris

On Dec 16, 2:13 pm, itpaul <[EMAIL PROTECTED]> wrote:
> However, unlike the shell behaviour which lists and deletes messages,
> the template lists and retains the messages resulting in them
> displaying repeatedly on every page.

Most likely, the session isn't getting saved.
http://www.djangoproject.com/documentation/sessions/#when-sessions-are-saved

For the lazy:
request.session.modified = True

--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to make such query with django ORM?

2007-11-29 Thread SmileyChris

On Nov 28, 9:08 am, Eratothene <[EMAIL PROTECTED]> wrote:
> I need to get all blogs that belong to certain user and are empty (do
> not have any articles). I can't figure out how to make it with without
> extra() method.

Since you can't do aggregate methods in the ORM yet, you'll just have
to use extra and do a sub-select to count the articles linked to each.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Preferred Schema Evolution Tool

2007-11-27 Thread SmileyChris

On Nov 26, 1:03 pm, LorenDavie <[EMAIL PROTECTED]> wrote:
> Not sure if SmileyChris is this guy, but I've had good success with
> this project:
>
> http://www.aswmc.com/dbmigration/

As Mike H said, dbmigration is his project (my DBEvolution project did
some of the "automatically generated migrations" magic using
dbmigration as its base).

If you like how dbmigration works, you'll probably like Django
Evolution.

--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Understanding autoescape-aware filters

2007-11-17 Thread SmileyChris

On Nov 18, 6:49 am, Ivan Sagalaev <[EMAIL PROTECTED]> wrote:
> the docs are
> written in Linux how-to style: "make these magic passes and hope for the
> best and don't try to understand the thing since you never will". Could
> you please clarify why are those things needed and what exact effect
> they are intended to cause?
It's explained here:
http://www.djangoproject.com/documentation/templates_python/#filters-and-auto-escaping

Probably could be clearer, it's still an area that makes my head spin
for a few minutes when I read it.
--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Announcing Django Evolution!

2007-11-13 Thread SmileyChris

On Nov 13, 8:08 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> Announcing Django Evolution!
> 
>
> http://code.google.com/p/django-evolution/

Good job, Russ and Ben!

The project gets the smiley seal of approval :)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Variable available to All users (static class?)

2007-10-26 Thread SmileyChris

Sounds like you want something like threading.local
It's not my area of expertise, but you may be able to pick up some
hints on how to use it from 
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser

On Oct 27, 8:53 am, "William Battersea" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I'm probably describing this poorly because I've never done this and I come
> from a PHP background, but...
>
> Is there anyway that I can have some variable available to all the user
> sessions without resorting to a database.
>
> E.g. I suppose I want a variable 'busy'. If any user initiates a piece of
> code, it sets busy to 1, and when the process is over, it sets it to 0. If
> another user attempts to initiate the process while busy is 1, some other
> action is taken.
>
> I don't want to have to use a database to do this.
>
> And it might sound like a weird problem, but basically I have django
> triggering a physically process with a microcontroller (via serial
> communication).
>
> If I'm totally going about this the wrong way, please let me know.
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.10/1091 - Release Date: 10/24/2007
> 2:31 PM


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how to write regex to parse "http://127.0.0.1:8000/user/login/?next=/user/1/add/"

2007-10-26 Thread SmileyChris

On Oct 27, 3:36 am, Brightman <[EMAIL PROTECTED]> wrote:
> thank u.
> how can i get it in request.POST?

By changing your form to 


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: DateTimeField auto_now / auto_now_add and UTC

2007-10-24 Thread SmileyChris

> Is there a way to get the
> auto_now/auto_now_add feature of DateTimeField to use UTC?

Those methods suck and hopefully will be removed. Use a callable
default instead of auto_now_add (or overridden save instead of
auto_now, like Jarek gave):

from datetime import datetime
class YourModel(models.Model):
created = models.DateTimeField(default=datetime.utcnow)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: template variables

2007-10-13 Thread SmileyChris

On Oct 13, 8:35 pm, "Nikola Stjelja" <[EMAIL PROTECTED]> wrote:
> On 10/13/07, Goon <[EMAIL PROTECTED]> wrote:
> > fair enough, I'm not happy that I can't get {{for x in y[1:5]}}
>
> What's the problem. You just send the template 'y':range(1,6). It's very
> simple. I don't think the template system should be changed to do something
> that the programming part of the presentation should do.

Technically, that could be presentation logic. For the common case of
a iterating a set number of times, I wrote 
http://code.djangoproject.com/ticket/5172.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help setting up urls.py to handle predominantly static site

2007-10-13 Thread SmileyChris



On Oct 13, 4:09 pm, Jason <[EMAIL PROTECTED]> wrote:
> Hey everyone--
>
> I've got a predominantly static site that I need to serve through
> Django, at least until I can convert more of it over properly.  Yes, I
> know this is discouraged, but it's the only way I'm going to be able
> to move forward w/this project
>
> I cribbed this line:
>
> urlpatterns += patterns('django.views.generic.simple',
> (r'(?P.*)', 'direct_to_template'),
> )
>
> ...from here:  http://www.djangosnippets.org/snippets/346/
>
> ...and it works hunky-dory for most everything-- however, it doesn't
> catch assumed index pages (going tohttp://www.mysite.comgives a
> "template doesn't exist" error; going tohttp://www.mysite.com/index.html
> works fine)
>
> Further down that "snippets" page someone posted the following:
>
> *   (r'^(.*)/$', lambda request, path: direct_to_template(request,
> "%s/index.html" % (path,))),
> * (r'^(?P.*)$', direct_to_template),
>
> ...but I've had no luck w/either of those.
>
> Anyone had any experience w/this?

Hi Jason,

Can't say I've had experience with this directly, but here's my
suggestions:

First, you'll need to set APPEND_SLASH=False in your settings

Next, the trick is that you can pass an iterable of templates to try
rather than a single template, something like:

from os.path import join
from django.templates.generic.simple import direct_to_template
def serve(request, path):
paths = (join(path, 'index.html'), path)
return direct_to_template(request, paths)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MEDIA_URL and the trailing slash (and a broken pipe or two)

2007-09-21 Thread SmileyChris

I don't see how it would break on your production server as long as
you have a trailing slash in the server's media_url too.

On Sep 21, 5:05 pm, Dave Lowe <[EMAIL PROTECTED]> wrote:
> I agree by the way, MEDIA_URL should always have a trailing slash.
> Does anyone know why the documentation says not to include a trailing
> slash on a domain? Why not have "http://media.example.com/;?

I've suggested it in the django-dev group.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: MEDIA_URL and the trailing slash (and a broken pipe or two)

2007-09-20 Thread SmileyChris

On Sep 20, 5:53 pm, Dave Lowe <[EMAIL PROTECTED]> wrote:
> I have the feeling I'm missing something. What does everyone else do
> to get around this?

Uh, so remove the slash in your template.
href="{{ MEDIA_URL }}css/master.css"

Side note - IMO, MEDIA_URL should *always* have a trailing slash.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: web site

2007-09-02 Thread SmileyChris



On Sep 3, 5:12 am, "Alfredo Alessandrini" <[EMAIL PROTECTED]>
wrote:
> I'm a newby..:-)
>
> Is Django good for make a web site like this?
>
> These are a web site for playing correspondence chess.
>
> The moves are stored with a database, with information about the players,
> tournament, rating, ecc..

One of our regulars (and our IRC full time helpdesk), Collin Grady is
involved in developing http://www.chesspark.com/ which is Django based.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: truncating posts with markdown

2007-09-02 Thread SmileyChris

On Sep 3, 9:34 am, "Evan H. Carmi" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I ran across a problem today with the list view of my blog. I am using
> markdown to create html tags for my post. In the list view I use the
> template tag truncate to cut off the number of words. This leaves open
> the html tags that markdown created.
>
> I am wondering what ways people get around this?

Use the truncate_html filter ;)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: count() causes QuerySet re-evaluation?

2007-08-30 Thread SmileyChris



On Aug 30, 8:19 pm, Bjorn Ruud <[EMAIL PROTECTED]> wrote:
> > > On 8/29/07, Bjorn Ruud <[EMAIL PROTECTED]> wrote:
>
> > > The pool QuerySet gets re-evaluated when the count() in the loop is
> > > run. Since one of the fields in the filter gets changed, the amount of
> > > objects in the QuerySet will be different. If pool.count() is replaced
> > > with len(pool) this does not happen. Is this intended behaviour? Can a
> > > QuerySet be made immutable?
> > On Aug 29, 3:03 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote:
>
> > This behaviour is by design.
>
> > queryset.count() actually constructs (and executes) a new 'SELECT
> > COUNT(*) FROM table' query. This means that it will always return the
> > current number of objects matching the query. In your case, the number
> > of objects is changing, so count() will return a different value each
> > time.
>
> > len(queryset) returns the length of the evaluated queryset. When the
> > queryset is evaluated for the first time, it will act as a cache, so
> > all calls to len(queryset) will return the same value.
>
> Ah, I misunderstood how the caching mechanism works. I thought that
> after the initial evaluation the QuerySet was static no matter what
> operation was performed since only the cache was being used.

Technically you are correct - the problem is you didn't evaluate the
QuerySet. If you had, say by using len(pool) the first time, then your
future pool.count()s wouldn't use a query.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Max. size of User.email is 75 chars

2007-08-29 Thread SmileyChris

On Aug 30, 4:28 am, "Peter Melvyn" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've a question, why max. size of User.email field is set to 75 characters,
> if RFC 2821 limits local part to 64 characters and domain to 255.
> With '@' it is together 320 chars.
>
> Should not be this field extended?

I reckon it's a bug that the max_length can't at least be overridden.

Bring this up in the django-dev group.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: direct_to_template and extra_content

2007-08-08 Thread SmileyChris

Your stepping out of what the simple view was there to provide. It's
not difficult to make your own views, you know. :)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Single-line comment doesn't seem to work

2007-08-07 Thread SmileyChris

On Aug 8, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> The templates are html...so to comment you would use 

The templates are rendered by Django, so {##} should work. I just
tested it and it's working fine for me...

>>> from django.template import Template, Context
>>> content = ''' Test single line and multi-lines comments

Test1
hello {# This should be commented out #} hello
{{ link|escape }}

{% comment %}
The following two lines should be commented out
Test2
{{ link|urlencode }}
{% endcomment %}

Test3
{{ html|escape }} '''
>>> print Template(content).render(Context())
 Test single line and multi-lines comments

Test1
hello  hello




Test3


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: '_QuerySet' problem

2007-08-05 Thread SmileyChris

On Aug 6, 1:15 pm, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> On 05-Aug-07, at 6:19 PM, Marco A. wrote:
>
> > >>> p.user
>
> p.User

Umm, this is just as wrong.

Doug's answer summed it up pretty well.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deleting an item out of my dictionary?

2007-07-21 Thread SmileyChris

On Jul 22, 5:09 am, Greg <[EMAIL PROTECTED]> wrote:
> It's just weird how that line 'del
> request.session['cart'][0]' works fine in the showcart function but
> doesn't work right in the deletecart function.

It sounds like that the session just isn't getting saved. See
http://www.djangoproject.com/documentation/sessions/#when-sessions-are-saved
I'd suggest adding the following to your deletecart view:
request.session.modified = True


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How to use request.GET??

2007-07-18 Thread SmileyChris

On Jul 19, 2:22 pm, Greg <[EMAIL PROTECTED]> wrote:
> I was wondering how do I send a 'favorite_color' GET parameter?  Do I
> have to use a form to do this that sends data by GET or is there
> another way to do it?

http://example.com/url_to_set_colour_view/?favorite_color=Blue


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Update Admin Screen view

2007-07-08 Thread SmileyChris



On Jul 9, 12:19 pm, Rod <[EMAIL PROTECTED]> wrote:
> 1) I can view the Admin screen but I am still unable to view the poll
> app.
>
>  I've added a new class (see below) to mysite/polls/models.py but
> the Admin screen remains unchanged.
>
> class Poll(models.Model):
> # ...
> class Admin:
> pass

That's the correct way to do it. Try restarting the development
server? Usually it handles rebuilding it automatically but sometimes
if you have saved a model with an error in it, it drops that model
until you restart the server.

>
> 2 ) While in the Shell if type "Poll.objects.a() " I get the result
> [, ]
>
> Why am I getting 2 poll objects and what command can I use to
> delete one.

Read the api documentation. But basically:

polls = Poll.objects.all()
poll = polls[0]
poll.delete()


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How can I achieve this intersection ?

2007-07-08 Thread SmileyChris

On Jul 9, 5:17 am, queezy <[EMAIL PROTECTED]> wrote:
> I would like to do this in Django, using two lists that are QuerySet lists:
>
>   mylist=mylistWHOM.intersection(mylistWHAT)
>
> When I do it in the Pythonic way above, the django parser complains with:
> 'QuerySet' object has no attribute 'intersection'

Of course it complains, QuerySets (or lists) don't have a function
called intersection. You can't just make up a name and expect it to do
what you want.
mylistWHOM.invite_them_to_my_party() won't work either.

try something like:

whom = set(mylistWHOM)
what = set(mylistWHAT)
mylist = whom & what  # or whom.intersection(what), same thing.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Random string template tag

2007-07-05 Thread SmileyChris

Or you could do {{ "class1,class2,class3,class4"|split:","|random }}

(you'd need to make the |split filter too, Django only comes with |
join)

On Jul 4, 3:21 pm, Bryan Veloso <[EMAIL PROTECTED]> wrote:
> > If you want to hardcode the availability of the 'classes' variable in
> > every context (so you don't have to remember to define it every time),
> > you could write a context processor. See
> > django.core.context_processors for examples.
>
> That's probably what I'll need since it'll always have to be there.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: An idea on DB migration

2007-07-05 Thread SmileyChris

If you haven't already, check out http://www.aswmc.com/dbmigration/

It's quite a good solution for migration.
I've been writing a wrapper on top of that to handle auto-migration,
which I'm mostly happy with. Just have to tie some loose ends and I'll
put it up somewhere to share.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: how I can get the proper get_absolute_url?

2007-06-29 Thread SmileyChris

I'm guessing your model defines a foreign key to User. Use that
instead of User.username (so, for example, self.user.username).


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: CachedDnsName - very slow under apache/mod_python ...

2007-06-25 Thread SmileyChris

I'm not sure. Each Apache instance may have to populate this, so it
could be noticed several times.

Keep investigating!

Thinking more about it, perhaps CachedDnsName should only lazily
loaded if settings.DEBUG==True. It's not really fair to expect an end
user to have to wait for this timeout just because they are the first
one to trigger a mail to be sent.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Development / Production Setup

2007-06-22 Thread SmileyChris

> I'm obviously missing something basic. I'm 99% sure I should be able
> to say something like:
>
>  media="screen" />

Assuming you have SVN...

Make sure you have this enabled in your TEMPLATE_CONTEXT_PROCESSORS
(it is by default):
http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-media

Use RequestContext (generic views do automatically). It's made easy
with http://www.djangosnippets.org/snippets/3/

In your template, you'll have the {{ MEDIA_URL }} context variable
ready for your enjoyment (which will equal settings.MEDIA_URL)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: FastCGI Shared host

2007-06-18 Thread SmileyChris



On Jun 19, 2:07 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-06-19 at 01:54 +, rtconner wrote:
> > I followed the instruction at the bottom of this page:
> >http://www.djangoproject.com/documentation/fastcgi/
> > I can't seem to get this running on a shared host. I've also try using
> > the WSGIHander against jonpy, but I can't get that to work either. Any
> > helps?
>
> Based on the error message, [...]

Actually, that's a common error message if I remember back to my fcgi
Dreamhost days.

You can't just test the server like that (with
settings.APPEND_SLASH=True) because it chokes when there's nothing in
request.url to see if it ends with a slash.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Authentication expiration time

2007-06-17 Thread SmileyChris

On Jun 18, 3:02 am, itsnotvalid <[EMAIL PROTECTED]> wrote:
> That works, but it changes the behavior of all cookies set in the
> site.
> What if I need to have different expiration times for different
> cookies, or if I have to offer the user an option on how long the
> cookies' kept?
There's recent activity on a ticket which will address this:
http://code.djangoproject.com/ticket/2548


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Doing query with 'ne' terms.

2007-06-14 Thread SmileyChris

On Jun 15, 3:50 pm, "Nicholas Ding" <[EMAIL PROTECTED]> wrote:
> but I wanna 'where column1 <> %s and column2 <> %s'
> If I were using exclude, the SQL must be 'where not (column1 = %s and
> column2 = %s), that's different.

I think you want:
objects.exclude(column1=test1).exclude(column2=test2)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Did someone write an anti-spam module in django?

2007-06-14 Thread SmileyChris

> Thanks for pointing out this technique, I think I'll go this route
> instead of the Kitten CAPTCHA route.
Here's a snippet for that http://www.djangosnippets.org/snippets/131/

If you do want to run with the captcha method, here's a reCAPTCHA
field implementation:
http://smileychris.tactful.co.nz/ramblings/recaptcha/


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: matching a hyphen '-' character in urls

2007-06-14 Thread SmileyChris

> What  you want is "[-A-Za-z0-9_]+".
>
> The reason [-\w] doesn't work is because inside character classes
> ([...]), \w no longer means "alphanumeric characters". It's just a
> character escape.

Alternately, make the string a "raw" one (note the r before the
quote):
r'[-\w]+'


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Saving POSTed Data

2007-06-12 Thread SmileyChris

On Jun 13, 5:53 am, robo <[EMAIL PROTECTED]> wrote:
> if request.method == 'POST':
> form1 = form_for_model(Order)
> Orders = form1(request.POST, prefix='orders')
This is a bit confusing.
I'd suggest
OrderForm = form_for_model(Order)
order_form = OrderForm(request.POST, prefix='orders')
...
if order_form.is_valid() and order_details_form.is_valid():

return HttpResponseRedirect('/chef')


> I've read the Django tutorials on this, but I am still confused.
It seems like you're reading some tutorials on (old)forms and trying
to use newforms. They are two separate beasts, and should not be
combined - you don't need any of that FormWrapper stuff.

Side node: the IRC channel is useful for this sort of thing - dpaste
your model and then go ask about it there for quick help.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: request.POST.getlist('fieldname') / repeated rows of fields

2007-06-10 Thread SmileyChris

On Jun 11, 1:10 pm, David Priest <[EMAIL PROTECTED]> wrote:
> The Admin interface does it.  I haven't been able to figure out where
> it does it, so I can steal its method...
Check out django.utils.datastructures.DotExpandedDict


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: redirect with apache getting 2 slashes

2007-06-04 Thread SmileyChris

On Jun 5, 9:38 am, urielka <[EMAIL PROTECTED]> wrote:
> i will try that,but how that should matter?

I'm guessing that the first one matches the start of your url ending
in a slash:
Redirect 301 /archive/detail/3 
http://www.urielkatz.com/archive/detail/google-gears-orm/

and then it redirects to your new address, passing along any remainder
of the url (the slash)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: redirect with apache getting 2 slashes

2007-06-04 Thread SmileyChris

Try change the order of those two Redirects so the second one gets
tried first.

On Jun 5, 7:17 am, urielka <[EMAIL PROTECTED]> wrote:
> i got my blog inwww.urielkatz.comand i got some of my pages index in
> google and now i changed the blog to use slugs instead of post id for
> post url.
> so this:http://www.urielkatz.com/archive/detail/3/
> become to this:http://www.urielkatz.com/archive/detail/google-gears-orm/
>
> but that doesn`t work,this works:http://www.urielkatz.com/archive/detail/3
> but this with slash get me to 
> this:http://www.urielkatz.com/archive/detail/google-gears-orm//
>
> which get me a 404.
> my Apache Redirect are:
>
> Redirect 301 
> /archive/detail/3http://www.urielkatz.com/archive/detail/google-gears-orm/
> Redirect 301 
> /archive/detail/3/http://www.urielkatz.com/archive/detail/google-gears-orm/
>
> and APPEND_SLASH is set to False,but this still doesn`t work.
>
> please help,rescue :)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is (?u) in r'^tags/(?P[^/]+)/(?u)$'

2007-06-04 Thread SmileyChris

Oops, getting myself confused now.

(?u) is correct. http://docs.python.org/lib/re-syntax.html

Ignore my ignorance

On Jun 5, 3:55 am, Sam <[EMAIL PROTECTED]> wrote:
> Found there :
> Non-ASCII Tag Names in 
> URLshttp://code.google.com/p/django-tagging/wiki/UsefulTips
>
> I thought it is used to convert to unicode but it doesn't seem
> effective.
>
> Anyone knows about other flags ?


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What is (?u) in r'^tags/(?P[^/]+)/(?u)$'

2007-06-04 Thread SmileyChris

That's a spelling mistake. Try '(?:u)' instead

On Jun 5, 3:55 am, Sam <[EMAIL PROTECTED]> wrote:
> Found there :
> Non-ASCII Tag Names in 
> URLshttp://code.google.com/p/django-tagging/wiki/UsefulTips
>
> I thought it is used to convert to unicode but it doesn't seem
> effective.
>
> Anyone knows about other flags ?


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: URLconf suggestions

2007-06-01 Thread SmileyChris

Perhaps:

.../from/2007-02-07/

.../until/2007-03-07/

.../from/2007-02-07/until/2007-03-07/

On Jun 2, 7:40 am, cjl <[EMAIL PROTECTED]> wrote:
> D:
>
> I am in the process of learning Django, and I'm trying to build a very
> simple mapping application similar to chicagocrime or
> newhavencrimelog.
>
> I like the URLconf that chicagocrime uses for displaying crimes by
> type:
> /crimes/arson
> /crimes/burglary
>
> This makes sense, and the urls look nice.  I'm stumped on the "right"
> way to handle dates or date ranges in a URLconf...newhavencrimelog
> allows you to limit your search by a date range, however this
> information in not reflected in the URL...I'm guessing this is passed
> as session data? Chicagocrime has a URLconf for a single date, but not
> for ranges:
>
> /2007/feb/07
>
> Anyway, I would like some suggestions on a URLconf for date
> ranges...anyone doing this?
>
> Thanks in advance,
> CJL


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Case insensitive urls

2007-06-01 Thread SmileyChris

Hi Ramashish,

I haven't tried it, but I think that you could just use regular
expression extension notation to make the regex case insensitive in
your url conf.
So instead of:
  ('users/add/', 'views.add'),
You'd do:
  ('(?i)users/add/', 'views.add'),

Try it and let everyone know if that works...

On Jun 2, 1:35 pm, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I would like to make urls of my site case-insensitive. As I
> understand, by default the url matching is case-sensitive. Is there a
> way to specify in my urls.py that I want a case-insensitive match?
>
> Thanks,
> Ram


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms and recaptcha => MultiWidget/MultiField?

2007-05-26 Thread SmileyChris

On May 26, 1:04 am, Bram - Smartelectronix <[EMAIL PROTECTED]>
wrote:
> hello everyone,
>
> I'm trying to recreate reCaptcha (http://recaptcha.net/learnmore.html)
> in newforms.

I did this yesterday:
http://smileychris.tactful.co.nz/ramblings/recaptcha/


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Silly Newforms Best Practices Question

2007-05-26 Thread SmileyChris

On May 26, 2:53 pm, oggie rob <[EMAIL PROTECTED]> wrote:
> Probably not an issue, but if you import as:
> from django import newforms as forms
> you may want to watch out for namespace issues.

That's why, like Russ, I also use a forms.py file and do the newforms
import like:
from django.newforms import *

Then in my views I'll just import the form classes I create.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Web Docs as a Single PDF Available

2007-05-25 Thread SmileyChris

Assuming you are using an SVN checkout, you may want to look at my
Django Documentation application which provides access to the official
Django documentation as HTML inside of your local Django
administration documentation.

http://smileychris.tactful.co.nz/ramblings/django-documentation/

On May 26, 4:21 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> > When I'm at home the best connection I can get is 28.8 dial up. Yeah,
> > that's right. When I moved there, the phone company said that we'd
> > have DSL "very soon", which apparently means more than 5 years.Since
> > I'm not always connected, sometimes checking the docs is less than
> > convenient . . . all the more so if my wife is on the phone.
>
> As a frequent dialup user (and off-line user), if you haven't
> learned the joys of "wget" and the ability to mirror a site
> locally, it does a fairly smart job of cloning a site for
> local/offline use.
>
> It comes with a variety of knobs to twiddle regarding recursion
> depth, off-site links, parent directories, flow-limiting,
> resuming/retrying if the connection goes down (which, as a dialup
> user happens often, as you surely know) and other such conveniences.
>
> Additionally, you may want to investigate the wwwoffle package
> (http://www.gedanken.demon.co.uk/wwwoffle/) which acts as a local
> proxy that specifically attempts to make offline browsing a more
> gentle experience.
>
> "wget" is pretty standard in most Linux distros, and is often
> included in other *nix distros.  It should also be available in
> Cygwin for Win32 folks.  As for "wwwoffle", I don't know how
> available/functional it is for Win32.
>
> Fortunately, the Django overlords (and the resulting
> documentation pages) adhere strongly to RESTful web design which
> makes it very cache-friendly.
>
> -tim


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: QueryDict variables with multiple levels

2007-05-03 Thread SmileyChris


> You could write a function that takes Django's standard MultiValueDict
> and returns the type of nested structure you are after. Not a change
> worth making in core, but it's only a function you would have to write
> once for your own use.

Actually, there is a function that could do what you want in core
already:
django.utils.datastructures DotExpandedDict

Here's an example of usage: http://dpaste.com/hold/9571/


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Newforms and Hidden Fields - verifying POST data

2007-04-23 Thread SmileyChris

On Apr 24, 4:04 am, Tipan <[EMAIL PROTECTED]> wrote:
> I'm seeking advice on how to ensure my form data in hidden fields is
> the same after the user has posted the form.

If it's calculated data (somehow) then why do you need to pass it to
the user? Couldn't you just calculate this data and add it to the form
data on successful submission of the form, just before the data is
saved to the db?

If it *is* user data (say from a two-step form) then it shouldn't
matter if it changes as long as it still validates.

You might need to give some more details on what this form data
contains.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Question about queries

2007-02-21 Thread SmileyChris

Hi Josh,

Try:
  prev = album.photo_set.filter(id__lt=).order_by('-id')[:
1]


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: show an image

2007-01-23 Thread SmileyChris

http://www.djangoproject.com/documentation/static_files/


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Forms and/or Models from one template (newforms)

2007-01-22 Thread SmileyChris

On Jan 23, 8:07 am, "JimR" <[EMAIL PROTECTED]> wrote:
> 1. Can/Should I use multiple forms on one template that will update the
> models?  So far, when I've tried this approach the "post" only uses the
> first form on the page.
>
> 2.  Should I use one large form containing all of the fields from the
> various models?  If so, how do I assign the appropriate fields to their
> respective models?

I'd use 3) multiple "newforms.Form"s and just one HTML ""
When you bind each form, use prefix='something-unique' for each.

Then use newforms.models.saveinstance to save each. I'd add in the
unique user id at this stage and not use it in each of the forms (copy
the form.clean_data and add the id)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Can the DB API do this?

2006-12-30 Thread SmileyChris


Hi there,

Check out:
http://www.djangoproject.com/documentation/db_api/#extra-select-none-where-none-params-none-tables-none

In a nutshell:
Team.objects.extra(
   select={
   'team_total': 'SUM(tourney_score.amount)'
   },
)

You may want to add it as a manager to the model:
http://www.djangoproject.com/documentation/model_api/#managers


On Dec 31, 8:05 am, "ringemup" <[EMAIL PROTECTED]> wrote:

Hi all --

I'm trying to figure out whether a query like the following can be done
through the DB API (for maintainability), or whether I'll have to
execute it as custom SQL:

SELECT SUM(tourney_score.amount) AS team_total, tourney_team.id
FROM tourney_score, tourney_team, tourney_player
WHERE tourney_score.player_id = tourney_player.id
AND tourney_player.team_id = tourney_team.id
GROUP BY tourney_team.id

This basically computes the total score for each team of players in a
tournament.  Is this too complex for the API?  I couldn't quite figure
out how to execute it.

Thanks!



--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Pull Data from multiple models into one view?

2006-12-25 Thread SmileyChris


[EMAIL PROTECTED] wrote:

How could I combine this into one view (i.e. recent_photos)?


Hi Oliver,

Since you're talking about two separate models, two queries (the way
you are doing it at the moment) makes perfect sense. In a view, combine
them in a list, sort it, then pass that to your template. Something
like:

recent_photos = [p.date_taken, p for p in recent_ownphotos] +
[p.date_taken, p for p in recent_faves]
recent_photos.sort()
recent_photos.reverse()
recent_photos = [p for date, p in recent_photos]


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: What if slug is already used?

2006-12-20 Thread SmileyChris


On Dec 21, 11:47 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

I ran into this on my forums, where it didn't take long for someone to
post a duplicate title. I ended up passing both the slug and the id.
Kinda defeats the purpose, but it's bulletproof.


When faced with a similar situation, I overwrote the save method and
ensured the slug generated is unique (adding _2 or _3 etc to the end if
it wasn't).


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Mutile forms, id conflicts.

2006-11-17 Thread SmileyChris

> {% for choice in shipping_choices %}
> {{ choice[0] }}
> {% enfor %}

You want {{ choice.0 }} and {{ choice.1 }}


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Paginator question

2006-11-10 Thread SmileyChris

http://code.djangoproject.com/changeset/4041

On Nov 10, 8:24 pm, "Pythoni" <[EMAIL PROTECTED]> wrote:
> Thank you for your reply
> Where can I download the patch?
> I still use 0.91 Django version


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Paginator question

2006-11-09 Thread SmileyChris



On Nov 10, 2:59 am, "Pythoni" <[EMAIL PROTECTED]> wrote:
> As far as  I know paginator works with a list that is created from an
> object with
> get_count() and get_list() methods.
> If I already have a list, is it possible to use paginator with that
> list somehow too?
>
> Thank you for replies
> La.

A paginator patch was checked in a couple of days ago which makes
paginator work with a list.
So if you're using the SVN trunk, then you win :)


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: XSS and Secure HTML Filtering

2006-11-07 Thread SmileyChris

On Nov 8, 12:25 pm, "Oliver Lavery" <[EMAIL PROTECTED]> wrote:
> That's a pretty nice solution.
>
> Implicitness in this case is a desirable attribute, imho. For output
> filtering it would be nice to have HTML escaping be a sitewide default. This
> is just good security practice, deny by default, and allow by exception.

I concur. But in this case, it would be good to provide full backwards
compatibility.
My solution is as implicit as possible without being obnoxious :)

To make it site-wide, all you have to do is wrap everything with {%
finalfilter escape %} in your base.html template and all your {{
variable tags }} are protected.

On the other side of your discussion: Personally, I'm not a fan at all
of input filtering at all. As long as you trust your output methods,
you shouldn't have to worry about this. There are solutions to this
(like tidyhtml - I think?) if you need them however.


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: XSS and Secure HTML Filtering

2006-11-07 Thread SmileyChris

> ... There's been
> extensive discussion of this on the developer list and thus far
> no-one's stepped up with a clean implementation that doesn't get in
> the way of some use cases (keep in mind that Django's template system
> is expected to be able to produce more than just HTML ...

I dunno, I reckon my implementation is pretty clean
(http://code.djangoproject.com/wiki/AutoEscape%20alternative)

When I brought it up on the group a while ago, I hit resounding
silence. It doesn't seem to be the hot topic it was a while back.


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Recording Changes minor problem

2006-11-06 Thread SmileyChris

I'm not certain, but it could be that the status_id of the new object
is returning as a string (because it's most likely come from web
request). Try comparing the str() of each.

Your __dict__ code is a bit messy - you shouldn't really need to use
internal methods like this. How about just using getattr(self, f)
instead.


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How i change Django Admin Title?

2006-11-06 Thread SmileyChris

It's explained in tutorial 2:
http://www.djangoproject.com/documentation/tutorial2/#customize-the-admin-form


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Template inclusion tags, include once

2006-11-05 Thread SmileyChris

It's possible:

Set a variable in the context. Only do whatever the template tag does
if the variable has not been set.


--~--~-~--~~~---~--~~
 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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: New to django & www apps

2006-10-23 Thread SmileyChris

Hi Przemek,

Welcome to the Django community!
As Marcus suggested, run through the tutorial on the offficial django
site (in the documentation section).
Then join the official django IRC channel
(irc://irc.freenode.net/django) - it's pretty active and friendly and
you should get questions answered promptly.

On Oct 24, 3:25 am, "Przemek" <[EMAIL PROTECTED]> wrote:
> Hi, I make my living as a software developer for about 15 years now and
> python has been my primary programming language since its version
> 1.5.2. But I've never had any need for html (cgi) programming until
> now. Time has come that my client asked for an CRM type of application
> with www interface and not a typical GUI app. After doing some research
> I found django too seem to taste the best. I would be thankful for
> suggestion on where to start (howto's, tutorials, articles) to go
> quickly trough www-cgi to move to the application work.
> 
> Thanks!
> 
> Przemek


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: OT: fast selection in drop-down lists

2006-10-23 Thread SmileyChris

Yep, it's mainly browser-specific here (mostly if you start typing
while you have focus on the box, it'll go to the relevant entry)
However, Javascript can control the selected element of a select box,
so you could write some script. It seems like a lot of effort for
little gain though (but then again, you may have an important case).

On Oct 24, 7:54 am, Baurzhan Ismagulov <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> is there a way to quickly choose an entry in a drop-down list? IIUC,
> this is browser-specific, but perhaps there is some fancy Javascript
> doing that?
> 
> Thanks in advance,
> Baurzhan.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Paginator Overhall

2006-10-16 Thread SmileyChris

On Oct 17, 6:11 pm, "SmileyChris" wrote:
> - #2575 fixes up some of the messy bits (including a few bugs) and adds
> orphaning.
Oh, and it also makes Paginator work with lists/tuples.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Paginator Overhall

2006-10-16 Thread SmileyChris

Just chiming in,

To clarify, I only have two patches regarding pagination:
- #2575 fixes up some of the messy bits (including a few bugs) and adds
orphaning.
- #2576 makes a PaginatorPage object which is useful for self-contained
pages (IMO usual use on a template)

> Trying to account for everybody's particular
> preferences for representing page numbers for "other pages", etc,
> becomes tricky. When I last looked at Chris's enhancement, it wasn't
> immediately clear to me how to resolve all those problems.
Neither of my patches address this (nor make it any more of a problem
than it is now).

On a side note, the one thing I dislike about the current paginator
(and my reason behind PaginatorPage) is that is seems very
un-encapsulated when it hits the template.
I'd rather have one 'paginator' key in my context (a PaginatorPage
object) than having a myriad of related keys: 'paginator_current_page',
'paginator_has_next_page', 'paginator_batch_size', ...


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How do I select where x=a and y=b?

2006-10-08 Thread SmileyChris

Actually, exact lookups are the default:
http://www.djangoproject.com/documentation/db_api/#default-lookups-are-exact

Carl, it's likely that you were not using quotes around your strings.
.get(x=a) will get the record where property x matches the defined
variable a (which you probably hadn't defined)
.get(x='a') will get the record where property x matches the string "a"

On Oct 9, 8:36 am, "MerMer" <[EMAIL PROTECTED]> wrote:
> Details are in the Database API document .  The "exact" expression is
> defined in the glossary thoough the example uses .get rather than
> .filter
>
> MerMer
>
> carlwenrich wrote:
> > it worked, thanks. where would i find it if you hadn't been so kind as
> > to tell me?


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: "slice" xhtml content and keep it valid xhtml?

2006-09-27 Thread SmileyChris

... and feel free to email me any specific questions about my patch.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: stripping html of tags

2006-09-13 Thread SmileyChris

How about slicing to 1000 (or however much you want to be safe that
you'll get 200 of non-tags), then strip, then slice down to 200.

For a slightly different approach there is a patch I wrote for
providing an html-aware truncatewords filter at
http://code.djangoproject.com/ticket/2027 which you could try using.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to do Service.objects.filter(max_user__gt=cur_user) where both are fields of the model

2006-09-12 Thread SmileyChris

Hi Mathias,

I think you're looking for the .extra() queryset method.
http://www.djangoproject.com/documentation/db_api/#extra-select-none-where-none-params
-none-tables-none


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: stripping html of tags

2006-09-12 Thread SmileyChris

Why don't you strip before you slice.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: why 'default' filter does't work?

2006-09-04 Thread SmileyChris

The problem has been fixed in r3714. Do an SVN update and you should be
able to use the default filter like before.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: why 'default' filter does't work?

2006-09-03 Thread SmileyChris

I wrote a ticket explaining the problem, and it has been picked up
already. I would expect it will be changed back to the old
functionality soon.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: why 'default' filter does't work?

2006-08-31 Thread SmileyChris

Hi HoLin,

I encountered that same problem - the functionality changed in [3268]
so that filters aren't used if the variable is not found.

I think this is incorrect and will bring it up in the developers group
now.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Trouble accessing photos in my template

2006-08-22 Thread SmileyChris

{% for photo in object.photo_set.all %}

{% endfor %}

PS: It would be better to call the field 'entry' rather than 'photoid'


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: table relationship help

2006-08-22 Thread SmileyChris

Hi Rob,

You have the ForeignKey reference in the correct place.

Check out the documentation about edit_inline on the ForeignKey field.
You most likely don't actually need to use the class Admin: on your
Text class.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: display related objects in admin

2006-08-20 Thread SmileyChris

>From documentation:

If the string given is a method of the model, Django will HTML-escape
the output by default. If you'd rather not escape the output of the
method, give the method an allow_tags attribute whose value is True.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: collapsing

2006-08-17 Thread SmileyChris

Finishing the half finished sentence:
... You could make this work either by using square brackets or by
adding a comma after the your inner "two-tuple", otherwise the outer
brackets are being ignored and not turned into a list. It's a python
thing with tuples and brackets.


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: collapsing

2006-08-17 Thread SmileyChris

Fields must be a list of two-tuples. You could make thi
Note the new comma after the bracket:

fields = (
('Alcohol Use', {'fields': ('have_used', 'have_participated',),
 'classes': 'collapse'}),
)


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Directory structure & common functions

2006-08-15 Thread SmileyChris

Hi Michal,

Try importing with the project name as part of the import path:

from projectname.utils.strings import convert_string


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: Perplexing many-to-many template error (bug?)

2006-08-14 Thread SmileyChris

I forgot to mention, from a shell I can access the M2M property fine,
so it seems like a template problem:

>>> p = Person.objects.get(pk=1)
>>> p

>>> p.projects

>>> p.projects.all()
[]


--~--~-~--~~~---~--~~
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 this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



  1   2   >