Re: Beginner on Django and web developing

2008-11-03 Thread David Zhou
ty out of date at this point, and some sections -- like the Admin site -- will simply not work. Your best bet is to go through the tutorials on the Django documentation site. David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message be

Re: Beginner on Django and web developing

2008-11-03 Thread David Zhou
o is that a lot of the older documentation and literature may no longer apply. The good news is that once you learn Django 1.0, there shouldn't be any future breaking changes for some time. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received

Re: ' Change History' for audit, compliance

2008-11-11 Thread David Zhou
e data , the old value and the new value etc > That's a debatable point, but it would be fairly easy to create a Change model, and either define save() methods or use pre/post save signals to populate changes so that you have a change hist

Re: Multithreaded Dev Server

2008-11-15 Thread David Zhou
the second > request just hangs until the file upload completes, preventing the > status update. Is there any way to make the dev server multi-threaded? It's probably easier to just use apache at that point. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---

Re: Multithreaded Dev Server

2008-11-15 Thread David Zhou
e one of the pure python servers out there. See: http://www.eflorenzano.com/blog/post/hosting-django-site-pure-python/ -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djang

Re: Best way for making a "Poll"?

2008-11-16 Thread David Zhou
topics/forms/#customizing-the-form-template -- --- 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-users@googlegroups.c

Re: cascading drop down lists

2008-11-16 Thread David Zhou
ev/ref/contrib/formtools/form-wizard/#django.contrib.formtools.wizard.FormWizard.process_step -- --- 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-users@googleg

Re: In forms, how add dynamic initial values out of reach for clients?

2008-11-16 Thread David Zhou
isitors/clients. > ... > How should i solve this? I've tried numerous ways but none of them > really worked. http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---

Re: avoid cascade delete

2008-11-16 Thread David Zhou
gt; How do I avoid the default behavior that does a cascade delete. Of > course I could use the cursor but would am hoping there is some option > I don't know of for delete(). Try using clear() prior to deleting: http://docs.djangoproject.com/en/dev/topics/db/queries/#following-relation

Re: avoid cascade delete

2008-11-16 Thread David Zhou
On Mon, Nov 17, 2008 at 2:34 AM, David Zhou <[EMAIL PROTECTED]> wrote: > On Mon, Nov 17, 2008 at 2:21 AM, Merrick <[EMAIL PROTECTED]> wrote: >> >> How do I avoid the default behavior that does a cascade delete. Of >> course I could use the cursor but would am

Re: avoid cascade delete

2008-11-17 Thread David Zhou
e. And, IMO, the vast majority of foreign key use cases do benefit from an auto cascading delete. For the specific Links/Groups example, personally I'd just do it with a many to many relation. It's entirely feasible that in the future, Links will need the ability to associ

Re: Passing values to template

2008-11-17 Thread David Zhou
is other > than mixing objects and dictionaries in the list? What about making it a list of tuples, and including a type? {'articles': [('single', ), ('multiple', {1: , 2: }), ('single', )]} Then you could just do a {% for type, article in articles %}, and

Re: Multiple types of output (HTML, JS), same view.

2008-11-18 Thread David Zhou
ibility is to give the decoration a "block" parameter, to render a specific block from a template. So you could have something like: @render_view('js', 'template.html', block='js_block') def view: pass -- --- David Zhou [EMAIL PROTECTED] --~--~

Re: Passing values to template

2008-11-18 Thread David Zhou
ist has different 'types' of renderings. My way put that logic into me template, but ideally, as Bruno said, each 'type' should be able to dispatch its own specific render. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You rec

Re: serving static file via django

2008-11-18 Thread David Zhou
of using > this view in a production env ? Have you considered using request/response signals? http://docs.djangoproject.com/en/dev/ref/signals/#module-django.core.signals -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this messa

Re: Show image (but not ImageField) in admin?

