Re: Best Convension for dealing with variables needed in every view.

2009-03-29 Thread David Zhou
; do what I need.  Once my context_processor is made how would I add it > to this list?  Something like > settings.TEMPLATE_CONTEXT_PROCESSORS.append(my_processor) > > > On Mar 29, 7:19 pm, David Zhou wrote: >> On Sun, Mar 29, 2009 at 7:14 PM, IanR wrote: >> > I'm trying to stay a c

Re: class for form fields

2009-05-11 Thread David Zhou
On Mon, May 11, 2009 at 12:04 PM, CrabbyPete wrote: > > I just started using forms and I have the following html > Zip Code: size="15" maxlength="15"> > > How do you specify the class type for the input field. See: http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.att

Re: disable django cache

2009-05-14 Thread David Zhou
On Thu, May 14, 2009 at 9:53 PM, online wrote: > > Whatever i changed 'home.html' to other page i always get the same > result. Are you restarting your serving? If by "changed home.html to other page" you mean you modified your view function to return a different template, then make sure you re

Re: Obfuscate HTML..?

2009-05-24 Thread David Zhou
On Sun, May 24, 2009 at 9:40 PM, jago wrote: > > I want to make the HTML of the website as little human readable as > possible. For that I would like to add some layer to Django 0.96 which > when writing out the page takes the HTML and adds some processing. > > 1. How would I obfuscate the HTML a

Re: runserver fails

2009-05-24 Thread David Zhou
Does the following worth in the interactive prompt? >>> import socket >>> socket.getaddrinfo("www.google.com", 80) -- dz On Sun, May 24, 2009 at 10:59 PM, Chris DPS wrote: > > When I execute runserver, I get the following message: > > Validating models... > 0 errors found > > Django version

Re: Is slugify available as a Django API call?

2009-09-13 Thread David Zhou
On Sun, Sep 13, 2009 at 9:07 PM, W.P. McNeill wrote: > the web, but this seems error prone.  The right way to do it would > seem to be to use the slugify code that is already in Django. > What is the best way to slugify an arbitrary string using a Python > call? from django.template.defaultfil

Re: Django-cms

2009-10-26 Thread David Zhou
On Mon, Oct 26, 2009 at 4:16 AM, aju mathew wrote > > In Django CMS any blog plugin is available. You should be using the Django-CMS mailing list for this in the future. That said, use CMS_PLACEHOLDER_CONF to specify which plugins are available for which placeholders: http://www.django-cms.org

Re: {% url in templates

2009-10-28 Thread David Zhou
What's your 'view_xyz'? Are you sure that view_xyz is accessible through an URL without any arguments? -- dz On Wed, Oct 28, 2009 at 2:55 PM, Umapathy S wrote: > Hello there, > > I am developing a page which has a left side menu. This menu is a seperate > html and gets includes in the base.h

Re: WebFaction warning

2009-11-29 Thread David Zhou
On Sun, Nov 29, 2009 at 9:18 PM, digicase wrote: > I received a good email From Remi at WF which told me all I needed to > know. The outage was unacceptable but hopefully lessons have been > learned. Do you mind sharing what he said? I'd be curious to know if any new controls have been put into

Re: DjangoCon 2011

2010-09-27 Thread David Zhou
Is the bay area right out for cost reasons? dz Sent from my iPhone On Sep 27, 2010, at 8:48 PM, Samuel Baldwin wrote: > 2010/9/27 Franklin Einspruch : >> May I humbly suggest Boston? > > Another for Boston. > -- > Samuel Baldwin - logik.li > > -- > You received this message because you are sub

Re: How to aggregate values by month

2010-11-04 Thread David Zhou
FWIW, on Postgres DBs, I've done the following: qs = FooModel.objects.filter(date__gte=start_date, date__lt=end_date).extra(select={'datetrunc': "date_trunc('month', date)"}).values('datetrunc').annotate(total=Sum("value")) date_trunc in postgres also accepts "day" and "week" truncations. -- dz

Re: Expiring view caches

2010-02-11 Thread David Zhou
Check out this snippet: http://www.djangosnippets.org/snippets/936/ Some what old though (2008), so it might need updating to work properly. -- dz On Thu, Feb 11, 2010 at 4:18 PM, HARRY POTTRER wrote: > Is there any way to manually expire per-view caches? > > I have a view that executes betw

Re: django template blocks and jquery

2010-02-16 Thread David Zhou
There are a couple of ways, but here's one off the top of my head: Base template: $(function(){ function1() { ... } function2() { ... } {% block additional_domready %}{% endblock %} }); {% block additional_js }%}{% endblock %} child template that extends base template: {% block add

Re: TemplateDoesNotExistError makes no sense

2010-04-11 Thread David Zhou
On Sun, Apr 11, 2010 at 4:26 PM, Dexter wrote: > I have a server running with primarily nginx and secundary apache2, > And I am getting an template error trying to browse an app. It seems it > cannot find a template, but it is certainly there, the runserver just works > fine. Everything in progr

Re: mod_python vs. mod_wsgi

2008-05-06 Thread David Zhou
It works for me. Here's the body of that post: * Support for mod_wsgi: Setting up a default Django app with mod_wsgi is now an option in our one-click installer. So if you prefer mod_wsgi over mod_python you will no longer have to install it manually. I just ran a simple benchmark using "a

Re: Python issues on mac. Python not working.

2008-05-14 Thread David Zhou
Just grab macports or fink and install python from that. On May 14, 2008, at 12:32 PM, Jason Ourscene wrote: > > Ok now that the shock has passed a bit, anyone know how to do this > without reinstalling the OS. > > Thanks!!! > > On May 14, 11:47 am, Jason Ourscene <[EMAIL PROTECTED]> wrote: >>

Re: where does this caching come?

2008-05-14 Thread David Zhou
rom a "request handler" function (myproject.myapp.views.index) Are you restarting the server between module changes? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Python 3000 support, any plans?

2008-05-15 Thread David Zhou
reaches a non-alpha state. If you want to use Django for something, I'd start now -- or with 1.0. Waiting for Python 3000 is a bit silly. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Re: How to get child model' name from parent obj in Multi-table inheritance

2008-05-30 Thread David Zhou
x27;): #is man elif hassattr(person_obj, 'woman'): #is woman else: #is freakish mutated thing --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users&

