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 subd

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

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 t

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 visi

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

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

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 industrio

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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: '_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: 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: 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: 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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: "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: 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 c

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

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 ema

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 e

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.

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

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 gro

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

Re: Formatting FloatField values in templates

2006-08-22 Thread SmileyChris
Hi Cary, Try the stringformat filter {{ r.hourly_rate|stringformat:".2f" }} --~--~-~--~~~---~--~~ 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

  1   2   >