2008-11-18 Thread David Zhou
> CharField instead of ImageField, but then how do I go about showing it > inline? fieldsets.description doesn't allow anything but text. You can write your only readonly image widget, and apply it in the admin by specifying your own form: http://docs.djangoproject.com/en/dev/ref/contr

Re: serving static file via django

2008-11-18 Thread David Zhou
rack requests in Django in general, you may be able to do that by using a listening for a request finished signal, and doing something with it. What are you specifically trying to do by tracking which users requested the file? -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~---

Re: form issue

2008-11-18 Thread David Zhou
I'm getting the following error: > > global name 'form' is not defined > > > am I missing something? > > > -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &q

Re: serving static file via django

2008-11-18 Thread David Zhou
gt; made to this file. used in generating internal metric reports. I guess > i'll have to dig into the django code to see how signals are used..do > you know of any example where the request_finished signal is used ? > > thanks, > -p > > On Nov 18, 10:23 pm, "David Zho

Re: serving static file via django

2008-11-18 Thread David Zhou
it its ok inproduction env though.. Do you not know which pages the gif will live on? Why not grab visitor data in the views of the pages that use the transparent gif? -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because

Re: Why are models referenced without a capital letter in templates

2008-11-23 Thread David Zhou
s > first letter is automatically converted to lower case. > > Am I on the right lines here? If so, what happens if you declare your > classes with all lower case letters in models.py? > > > Thanks, > > > -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~-

Re: Why are models referenced without a capital letter in templates

2008-11-23 Thread David Zhou
and how they pass things to the template context. -- --- 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-users

Re: parameter not getting passed to view function

2008-11-24 Thread David Zhou
T" > > urls.py >(r'^hello/(?P)\S+/$', 'swamiji.poll.views.hello') Check your URL regexp and grouping. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups &

Re: Executing raw Python

2008-11-24 Thread David Zhou
t;> >> Thanks, >> Alex >> > >> > > > -- > Adi J. Sieker mobile: +49 - 178 - 88 5 88 13 > Freelance developer web:http://www.sieker.info/profile > SAP-Developer > > > > -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~--

Re: Injecting stuff to an existing list?

2008-11-25 Thread David Zhou
} for person {{person}} {% endfor %} Personally, if the current age of a person is something you'll be using often, I'd add it to the model. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Injecting stuff to an existing list?

2008-11-25 Thread David Zhou
On Tue, Nov 25, 2008 at 9:05 AM, Steve Holden <[EMAIL PROTECTED]> wrote: > > David Zhou wrote: >> On Tue, Nov 25, 2008 at 3:55 AM, sajal <[EMAIL PROTECTED]> wrote: > [...] >> >> Personally, if the current age of a person is something you'll be >>

Re: Does Django have a function that can be called by every view function ?

2008-11-30 Thread David Zhou
On Mon, Dec 1, 2008 at 2:23 AM, David Shieh <[EMAIL PROTECTED]> wrote: > I dont' know whether this make any sense . > Right now , I can't test it , but if django won't initiate the > views.py as a class , this method will make no sense. Why not write a dec

Re: printing from the admin?

2008-12-01 Thread David Zhou
it with a custom CSS file but I hope there is a simple way. > Is there? If you want the layout to be print optimized, the easiest way is going to be using some custom admin templates that use some custom CSS. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~

Re: how to create json from template?

2008-12-02 Thread David Zhou
On Wed, Dec 3, 2008 at 1:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > To trim last colon wrap it with if statement: > > {% if forloop.revcounter0 %},{% endif %} You can also do: {% if not forloop.last %},{% endif %} Which, IMO, is slightly more clear. --- David Zho

Re: cursors and raw sql

2008-12-04 Thread David Zhou
or? Assuming it's following standard Python database API practices, you can, if you want, but it's optional. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dja

Re: Django is changing my html!

2008-12-04 Thread David Zhou
ht, since you had the inside the . Fix the markup, and it'll be fine, doctype and all. -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. T

Re: Populating form from instance not working