Re: How to get child model' name from parent obj in Multi-table inheritance

2008-05-31 Thread David Zhou
On May 30, 2008, at 11:20 AM, jonknee wrote: > On May 30, 10:38 am, David Zhou <[EMAIL PROTECTED]> wrote: >> You can use also use hasattr(). >> >> Something like >> >> if hasattr(person_obj, 'man'): >> #is man >> elif hassattr(

Re: Painfully slow... why?

2008-06-09 Thread David Zhou
0.37 DB: 0.11 Queries: 3 > Stats: Total: 0.21 Python: 0.17 DB: 0.05 Queries: 32 > Stats: Total: 0.27 Python: 0.22 DB: 0.05 Queries: 32 What's up with that second line? Are you doing anything fancy? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~---

Generic foreign keys and double underscore relation spanning

2008-06-10 Thread David Zhou
erribly elegant. Is there a better way to do this? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

Re: Dictionaries, templates and best practices

2008-06-17 Thread David Zhou
> assigned to 'post' in render_to_response) > > > > {% for x in post%} > > {{ post.0.title }}^M > > > > > >{{ post.0.post }}^M > > > > It will only show the first part of the dictionary and 'x' as a > number >

Dynamically generated template variables in admin?

2007-03-20 Thread David Zhou
variable_title }}. Then it will use the variable name with underscores replaced with spaces as the title. Should I wait for the new admin code before trying to edit the admin interface? Does this sound like a good way of doing things?

Re: fcgi - issues

2007-03-26 Thread David Zhou
nd is the one > originally used by the developers. I've been using FCGI, and it's beautifully so far. I'm using nginx passing to flup. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: Does the server have to restarted when you make a change to the code?

2007-03-27 Thread David Zhou
code (this was a big deal for my hosting provider).<< > > http://snook.ca/archives/php/cakephp_initial/ > > Is that post correct? You have to restart the server whenever you make > a change to the django code? I haven't needed to do so for template chan

Re: Need dedicated hosting for Django

2007-04-17 Thread David Zhou
may consider SliceHost > (Xen-based) and Linode (UML-based). The first one is used, and > raved about, > by a person I trust (hi, dialtone!). I like RimuHosting, and would happily recommend it to anyone. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~

Django on Server Axis

2006-12-20 Thread David Zhou
Does anyone have any experience with Django on Server Axis? I've been looking at Rimu Hosting, but came across a couple positive reviews of Server Axis. Their available memory and HD/transfer is much more than Rimu at the $30 price point. Thanks, David --~--~-~--~~-

OneToOne in Models

