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

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) > >

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 thi

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

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

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

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') ..

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]+' --~--~-~

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.n

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)

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 rece

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 als

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/#dja

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 jus

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 g

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. --~--~-

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 (s

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 'in

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 Admi

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 --~--~-~-

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.co

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 yo

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

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, se

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

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

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

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,

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: > ... >

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 th

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 w

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

Re: Django newbie question about views and authentication

2008-04-01 Thread SmileyChris
You can use the django.views.generic.simple "direct_to_template" view just like you would the render_to_response shortcut - it works the same except you pass in the request as the first argument: direct_to_template(request, 'template/index.html') On Apr 2, 2:42 am, Matias Surdi <[EMAIL PROTECTED

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 t

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 T

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 i

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 w

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

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

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/ --~--~-~--~~~

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..

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

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

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

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 thi

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.

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

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 fo

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 syste

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(model

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 thi

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 proba

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 :) --~--~-~--~~~---

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 >

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 &

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

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.djangoproje

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 subsc

Re: Templates, filesystem, caching?

2007-12-21 Thread SmileyChris
After reading this thread the other day, I decided to write up a patch [1]. [1] http://code.djangoproject.com/ticket/6262 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

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 in

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'

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 wou

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 unsubs

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 defi

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 everyb

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 a

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 a

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

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, s

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 t

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 g

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

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,

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 rep

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 s

Re: Django / Python and daylight saving time

2006-11-14 Thread SmileyChris
The problem is specifically with the development server. Add "import time" to django/conf/__init__.py and see if it fixes it for you. Please report if that solves your problem in the above mentioned ticket (http://code.djangoproject.com/ticket/2315) - if multiple people have tested and can confir

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 e

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,

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 templat

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.djan

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

Re: Tute Part 4: vote() got an unexpected keyword argument 'poll_id'

2007-01-23 Thread SmileyChris
The error message itself actually explains the problem quite well: vote() [your view] got an unexpected keyword argument 'poll_id' [so your view was passed an argument it wasn't expecting...] If you look at your urls.py, I think you'll find that you have a line like this: (r'^(?P\d+)/vote/$', 'my

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 t

Re: Dreamhost recommended?

2006-05-03 Thread SmileyChris
I haven't launched anything public on Dreamhost yet, but I haven't had any problems with some test apps I put up. So that's a tentative +1 success, pending a real app launch :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

One-to-one not to be used?

2006-05-08 Thread SmileyChris
According to the docs: "The semantics of one-to-one relationships will be changing soon, so we don't recommend you use them. If that doesn't scare you away, keep reading." It scares me a bit. Can anyone expand on the "changing semantics" or point me to an existing discussion? Thanks --~--~---

Re: Getting a foreign key from a recursion relation model

2006-06-12 Thread SmileyChris
Something like this: - Task will show up under Project (I removed class Admin, added edit_inline) - Tasks don't need a client link probably, since they are linked to a project already class Client(models.Model): name = models.CharField(maxlength=255) [...] def __str__(self):

Re: Admin - delete file or image when is not required

2006-06-12 Thread SmileyChris
This may be similar to the fact you can't clear a file field. See http://code.djangoproject.com/ticket/22 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: Getting a foreign key from a recursion relation model

2006-06-13 Thread SmileyChris
Try models.STACKED then. I'm guesing the task doesn't need to change the client, just show it? If so, you could make a method that gets the client (return self.project.client.name) and add that to the fields to list in admin view. Read up on http://www.djangoproject.com/documentation/model_api/#ad

HttpResponseSendFile

2006-06-14 Thread SmileyChris
I noticed http://code.djangoproject.com/ticket/2131 was marked as a wontfix today with the comment, "Django isn't meant to serve static files". I don't want to go reopening the ticket, but couldn't this still be useful functionality? What if I wanted to limit access to a static file to certain us

Re: HttpResponseSendFile

2006-06-14 Thread SmileyChris
Sorry, this was supposed to go in the Django developers 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 unsubs

Re: problem on windows apache settings

2006-06-14 Thread SmileyChris
> I just write hotel.settings or I need to finger out the full > path like'c:\hotel.settings'? Yep, just hotel.settings - if you add your projects folder (the one which the hotel folder is sitting in, eg C:\Django\Projects) to PythonPath, then Django knows where to look. > second:PythonPath "['/

Re: Setup django

2006-06-22 Thread SmileyChris
Hi Martin, Django works alright with FastCGI, so if you can get that installed it looks like your best bet. Check out this page for some installation info for a shared environment: http://wiki.dreamhost.com/index.php/Django --~--~-~--~~~---~--~~ You received this

Re: How to select distinct rows?

2006-06-27 Thread SmileyChris
I don't think GROUP BY is part of the Django ORM, but you can easily use raw SQL in a custom method to achieve this: http://www.djangoproject.com/documentation/models/custom_methods/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: User never logs out

2006-07-10 Thread SmileyChris
This does bring up an interesting point that .is_anonymous would probably be better as something like .not_anonymous so we don't get false-positives in templates if user is not found. --~--~-~--~~~---~--~~ You received this message because you are subscribed to th

Re: User never logs out

2006-07-11 Thread SmileyChris
I don't indent .not_anonymous to solve this problem. But it wouldn't mask it any more than .is_anonymous either. The reason I suggest this way, is that I'd rather have a template default to the "not logged in" section rather than just assume a logged in user when actually the user may just not be

Re: Extending pluralize?

2006-07-19 Thread SmileyChris
Ivan Sagalaev wrote: > Sure. This whole pluralization problem can be divided into two: > > 1. Enhance pluralization filter to accept language specific set of > terminations and peek the right one by language-dependent algorithm. > There a human is responsible for providing the exact values for >

Re: M2M intermediary tables, looking up objects

2006-07-19 Thread SmileyChris
I think what you're after is: Ingredients.objects.filter(label_ingredient__baked_good = self.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-user

Re: Sharing tables between apps

2006-07-23 Thread SmileyChris
Hi Matt, Your playlist app can use the models in your schedule app by just importing them. from schedule.models import Show Of course, it depends on your directory structure, but you get the idea? --~--~-~--~~~---~--~~ You received this message because you are

Re: Media and Admin Media URL Issues

2006-07-26 Thread SmileyChris
http://www.djangoproject.com/documentation/static_files/ says: Using this method is inefficient and insecure. Do not use this in a production setting. Use this only for development. I'd guess that you just needed to symlink the media and admin media directories to your site root. --~--~

Re: Media and Admin Media URL Issues

2006-07-27 Thread SmileyChris
Tyson Tate wrote: > Inefficient and insecure? Blast. I'm using FCGI, so it looks like > I'll have to add a subdomain that points to my media files and, > subsequently, hunt down every single place that I've had to hard-code > the URL in. Hi Tyson Regarding MEDIA_URL, check out that link that Jo

  1   2   >