2008-12-05 Thread David Zhou
djangoproject.com/en/dev/topics/forms/modelforms/ What does your form class look like? -- --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post

Re: Ruby on Rails vs Django

2008-12-05 Thread David Zhou
iffer much more than Python and Ruby. > There are "small" differences between Python and Ruby, but the core > philosophies and structures of Rails and Django on the other hand are > completely unrelated and pretty much incompatible. What do you think are the core philosophies of Rails and

Re:

2008-12-05 Thread David Zhou
them in a new tab or anything of that nature? -- --- 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-users@goog

Re: keep html

2008-12-07 Thread David Zhou
browsers have some such way to see the raw html > for a page.) Or am I misunderstanding your question? If the question is getting at the actual admin site templates, see: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates -- --- David Zhou [EMAIL PROTECTED]

Re: Do you recommend "Practical Django Projects"?

2009-01-05 Thread David Zhou
ems to me that "The Definitive Guide To Django" is more organized >> and covers a lot of materials. >> What do you think? > > As the author, I recommend waiting a couple months. Are you planning to update Practical Django Projects to 1.0? -- --- David Zhou da...@nodnod.n

Re: Do you recommend "Practical Django Projects"?

2009-01-05 Thread David Zhou
On Mon, Jan 5, 2009 at 3:57 AM, Kenneth Gonsalves wrote: > > On Monday 05 Jan 2009 2:10:34 pm David Zhou wrote: >> >> and covers a lot of materials. >> >> What do you think? >> > >> > As the author, I recommend waiting a couple months. >> &

Re: Django too slow

2009-01-07 Thread David Zhou
o avoid so that it becomes faster First thing you need to do is figure out where the slowness originates. Is it from DB access? XML generation? If it's from DB access, include the code you're using to fetch data. If XML generation, likewise. -- --- Da

Re: why 'No module named safestring'?

2009-01-11 Thread David Zhou
.com/browser/django/tags/releases/0.96/django/utils -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ 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@googlegro

Re: Templates Cant find the CSS file

2009-01-12 Thread David Zhou
re? See: http://docs.djangoproject.com/en/dev/howto/static-files/ And if you're using mod_python, also see: http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#serving-media-files -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ You r

Re: newforms library.

2009-01-12 Thread David Zhou
> original forms and allow for easier migration. seki, this is why it's always been recommended to do "import newforms as forms", since that allowed easier migration when newforms was renamed and replaced forms. -- --- David Zhou da...@nodnod.net --~--~-~--~~---

Re: CSS is not updated?

2009-01-12 Thread David Zhou
hen I spend an inordinate amount of time wondering why my changes aren't working when I was editing the wrong copy of the file the entire time. -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ You received this message because you are subscribed t

Re: overriding Model.save(), do I need to override Model.create() also?

2009-01-12 Thread David Zhou
t's considered best practice. -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ 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.

Re: new django user - no images appear on my site :(

2009-01-12 Thread David Zhou
et a Django error? If so, what is it? -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ 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.

Re: django 0.96 cancel template render automatically escape?

2009-01-12 Thread David Zhou
autoescaping later on. What you put in your template is what you got. -- --- David Zhou da...@nodnod.net --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: Django has "save_model", but what about "delete_model"?

2008-08-19 Thread David Zhou
ngoproject.com/browser/django/trunk/django/contrib/admin/options.py?rev=8266#L404 --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: Django has "save_model", but what about "delete_model"?

2008-08-19 Thread David Zhou
On Aug 19, 2008, at 1:02 PM, David Zhou wrote: > > On Aug 19, 2008, at 12:48 PM, Huuuze wrote: > >> The latest Django beta added this method to the admin models: >> >>>> save_model(self, request, obj, form, change) >> >> I have a business case where

Re: override model.save - prevent saving (admin)

2008-08-22 Thread David Zhou
entation/admin/#adding-custom-validation-to-the-admin --- 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-use

Re: Hosting with support for Satchmo webstore

2008-08-25 Thread David Zhou
on: http://brianmckinney.net/blog/2007/aug/22/installing-satchmo-webfaction/ --- 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

Re: Making Custom Model Methods to Work

2008-08-25 Thread David Zhou
ting}), what are these two things opposite of the > colon? That's a Python dictionary, with 'my_meeting' as the key, and the my_meeting object as the value. See: http://docs.python.org/dev/tutorial/datastructures.html#dictionaries --- David Zhou [EMAIL PROTECTED] --~--~--