2006-12-27 Thread David Zhou
Hey, I've been creating a blog app to get a handle on some of the more basic Django stuff. Currently, I'm using FreeComments for commenting, but don't really like the way it does some things (the URL, for example). I figure it shouldn't be too hard to add in my own commenting models an

Re: OneToOne in Models

2006-12-27 Thread David Zhou
On Dec 27, 2006, at 6:06 PM, Adrian Holovaty wrote: On 12/27/06, David Zhou <[EMAIL PROTECTED]> wrote: What are people using for OneToOne relations (Comment->Entry)? The Django documentation says that it may change, and is not recommended for use. What do you use instead, or do mo

Re: Smart quotes filter

2006-12-27 Thread David Zhou
martypants. I don't think Markup support's it as a filter though. You may have to process the chunk through smartypants before passing to the template. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you a

Re: noob help, many to one, model

2006-12-28 Thread David Zhou
ost1.save() And then to access the related user of post1: post1.user.alias which should spit out 'bob' (I haven't tested any of this, but it's basically a variation of the sample page at: http://www.djangoproject.com/documentation/mod

Re: A basic problem with templates (I think)

2006-12-28 Thread David Zhou
entities. Even if you have the encoding set correctly on the server and source side, the user can still explicitly set the (possibly wrong) encoding in the browser. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you

Re: multiple projects one server

2007-01-04 Thread David Zhou
e django+flup fcgi things described on the official site, but in theory, you could use apache as well, I suppose. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users

Re: multiple projects one server

2007-01-05 Thread David Zhou
. If so does nginx provide some mechanism to start them up or is it all handomatic? I have a script that starts them up, but yeah, AFAIK, there isn't anything in nginx or Django that starts them automatically. --- David Zhou [EMAIL PROT

Re: Getting the new data value

2007-01-05 Thread David Zhou
, but I'd rather not have to do multiple writes to the db. self. returns the value about to be written for me? Are you sure it's retrieving the value from the db? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message becau

Re: Why so slow?

2007-01-06 Thread David Zhou
? i have: StartServers 5 Minspareservers 5 maxspareservers 10 maxclients 20 maxrequests per child 5 Why is your maxrequests at 5? Aren't you basically restarting a process every 5 requests? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You receiv

Re: Generic views and filtering

2007-01-12 Thread David Zhou
On Jan 12, 2007, at 6:25 PM, Nicolas Steinmetz wrote: > Do I have to do as James [1] suggests, ie to filter it in views.py > with some generic views methodes ? That's the way I do it. It's a very simple wrapper, and also allows me to add a host of other things into the con

Queryset Evaluation

2007-01-18 Thread David Zhou
d appreciate it if someone could point me that way. I foudn a little bit about when it gets evaluated in the docs for the DB API, but it was fairly light on the details. Thanks! --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this mess

Re: 'blog entries' with multipe inline images

2007-01-18 Thread David Zhou
images wherever I want them to be. But if, say, I always had a header or title graphic in the same place for each entry, I'd probably put that in the model. But if it's just random images inside of the body content, I don't think it's worth it

Re: Queryset Evaluation

2007-01-18 Thread David Zhou
of the same set displayed in different template blocks. I could use a bunch of for loops and if statements in the template logic, but that seems really inefficient and cpu heavy for just splitting up a set. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ Yo

Re: Queryset Evaluation

2007-01-18 Thread David Zhou
nd offset to the eventual query. So Django would combine [1:3] and [3:10] into one database hit? AFAIK, you can do those two in just sql -- Django would need to know to slice the resulting [1:10] set automatically. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~

Re: Queryset Evaluation

2007-01-18 Thread David Zhou
On Jan 18, 2007, at 4:21 PM, James Bennett wrote: On 1/18/07, David Zhou <[EMAIL PROTECTED]> wrote: So Django would combine [1:3] and [3:10] into one database hit? Accessing an object in 'b' after doing this will result in a database query. Accessing an object in 'c&#

Re: How to Upgrade Django from 0.95 to Current Dev

2007-01-18 Thread David Zhou
ype 'svn up' to sync to the latest trunk. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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

Re: Payment Gateways

2011-03-08 Thread David Zhou
I use Braintree, and it's been great. -- dz On Tue, Mar 8, 2011 at 4:40 PM, CLIFFORD ILKAY wrote: > On 03/08/2011 09:59 AM, Bill Freeman wrote: >> >> And I can't resist recommending solutions that don't require your to touch >> the credit card number.  If you never had it, you can't be respons

<    1   2