Re: Inherited models in new forms admin

2008-08-26 Thread David Zhou
hat sounds acceptable for one > table, but now add a few more subclasses and give them a few > subclasses > of their own and it rapidly becomes horribly inefficient without > trying > very hard). Would it work if a ModelAdmin defined its own queryset() method that app

Re: site using Django/mod_python/apache2 randomly showing "It worked!" page

2008-08-27 Thread David Zhou
xpected page is shown. The remaining 1/10 > times the "It worked!" page pops up. Searching for this problem seems > a bit difficult. Any idea on what could be happening? Did you restart the server after making your changes? ---

Re: How to handle platform dependent settings?

2008-08-27 Thread David Zhou
anage that in my SVN repository. ... > Is there a better way? Does this cause a performance hit, or is > settings.py and urls.py processed only once? If it's mostly paths that you need to change, check out: http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/

Re: Storing some media files on web server and some on external a/v server

2008-08-28 Thread David Zhou
ct.com/en/dev/ref/models/fields/#django.db.models.FileField Then you can write your own method that returns the proper path. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Dj

Re: Dictionary key-value pair

2008-08-28 Thread David Zhou
s there any other way to render > bunch of key-value items from a view in a desired order? Thanks for > help What are you trying to do, specifically? If order is important, why bother with a key? Why not just store all the values in a list? --- Davi

Re: request: auth_user User model, not enough characters in email

2008-08-28 Thread David Zhou
ess. If you have a recent version from trunk, you should be able to define your own length via max_length: http://docs.djangoproject.com/en/dev/ref/models/fields/#emailfield --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this messag

Re: Dictionary key-value pair

2008-08-28 Thread David Zhou
#x27;phone': 723872, 'Total Friends': 20, 'Avg Rating' : > 3.6} > so when I render I would these to appear in order. Can you post the relevant view and template code? But if it's just those fields, why not refer to them explicitly? Such as: {{dict_variabe.nam

Re: Dictionary key-value pair

2008-08-28 Thread David Zhou
other tables. Following will give you an idea of > what I am trying to do. Thanks Since it looks like you're basically using the dictionary like a list of tuples, why not make it a list of tuples? It should preserve ordering too, that way. --- David Z

Re: CSS error in change_password.html

2008-09-01 Thread David Zhou
t. or something similar. I think you should open a ticket for it. But an easier way to do it is to just use clearfix: --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "

Re: problem with passing dict object to django template

2008-09-02 Thread David Zhou
On Sep 2, 2008, at 1:34 PM, Matt Berg wrote: > In my template, I want to be able to iterate through the crops with > info like this: > > {{ ci.[crop.id].total }} Are you using this within another loop? Where's crop.id coming from? --- David Zhou

Re: django web hosting

2008-09-02 Thread David Zhou
I've had pretty good experiences with WebFction. David Sent from my iPhone On Sep 2, 2008, at 7:30 PM, Ed Wong <[EMAIL PROTECTED]> wrote: > > hi all, > > i am looking for a good web host for my django website. does anyone > suggest a good host? thanks. > > > --~--~-~--~~

Re: django web hosting

2008-09-02 Thread David Zhou
am looking for a good web host for my django website. does anyone > suggest a good host? thanks. > > > > > > -- > Nikos Delibaltadakis > > > --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message bec

Re: How to display Html in my screen

2008-09-02 Thread David Zhou
t? Django autoescapes. See: http://docs.djangoproject.com/en/dev/topics/templates/#how-to-turn-it-off --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" gro

MediaTemple Django Containers

2008-09-04 Thread David Zhou
Are now available according to their homepage: http://mediatemple.net/webhosting/gs/django.html Was anyone in the beta? I've not used them, so I'm wondering what the experience was like. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ Yo

Re: Introducing django-cms

2008-09-08 Thread David Zhou
e set up which allows you to play around with the admin > interface. > > The software is still in development and we would appreciate any > feedback and contributions. > > Greetings from Switzerland, > > Thomas Stei

Re: disable delete checkbox in Inline formset

2008-09-08 Thread David Zhou
viously I can > disable the "Can delete" permission, but the ugly box is still there. Have you tried editing the admin templates to not show the checkbox? --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are

Re: Double Slash in URL

2008-09-08 Thread David Zhou
t is to allow variable amounts of slashes -- like: (r'^test/+$', 'modwork.views.test.index'), --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django use

Re: disable delete checkbox in Inline formset

2008-09-08 Thread David Zhou
On Sep 8, 2008, at 2:55 PM, Kurczak wrote: > On 8 Wrz, 20:37, David Zhou <[EMAIL PROTECTED]> wrote: >> On Sep 8, 2008, at 2:30 PM, Kurczak wrote: >> >>> Is there any way to disable/remove the delete checkbox for inline >>> formsets ( in admin) ? >

Re: Internal server error upgarding from 0.97 to 1.0

2008-09-09 Thread David Zhou
gednewforms-adminintotrunk Specifically, the "Changed prepopulate_from to be defined in the Admin class, not database field classes" section. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribe

Re: Restricting views

2008-09-11 Thread David Zhou
d permissions. I usually do so anyway, in case I need to change how permission works in the future. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Running into errors using S3 backend for Django

2008-09-14 Thread David Zhou
n't support absolute paths. Sounds like you just need to define that method for the S3 backend. It's falling back on the base method that spits out the exception. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this messa

Re: Recommendations for local web dev on Mac OS X 10.5 vs. developing against WebFaction Linux box

2008-09-15 Thread David Zhou
, if you're used to VIM at all, MacVim (http://code.google.com/p/macvim/) is pretty awesome. --- David Zhou [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To p

Re: actual django stack

2008-09-26 Thread David Zhou
ation stuff or additional security > hardening. This will probably be the case for many teams since Nginx > is so new. I've also heard good things about WSGI -- though I haven't heavily tested its stability compared to, say, mod_python. --- David Zhou [EMAIL PROTECTED] --~--~

Re: Cannot serve static files

2009-01-22 Thread David Zhou
On Thu, Jan 22, 2009 at 10:53 AM, john wrote: > > No matter what i do i can't get my css to load. 100% Frustrated with > Django. My index page loads when i request http://127.0.0.1:8000/ but > it is not styled. Django dev server returns 404 in console for "GET / > css/styles.css HTTP/1.1" Try do

Modifying pythonpath in settings.py

2009-02-18 Thread David Zhou
I've been doing the following for a while, but I'm not sure if it has unintended side effects: #settings.py import os, sys sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'apps')) I keep pluggable apps in an svn repo, and do checkouts of the ones I need in the apps folde

Re: Modifying pythonpath in settings.py

2009-02-18 Thread David Zhou
b 19, 2009 at 12:10 AM, David Zhou wrote: > I've been doing the following for a while, but I'm not sure if it has > unintended side effects: > > #settings.py > import os, sys > sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), > 'apps'

Removing fields in a form subclass

2009-02-20 Thread David Zhou
Suppose I had this form: class BaseForm(forms.Form): field1 = forms.CharField(...) field2 = forms.Charfield(...) And then in a subclass, I had: class SubForm(BaseForm): field1 = forms.EmailField(...) What's a good way to remove field2 in SubForm? Setting field2 = None didn't work.

Re: Removing fields in a form subclass

2009-02-20 Thread David Zhou
Do you mean del self.fields['field2'] in SubForm's __init__? -- dz On Fri, Feb 20, 2009 at 10:39 AM, Alex Koshelev wrote: > Try this: > > del SubForm.fields['fields2'] > > > On Fri, Feb 20, 2009 at 6:15 PM, David Zhou wrote: >> >> S

Re: Removing fields in a form subclass

2009-02-20 Thread David Zhou
(BaseForm): > field1 = forms.EmailField(...) > > del SubForm.base_fields['fields2'] > > On Fri, Feb 20, 2009 at 6:45 PM, Alex Koshelev wrote: >> >> No. Place this code right after the SubForm definition. >> >> On Fri, Feb 20, 2009 at 6:42 PM, David Zho

Re: Removing fields in a form subclass

2009-02-20 Thread David Zhou
edinnick wrote: > > On Fri, 2009-02-20 at 10:15 -0500, David Zhou wrote: >> Suppose I had this form: >> >> class BaseForm(forms.Form): >> field1 = forms.CharField(...) >> field2 = forms.Charfield(...) >> >> And then in a subclass, I had:

Re: Why won't my form validate?

2009-03-24 Thread David Zhou
If it's not valid, then something likely threw a validation error. What does the error say? -- dz On Tue, Mar 24, 2009 at 3:11 PM, Theme Park Photo, LLC wrote: > > It has data! It was created from an existing instance...and all the > fields have values > > 'body': u'hello there', 'allow_comme

Re: Why won't my form validate?

2009-03-24 Thread David Zhou
ting a ModelForm from an existing > instance would give it valid data, but that's not the case. (Though > the Django Documentation doesn't say this: > http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ ) > > > On Mar 24, 12:15 pm, David Zhou wrote: >> If it&#

Re: marrying django to twitter

2009-06-30 Thread David Zhou
On Tue, Jun 30, 2009 at 11:21 PM, Kenneth Gonsalves wrote: > > has anyone succeeded in marrying django to twitter - that is broadcasting > updates in the django db to twitter? I did see one post on the subject in the > archives, but there was no information as to whether the operation was > succe

Re: How to get rid of the 'u'? Seems to be everyhere :)

2009-08-08 Thread David Zhou
See: http://diveintopython.org/xml_processing/unicode.html -- dz On Sat, Aug 8, 2009 at 11:27 PM, Joshua Partogi wrote: > u' stands for Python unicode. > > On Sun, Aug 9, 2009 at 12:03 PM, strotos wrote: >> >> Hey all, >> >> I am very new to Django and am having a bit of trouble with somethi

Re: logic in templates

2009-08-12 Thread David Zhou
The easiest way is probably moving that list to the view. For example customers = Customer.objects... sellers = Seller.objects... filtered_list = [pair for pair in zip(sellers, customers) if pair[0].customer_id == pair[1].id] Then pass filtered_list into the template context. Inside the templ

Re: digg style pagination

2009-08-14 Thread David Zhou
http://tinyurl.com/mj29fw -- dz On Fri, Aug 14, 2009 at 2:54 PM, sniper wrote: > > I am trying to do pagination. Just wanted to know if there is a > shortcut to show digg style pagination or i have to write my own? > I am asking this because in the admin page, the list page uses digg > style p

Re: Using glovar vars

2009-08-17 Thread David Zhou
For what you describe, you're not looking for "global" variables in the sense that you want some value persisted in the same process. You're looking at session variables, which are variables persisted for a specific user session. See: http://docs.djangoproject.com/en/dev/topics/http/sessions/ H

Re: django template language issue

2009-08-17 Thread David Zhou
On Mon, Aug 17, 2009 at 6:39 AM, Adonis wrote: > My problem is that even if the 'projects' queryset is empty, it still > includes the projects.html > Is there another way to do it? If you're using at least Django 1.1, you can use the empty tag: http://docs.djangoproject.com/en/dev/ref/templates

Re: a bit like permission, but...

2009-08-21 Thread David Zhou
On Aug 21, 2009, at 9:54 AM, MIL wrote: > this works fine but I dont want to repeat it in all my views: > def my_profile(request): > gotta_go_through = request.user.get_profile > ().gotta_go_through_this_url() > if gotta_go_through and gotta_go_through != request.path: >

Re: How I can add new functionality in homepage of admin site??

2009-08-24 Thread David Zhou
On Mon, Aug 24, 2009 at 3:29 PM, sandravigo wrote: > > Hi, friends. I have a problem. > I created a function (main) that displays a list on the first page > (index.html) of site administration. The problem is that for example, > if I put in URLConf: (r '^ admin /(.*)',' myproject.views.main '), >

Re: Django scalability with files

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 6:13 AM, Lewis Taylor wrote: > > I have an imagefield that i want to create a thumbnail for on approval > of the image. The problem is (setup is 2 django instances, load > balancer and DB) if the image is stored on one machine it's not the > cleanest solution to have to get

Re: How to check which form was submitted?

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:09 AM, Maksymus007 wrote: > > I've got two different form on the same page, under the same URL. > When I send one of them, the second one gets validated too. > I set prefixes but no change. > > Is there any way to distinguish between two forms, choosing one that > have be

Re: get an object's model name

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:08 AM, Léon Dignòn wrote: > from django.contrib.auth.models import User u = User.objects.get(id=1) u > print u > leon type(u) > Alternatively: >>> u.__class__.__name__ 'User' -- dz --~--~-~--~~~---~--~~ You re

Re: redirect in django

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 6:58 AM, Matthias Kestenholz wrote: > >> On Thu, Aug 27, 2009 at 2:59 PM, ankit wrote: >>> >>> I am new to django.I having to app in my admin.Know I want to know >>> that how can i redirect user to one app listpage if clicks save on >>> second app.say from app2 to app1 >>>

Re: How to check which form was submitted?

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 7:33 AM, Maksymus007 wrote: > > On Thu, Aug 27, 2009 at 1:22 PM, David Zhou wrote: >> Post the part of your view that handles your forms. > > Nothing special > >    if request.method == 'POST': >        form = RegisterForm(re

Re: Problem building data structure for Archive page

2009-08-27 Thread David Zhou
On Thu, Aug 27, 2009 at 10:10 AM, gnijholt wrote: > Or is there a better way to generate a full archive page (per year, > per month)? You'll need to test this, but you should be able to do that with {% ifchanged %}: #view: posts = Posts.objects.order_by('-pub_date') #template {% for post in po

Re: Avoiding Accidental Overwrite In Admin Interface

2009-03-25 Thread David Zhou
It shouldn't be too hard to add a last-updated timestamp to a model, and compare it to a hidden field in the form validation. -- dz On Wed, Mar 25, 2009 at 11:49 AM, Daniel Watkins wrote: > > Hello all, > > We recently ran into an issue when two people were editing a record via > the admin in

Re: Design Issue / forward referencing

2009-03-28 Thread David Zhou
Also see: http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ManyToManyField.symmetrical -- dz On Sat, Mar 28, 2009 at 11:57 AM, Alex Gaynor wrote: > > > On Sat, Mar 28, 2009 at 10:55 AM, mahesh wrote: >> >> I am working on a (College) course manager project. Here is a

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

2009-03-29 Thread David Zhou
On Sun, Mar 29, 2009 at 7:14 PM, IanR wrote: > I'm trying to stay a close to the suggested Django conventions as > possible.  I have a few variables that I need to render any page. Check out context processors: http://docs.djangoproject.com/en/dev/ref/templates/api/#writing-your-own-context-pro

Re: What hash algorithm does django auth use?

2009-03-29 Thread David Zhou
On Sun, Mar 29, 2009 at 9:50 PM, Joshua Partogi wrote: > > I thought we're to use hexdigest ? > > Did I miss something here? You need to salt it: http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/models.py#L20 -- dz --~--~-~--~~~---~--~~ Yo

  1   2   >