Re: Markdown Encoding Problem

2009-06-02 Thread Waylan Limberg



On Jun 1, 7:11 pm, Karen Tracey <kmtra...@gmail.com> wrote:
>
> That comment, specifically, includes the same exception and traceback as you
> are showing. I read subsequent discussion in the ticket to be saying that
> the problem here is the markdown version, it's some pre-Unicode support
> level that you likely don't want to be using if you need proper Unicode
> support.  Apparently some bits may work (that comment shows passing Unicode
> working whereas passing a utf-8 encoded bytestring of the same content
> fails), but the comments from a markdown core dev indicate any semblance of
> "working" here is likely accidental.  Sounds like the easiest fix for you
> may be to upgrade your markdown to at least 1.7.

Karen nailed it. If your are using anything prior to Markdown 1.7
upgrade immediately (the 1.6 series was horribly buggy). Actually,
Markdown is currently at version 2.0.1 [1]. With 2.0 we've made a
number of improvements in a number of ways. However, one thing we are
dedicated to keeping the same is that since 1.7, Markdown will only
ever accept unicode text as input - nothing else. That has been a
tremendous help in eliminating these kinds of problems.

[1]: http://pypi.python.org/pypi/Markdown

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



Re: Aggregating Ignores Slicing?

2009-03-04 Thread Waylan Limberg

On Mar 3, 8:55 am, Ross  wrote:
> I have started using aggregation, but it seems to ignore any slicing I
> do on a QuerySet before calling aggregate. This is what I'm doing:
>
> Product.objects.order_by("-price")[:100].values("price").aggregate(Max
> ("price"), Min("price"))
>
> I want the maximum and minimum price for the products with the top 100
> largest prices. The aggregate function, however, returns the maximum
> and minimum price for all Products--it ignores the [:100] slice.
>

You do realize that because your ordering by "price" your min and max
will be the first and last items in the returned QuerySet, don't you?
So something like:

>>> qs = Product.objects.order_by("-price")[:100]
>>> max = qs.values("price")[0]
>>> min = qs.values("price")[-1]

The above is untested, but you should get the idea. Yeah, it would
seem that aggregation would be nice for this, but if this works...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Deploying multiple sites on one computer using SSL

2007-03-21 Thread Waylan Limberg

On Wed, 21 Mar 2007 18:19:21 -0400, Dan Goldner <[EMAIL PROTECTED]>  
wrote:

[snip]
>
> httpd.conf:
>
> 
>   ServerName projects.mycompany.com
>   SetHandler python-program
>   PythonInterpPerDirective On
>
>   # Turn Off for production, On for dev:
>   PythonAutoReload On
>   PythonDebug On
>
>   
>   PythonHandler django.core.handlers.modpython
>   PythonPath "['/usr/local/projects', '/usr/local/projects/
> project1']+sys.path"
>   SetEnv DJANGO_SETTINGS_MODULE project1.settings_prod
>   
>   
>   PythonHandler django.core.handlers.modpython
>   PythonPath "['/usr/local/projects', '/usr/local/projects/
> project2']+sys.path"
>   SetEnv DJANGO_SETTINGS_MODULE project2.settings_prod
>   
>   
>   SetHandler None
>   
>
>   [... SSL stuff ...]
>
> 
>
> Any ideas or pointers to help?
> Many Thanks!
>
I may be off track, but I'd try adding a  directive for each  
static dir:


 SetHandler None

 SetHandler None
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms and output of required fields

2007-03-20 Thread Waylan Limberg

On Sat, 17 Mar 2007 17:02:43 -0400, Andreas Ahlenstorf  
<[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> I'm playing around with newforms and I like to give the labels of my
> required fields a special styling using CSS. For that I need a class
> attribute in every label. But until now I wasn't able to figure out
> how to do it.
>
> Setting a field as required doesn't give me a 'required' class or
> something like that when using the built-in functions for form
> rendering (like as_p()). Passing an additional attribute to the
> widget works only with the field itself. So, what does I need to do
> get a custom class on all labels of my required fields?
>
> - A.
>

Ticket #3512 addresses this issue. I'd suggest trying the latest patch  
just uploaded the other day.

http://code.djangoproject.com/ticket/3512


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



Re: A custom label on a newforms Field doesn't get passed trought pretty_name

2007-03-19 Thread Waylan Limberg

On Mon, 19 Mar 2007 12:47:23 -0400, Michel Thadeu Sabchuk  
<[EMAIL PROTECTED]> wrote:

>
> Hi guys,
>
> If I have a form defined on newforms as:
>
> class MyForm(forms.Form):
>  field1 = forms.CharField(max_length=100)
>  field2 = forms.Charfield(max_length=100, label='custom field')
>
> When I render the field, the label for field1 get his first character
> uppercased and becomes "Field1", the label for field2 was set by the
> label keyword and this value doesn't get passed through pretty_name
> function and keeps "custom field" (without the first letter
> uppercase).
>
> I couldn't figure out if this is a bug or a design decision.
> I it is a bug I can fix and send a patch.
> Is it a bug?
>

That is by design. A custom label is just that. If you wnat your label in  
all lowercase, then that is possable. Whatever you type in your code is  
exactly how it will appear. That is complete customization. Pretty-name is  
just a shortcut for lazy programmers (we all are) when the default  
behavior is good enough.



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



Re: python 2.4 v 2.5 and DJANGO_SETTINGS_MODULE

2007-02-19 Thread Waylan Limberg

On Mon, 19 Feb 2007 15:58:37 -0500, Veloz <[EMAIL PROTECTED]> wrote:

>
> Hi there
>
> A couple weeks back I evaluated Django under Python 2.4. I followed
> the installation instructions and all went well.
>
> Recently we upgraded from python 2.4 on the server to python 2.5, and
> at that point, my Django stopped working.
>
> (The 2.4 version of Python came either installed with Fedora Core 4,
> or perhaps via yum at a later time. 2.5 was put on there by me by
> doing the configure/make/install cycle this morning)
>
> I assumed the problem was because Django had been installed into the
> site-packages of my 2.4 python installation (which is in /usr/lib) and
> now my newest python is running out out of /usr/local/lib) and its
> site-package directory does not contain Django. (I'm guessing that was
> the problem)
>
> Anyway, so I used svn to download Django into my python 2.5 directory,
> but now when I run django-admin.py its complaining about not finding
> the DJANGO_SETTINGS_MODULE env variable. I read up on this and am
> confused because:
>
> 1. Why did I not get this error before when I tried Django under 2.4
> (was there something that was automatically configured for me with
> regard to DJANGO_SETTINGS_MODULE that is no longer automatically set
> now that I'm using a compiled version of Python?)

I don't why, as I don't know exactly what you did different this time (but  
neither do you or you wouldn't be asking). Generally, I only use  
django-admin.py to start a new project. Once the basic directory structure  
is created, I cd into that dir and use manage.py which will automatically  
configure the DJANGO_SETTINGS_MODULE to settings.py in the current  
directory. Perhaps that's what you did before. In case you don't know,  
manage.py is basically a wrapper around django-admin.py that takes care of  
the settings for you, so you can use it the same way minus the headaches  
of setting the DJANGO_SETTINGS_MODULE. Type `manage.py help` for a full  
list of commands.
>
> 2. I'm a bit confused about the purpose and use of
> DJANGO_SETTINGS_MODULE (I have read the docs). If you host multiple
> sites, how can you tell Django about all their configuration files
> with just one environment variable? I must be missing the boat here.

The trick is that environment variables are loaded when a python session  
starts. Within that python session you can make any changes you want to  
the environment variables without those changes rolling back to the actual  
OS environment. Therefore, the first thing manage.py does, for example, is  
set `os.environ['DJANGO_SETTINGS_MODULE']` to settings.py of the current  
working directory. As mod_python and fcgi (the most common ways to deploy  
django) both load django as a long running process (simply stated), that  
setting is preserved within that project only. For example, mod_python has  
a `SetEnv` directive where the DJANGO_SETTINGS_MODULE` can be defined for  
a specific project. For more, I suggest reading the docs[1].

[1]: http://www.djangoproject.com/documentation/settings/

>
> Any input related to the above topics would be greatly appreciated. At
> this point my progress on my project has come to a screeching halt.
>
> Thanks!
> Michael
>
>
> >



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



Re: SCGIMount != '/'

2007-02-13 Thread Waylan Limberg

On Tue, 13 Feb 2007 17:41:16 -0500, mulc <[EMAIL PROTECTED]> wrote:

>
>
> OK.
>
> I hacked django/core/handlers/wsgi.py. ( line #56 )
>
> In the __init__ function of  WSGIRequest I changed:
>
>   self.path = environ['PATH_INFO']
>
>   to
>
>   self.path = environ['REQUEST_URI']
>
>   I then changed up my urls.py
>
>  (r'^admin/', include('django.contrib.admin.urls')),
>
> becomes
>
>  (r'/admin/?', include('django.contrib.admin.urls')),
>
> This appears to do what I want.
>
> No obvious breakage yet, but I haven't really done anything other than
> tool through the admin interface at /SCGI/admin
>
Well, that would also match the following urls (which you wouldn't want):

/foo/admin/
/foo/bar/admin/
/foo/admin/bar/

Sure, it's not likely that you'll have 'admin' in a lot of urls, but I  
think that illustrates the problem. You need to be able to match from the  
front of the url. If I recall correctly, 'REQUEST_URI' includes the  
proctal and domain and I wouldn't want to include that in every regex  
expression.



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



Re: Directory structure

2007-02-12 Thread Waylan Limberg

On Mon, 12 Feb 2007 23:19:19 -0500, kbochert <[EMAIL PROTECTED]> wrote:

>
>> From the tutorial I see that a project directory looks like:
>
> Project
>   App
> models.py
> views.py
>   Templates
> App
>   index.htm
> Admin
>
> Doesn't it make more sense to have:
>
> Project
>   App
> models.py
> views.py
> Templates
>   index.htm
>   Admin
> Templates
>
> Doesn't it work better if the project has multiple apps?
>
> Templates are found at Project\App\Templates,  instead of Project
> \Templates\App
> Do templates 'belong' to the App or the Project?
>
> Given that an App consists of models, views and templates, shouldn't
> models, views and templates be at the same level?
>
> I could do this myself using urls.py and settings.py, but isn't admin
> hardwired?
>
You can do it either way, but the suggested way works better when you have  
multiple apps which share the same layout and who's templates all inherit  
 from the same base template. Add on top of that the fact that (in a large  
team) you have designers working on the templates (but never looking at  
python code) and developers working on the code (but never looking at the  
templates), that approach makes even more sense. Take a look at the source  
for djangoproject.com [1] and you'll see what I mean. Of course, if each  
app is completely independent of each other, it's not such a big deal,  
especially if the developer/designer is one person. That's why you can use  
the settings to set it up however you want. Do what works for you.

[1]: http://code.djangoproject.com/browser/djangoproject.com/django_website



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



Re: Newforms: Can I do these?

2007-02-11 Thread Waylan Limberg

On Sun, 11 Feb 2007 17:43:44 -0500, johnny <[EMAIL PROTECTED]> wrote:

>
> Can I create the following in newforms:
>
> forms.DateTimeField

yes

> forms.IntegerField

yes

> forms.FloatField

yes

> forms.TextField

try forms.CharField

> forms.LargeTextField

Not directly, but you can assign the Textarea widget to a CharField like  
so:

 foo = forms.CharField(widget = forms.Textarea())

For a list of all the fields available see the tests [1] starting about  
line 775.

[1]:  
http://code.djangoproject.com/browser/django/trunk/tests/regressiontests/forms/tests.py#L775

>
>
> >


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: changing maxlength html attribute

2007-02-09 Thread Waylan Limberg

On 2/9/07, Kai Kuehne <[EMAIL PROTECTED]> wrote:
>
> Btw, why is it called maxlength and in newforms
> max_length (or the other way around, not sure)?
> Shouldn't they be identcal?
>
maxlength is the old way and on the way out. My understanding is that
it will be replaced with max_length everywhere when oldforms are
dropped. As it'll be a backward-incompatible change it won't happen
until after 0.96 though.


-- 

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



Re: Use a simple query string.

2007-02-05 Thread Waylan Limberg

On 2/5/07, Waylan Limberg <[EMAIL PROTECTED]> wrote:
> On 2/4/07, Jason <[EMAIL PROTECTED]> wrote:
> >
> > Can anyone help with my super simple query string problem
> >
> > I'm simply trying to get www.mysite.com/uptodate?build=123 parsed. The
> > problem is I can't get any URL to match (I keep getting 404 - page not
> > found).
> >
> >
> > My URL:
> >
> > (r'^uptodate(?P\d+)/$)', prog.main.uptodate'),
> >
> > My View:
> >
> > def uptodate(request, build='123'):
> >
> >
> You only match the url, not the query string in urls.py:
>
>(r'^uptodate'),

Sorry, that should be:

(r'^uptodate', prog.main.uptodate'),

>
> Them in your view you access the query through request.GET
>
> def uptodate(request):
> if request.method == 'GET':
> build = request.GET.get('build', '123')
>
> You could also just do:
>
> build = request.get['build']
>
> But by using get() you can set a default and catch any failures if
> 'build' is missing - works the same as a Dict.
>
> --
> 
> Waylan Limberg
> [EMAIL PROTECTED]
>


-- 

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



Re: Use a simple query string.

2007-02-05 Thread Waylan Limberg

On 2/4/07, Jason <[EMAIL PROTECTED]> wrote:
>
> Can anyone help with my super simple query string problem
>
> I'm simply trying to get www.mysite.com/uptodate?build=123 parsed. The
> problem is I can't get any URL to match (I keep getting 404 - page not
> found).
>
>
> My URL:
>
> (r'^uptodate(?P\d+)/$)', prog.main.uptodate'),
>
> My View:
>
> def uptodate(request, build='123'):
>
>
You only match the url, not the query string in urls.py:

(r'^uptodate'),

Them in your view you access the query through request.GET

def uptodate(request):
if request.method == 'GET':
build = request.GET.get('build', '123')

You could also just do:

build = request.get['build']

But by using get() you can set a default and catch any failures if
'build' is missing - works the same as a Dict.

-- 

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



Re: textarea - autoamtic line break

2007-02-02 Thread Waylan Limberg

On 2/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> The reason for my question is following:
>
> i would like to use a textarea which size is fix (rows/cols).
> The text who everybody write into, should not be longer as the given
> size of area.
> So...if the line ends, the text should break automaticly in the next
> line.
> And this line break should allready exist in text which i set to
> database.

Ahh, that would be a browser feature as you're talking about the
behavior of the textarea in the browser. From the server we don't have
any control over what the browser does (and different browsers may act
differently), except, of course, with javascript. Perhaps you could
write some javascript to get the browser to behave as you want. But
remember that some users may have javascript turned off. And CSS isn't
going to work in a textarea for linebreaks - well, it may cause the
data to display correctly, but it won't alter the submitted data.

So the only real solution is to accept the data in whatever format it
comes, validate it (and possibly reformat it) on the server before
saving to the db. I'd suggest overriding the save method and using the
textwrap module to reformat the text before saving.

>
>
> On 2 Feb., 12:25, Kenneth Gonsalves <[EMAIL PROTECTED]> wrote:
> > On 02-Feb-07, at 4:26 PM, Simon Brunning wrote:
> >
> > >> field's value on the server side, post-submittal. I do that with one
> > >> of my own forms (in order to fit the text in a box in a pdf).
> >
> > > Why write your own?
> >
> > > <http://docs.python.org/lib/module-textwrap.html>
> >
> > hey cool - just what i wanted at the instant i wanted it
> >
> > --
> >
> > regards
> > kghttp://lawgon.livejournal.comhttp://nrcfosshelpline.in/web/
>
>
> >
>


-- 

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



Re: Validation discrepancies between admin and newforms

2007-01-31 Thread Waylan Limberg

The admin app is currently being rebuilt to use newforms. No doubt
this, plus many similar issues are being addressed there. Watch the
dev list for discussions and check out the branch here:
http://code.djangoproject.com/browser/django/branches/newforms-admin

On 1/31/07, Kilian CAVALOTTI <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I just noticed that fields validation occurs at several places, in a
> incoherent fashion: in the admin application, and in newforms/fields.py.
> For instance, a PhoneNumberField has to be XXX-XXX- in the admin,
> while it is handled as an IntegerField in newforms (thus validation fails
> on dashes).
>
> Shouldn't the validation be centralized and occur only in one place? Or is
> this a wanted behaviour, since the admin is a contributed app, and not
> part of django core?
>
> Thanks,
> --
> Kilian
>
> >
>


-- 

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



Re: newbie strange behavior

2007-01-26 Thread Waylan Limberg

On 1/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> I am new to Python web development, but not web development in general.
>  I have installed mod_python 3.2.10 alongside my currently running
> Apache 2.0.59.  All is working fine, but one thing.  I am currently
> building a Django application and I have no problems making it.
> However, I'll edit a file to tweak some stuff and upload the changes.
> It seems somewhere in the request the code is getting cached.  So I
> have reload the page a couple times before I can get the current code
> on the filesystem.  And it will continue to cycle through old revisions
> of the code.  Is this a problem with mod_python, python, or django?  I
> don't have any caching modules installed for Apache.  Any ideas?
>
>
Are you restarting apache after each change?

If your just using the server for development then you can add
MaxRequestsPerChild 1 to your config file to force Apache to reload
everything for each request. Just don't do that on a production
server.


-- 

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



Re: Shell question (simple)

2007-01-25 Thread Waylan Limberg

On 1/25/07, Jeremy Dunck <[EMAIL PROTECTED]> wrote:
>
[snip]
>
> An object's behavior is determined both by its state (the
> self.__dict__ attribute) and its class (the self.__class__ attribute).
>
> reload() doesn't go change the __class__ of all the objects which were
> created before reload was called.
>

True, but using the up-arrow in the shell will recreate the objects
with the reloaded module without any extra typing. The trick is to
import the module, not the objects in the module. Sometimes this
requires a little extra typing the first time around. Using Toms'
example:

from whatever import models# import module `models` here
site = models.Site.objects.all()[0] # note use of `models.Site`
site.gsearch("fields")
# review output and make changes to code
reload(models)

#up-arrow three times, then enter
#up-arrow three times, then enter
# review output and make changes to code
#up-arrow three times, then enter
#repeat...

Sure beats closing the shell, reopening and retyping everything. Just
remember to do it right the first time around. When things get more
complex that this, I'll write up a sample script that prints out the
results and just rerun it after editing. That's generally easier in
the long run, especially if I want to make some changes to the test
code.

-- 

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



Re: video uploads (like you tube)

2007-01-24 Thread Waylan Limberg

On 1/24/07, carlwenrich <[EMAIL PROTECTED]> wrote:
>
> Is there a quick and easy way for users to upload videos the way they
> do it on you tube? Is there an example django site that has this
> capability?
>
This should get you started:
http://blog.go4teams.com/archives/video-blogging-using-django-and-flashtm-video-flv/56

-- 

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



Re: a password field?

2007-01-24 Thread Waylan Limberg

Whoops, sent that too soon.

On 1/24/07, Waylan Limberg <[EMAIL PROTECTED]> wrote:
> On 1/24/07, medhat <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > Ok, here is a question for anybody who might have a quick answer (since
> > I can't find it in the documentation, and am too lazy to try to find it
> > in the code :-))
> >
> > Is there an eazy way to add a password field (similar to the one in the
> > User model) in my model? What I need is a field that I can compare some
> > value to without storing the clear-text value in the field. (of course
> > using the User model itself is not an option in my case, otherwise I
> > would have not asked the question.)
> >
Well, if your using newforms, you want the `PasswordInput` widget. So:

password = forms.CharField(widget=forms.PasswordInput)

of course, that translates into:





-- 

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



Re: a password field?

2007-01-24 Thread Waylan Limberg

On 1/24/07, medhat <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> Ok, here is a question for anybody who might have a quick answer (since
> I can't find it in the documentation, and am too lazy to try to find it
> in the code :-))
>
> Is there an eazy way to add a password field (similar to the one in the
> User model) in my model? What I need is a field that I can compare some
> value to without storing the clear-text value in the field. (of course
> using the User model itself is not an option in my case, otherwise I
> would have not asked the question.)
>
Well, if your using newforms, you want the `PasswordInput


-- 

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



Re: newforms: are FloatField and HiddenField missed yet ?

2007-01-24 Thread Waylan Limberg

On 1/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Does anyone else have thoughts about a FloatField?
>

See this ticket: http://code.djangoproject.com/ticket/3238

-- 

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



Re: order_by not working with foreign keys:

2007-01-24 Thread Waylan Limberg

On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote:
>
> Waylan Limberg wrote:
> > On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote:
> >>  Book.objects.all().select_related()
> >>  .order_by('-bookshop_bookstat.avg_rating')[0:10]
> >>
> >
> > You should replace the dot (.) with a double underscore (__), so:
> >
> > .order_by('-bookshop_bookstat__avg_rating')[0:10]
>
> Sadly enough no go either, this gives me:
> "column bookshop_book.bookstat__avg_rating does not exist"
>
Hmm, you shouldn't have any dots in there, and this looks different
that your earlier examples. Perhaps you should check the docs [1].

I should also note that in the example I gave, I did not look at you
models. Now that I have, it seems you are confused more than I
originally thought. You don't need to refer to each  model, just
follow the relationship with double underscores. try:


Book.objects.all().select_related().order_by('-book__avg_rating')[0:10]

Actually, as you have `related_name` set (to 'stats'), I believe this
may be what you want:


Book.objects.all().select_related().order_by('-stats__avg_rating')[0:10]

[1]: 
http://www.djangoproject.com/documentation/db_api/#lookups-that-span-relationships


-- 

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



Re: order_by not working with foreign keys:

2007-01-24 Thread Waylan Limberg

On 1/24/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote:
>
>  Book.objects.all().select_related()
>  .order_by('-bookshop_bookstat.avg_rating')[0:10]
>

You should replace the dot (.) with a double underscore (__), so:

.order_by('-bookshop_bookstat__avg_rating')[0:10]


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



Re: Validation on Client Side? Django support only server side validation

2007-01-16 Thread Waylan Limberg


On 1/16/07, johnny <[EMAIL PROTECTED]> wrote:


Django support only server side validation.  Dose it support validation
on Client Side? I would like to push it on client, to keep my server
load light.


Any client side processing would be done with javascript. However, you
must always remember that some users may have js turned off and could
bypass client side validation. Therefore validation should always
happen server side regardless of what you may or may not be doing
client side. If you would still like to do some client side validation
for a convenience to your users you may use whatever javascript you
see fit, but just remember you will most likely be duplicating the
code already on the server.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: newforms : how to display as_ul from views.py

2007-01-15 Thread Waylan Limberg


On 1/15/07, Ramdas S <[EMAIL PROTECTED]> wrote:

How do I get the templates to render the following form from the views.py
given below as as unordered list, instead of the standard table formt. This
is a simple four fields ContactForms, created out of the table Contacts.


   form.as_ul()

Theres also `form.as_p()` and the default `form.as_table()`. You can
either use that to pass your form to your context, or you can call it
directly in the template.



Currently it is emmiting the HTML as as a a table class.

def index(request):
ContactForm = forms.models.form_for_model(Contacts)
if request.method == 'POST':
form = ContactForm( request.POST)
if form.is_valid():
form.save()
return HttpResponse('Message Recd')
else:
form = ContactForm()

t = loader.get_template('contactus.html ')



c = Context({'form': form, })

return HttpResponse(t.render(c))



I can make the template behave the way I want to using CSS. But that is not
the idea...

 >




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



Re: Evaluation of urls.py in mod_python

2007-01-11 Thread Waylan Limberg

If my understanding is correct, when you use this method:

> choices = {
> 'queryset': Poll.objects.filter(opening_date__lte=datetime.now(),
> closing_date__gte=datetime.now())
> }

The value of datetime.now() is evaluated at compilation time when
apache/mod_python is started (or at least when the .pyc file is
created) and the date and time of compilation will be used as long as
apache keeps running. However, by doing:

> now = datetime.now()
>
> choices = {
> 'queryset': Poll.objects.filter(opening_date__lte=now,
> closing_date__gte=now)
> }
>

This will force the value of datetime.now to be evaluated only at run
time. In other words, the value will actually represent the current
time when the request is made.


-- 

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



Re: Importing models from outside applications

2007-01-10 Thread Waylan Limberg

On 1/10/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
> On 1/10/07, johnnie pittman <[EMAIL PROTECTED]> wrote:
>
> > I'm looking to find out if there's a method to access django models in other
> > applications outside of the django project structure.   What I'm looking to
> > do is import a model from one of the apps in my project:
> >
> > from project.app import models
>
> Have you tried doing exactly that?  A Django app is just a python
> module, so as long as project.app is on your PYTHONPATH when you run
> manage.py, a simple import should work.
>
Of course, if your not running your app through manage.py, you'll need
to define the DJANGO_SETTINGS_MODULE environment variable. After all,
for you model to connect with a db, it'll need the connection
settings.

A minimal settings file with db connection info should do the trick.
Depending on how you plan to run your app, you can either permenantly
set the DJANGO_SETTINGS_MODULE environment variable via the OS or in
you python code.

In your python code this should do the trick ( where myproject is on
your pythonpath):

import os
os.environ['DJANGO_SETTINGS_MODULE'] = "myproject.settings"


-- 

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



Re: Django made a mistake by not serving static file ?

2007-01-10 Thread Waylan Limberg

On 1/10/07, pragmaticObjects <[EMAIL PROTECTED]> wrote:
>
> I think it might be a mistake that Django does not want to serve static
> file. Here's what I mean. When I switch to SSL mode (thanks to the
> SSLMiddleware by Anotnio Cavedoni), since not the entire page is served
> by Django (i.e. some images are from the admin media), so Firefox, for
> example does not show a lock at the bottom of the page and the address
> bar is not painted in light yellow. To the casual users who are trained
> to look for those security indicators on the browsers but do not
> understand better, they get paranoid. Because of that, how would anyone
> expect Django to be used outside of the newspaper/blog/etc
> applications. I hope I'm wrong, meaning I hope there's a solution that
> I don't know about. If you know the solution, please share. Thanks
>
>
There are a few thing that come to mind. They all have to do with how
your server is configured and differ based on how your set up.

Say, your site is served via SSL from https://example.com (note the
*s*). Then your media could be served from https://media.example.com
(again note the *s*) where media.example.com is a different server
(whether on a different machine or the same) that served static
content via SSL. This, would probably require multiple certificates
(one for each subdomain) and could get expensive.

Or, perhaps your serving everything from one server. Say,
Apache/mod_python. Then in your config you `SetHandler` to
Python/Django (https://example.com/), but for the Location
`site_media` (https://example.com/site_media/) you `SetHandler None`
and static media is served directly by Apache so Django never sees the
request. Assuming Apache is configured correctly and as your still
behind https (again, note the *s*) you're good and only need one
certificate as everything is behind one domain.

If your using Fcgi a few extra tricks with mod_rewrite (or your
server's equivalent) should get you the same effect as the mod_python
trick.


-- 

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



Re: Underscore in CharField definition

2007-01-09 Thread Waylan Limberg

On 1/9/07, chasfs <[EMAIL PROTECTED]> wrote:
>
> I was looking at django.contrib.auth.models and noticed _ in front of
> the first parameter, e.g.
> first_name = models.CharField(_('first name'), maxlength=30,
> blank=True)
>
> What does that mean/do?
>

See line 5 of that file:

from django.utils.translation import gettext_lazy as _

_('some text') is a call to the function gettext_lazy passing in 'some text'


-- 

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



Re: Removing SQL From Templates

2007-01-09 Thread Waylan Limberg

On 1/9/07, David Cramer <[EMAIL PROTECTED]> wrote:
>
> I'm talking completely about the related objects accessors, and not
> sending models to the templates is not a good solution for us :)
>
> I want to setup some kind of blocking mechanism so that while rendering
> a template the models will not do any SQL queries that have not already
> been executed, or at least block the related field queries.

Well, if you don't want the related objects to be queried at a later
time that the initial object, select_related [1] will do that for you.
Simply put, all related objects are queried at the same time as the
initial object.

I don't know why you would want to block those queries completely. If
your template is asking for them and they're blocked, you'll never get
that info to display in your template. Unless that is what you want,
but then I suggest removing those calls from the template. Seems to me
more like an issue of *when* the SQL queries are executed and
select_related takes care of that.

[1]: http://www.djangoproject.com/documentation/db_api/#select-related

-- 

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



Re: where does the old manipulator go?

2007-01-05 Thread Waylan Limberg


On 1/5/07, Ramdas S <[EMAIL PROTECTED]> wrote:

have considered all your suggestions and have tried something like this. But
it still fails. I have numerous errors, I guess. I have marked in yellow,
potential issues.

Many Thanks if you can help me fix it



The logic in your view is a little off. If there is no POST data, you
want to initialize the form with no data so try this:



def register(request):

if request.user.is_authenticated():
# Do Not register users already there
return render_to_response('quizapp/register.html',
{'has_account': True})


   if request.method = 'POST':
   form = RegistrationForm(request.POST)
   if form.is_valid():
# your code here...
# ...
return
render_to_response('quizapp/register.html', {'created': True})

   else:
 form =  RegistrationForm()

   return render_to_response('quizapp/register.html', {'form': form })

Note that the last line is not inside the else and gets called either
if there was no POST data (as an empty form) or if the POST data is
NOT valid (so the form is redisplayed with error messages and
pre-populated with the errant data)
--

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



Re: What's the best way to learn newforms?

2006-12-31 Thread Waylan Limberg


On 12/31/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:

On 12/31/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> Regarding your deleted comment: Comments on the documentation pages
> are intended to be suggestions and corrections for the docs themselves
> -- not tech support questions. We delete anything that doesn't comment
> directly on the docs, so that the comments section remains helpful.
> The place to ask questions is on django-users, not in the doc
> comments.
>
Is this explained anywhere on the site? Personally, I like this
policy, but I don't recall ever seeing it stated anywhere (except
here). Perhaps a simple link in the comments form to a comments policy
would help avoid this confusion. Just a suggestion.


Bah! I didn't even double check before posting that. I see there
already is a comment. Sorry for the noise.


--

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



Re: rendering multiple dictionaries?

2006-12-31 Thread Waylan Limberg


On 12/31/06, Noah Gift <[EMAIL PROTECTED]> wrote:

Is there an elegant way to avoid nesting dictionaries in render_to_response
if you have to separate data structures to display...from say another
function that gets called in your view?  The data structure I am displaying
is already deeply nested, so I would like to avoid nesting even further if I
can avoid it.  It makes for a nasty template with too much nesting.


You can always subclass Context [1] and do your own thing - passing
that in with the context_instance attribute, but even then, your
custom context must return a dict.

[1]: 
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext


--

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



Re: What's the best way to learn newforms?

2006-12-31 Thread Waylan Limberg


On 12/31/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:


Regarding your deleted comment: Comments on the documentation pages
are intended to be suggestions and corrections for the docs themselves
-- not tech support questions. We delete anything that doesn't comment
directly on the docs, so that the comments section remains helpful.
The place to ask questions is on django-users, not in the doc
comments.


Is this explained anywhere on the site? Personally, I like this
policy, but I don't recall ever seeing it stated anywhere (except
here). Perhaps a simple link in the comments form to a comments policy
would help avoid this confusion. Just a suggestion.


--

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



Re: Problem with custom forms and related objects

2006-12-31 Thread Waylan Limberg


On 12/30/06, JMCameron <[EMAIL PROTECTED]> wrote:


Thanks ElGranAzul,  my django code is up to date (via svn), so
'oldforms' is equivalent to 'forms' (the __init__.py files are the
same).   So using 'from django import oldforms as forms' may be better
form (no pun intended!), but will not fix the problem I'm trying to
figure out.


True, but seeing oldforms are being phased out in favor of newforms,
problems with the oldforms generally seem to be ignored, except to
suggest that you either wait for newforms, or, if you're up to it,
switch now and help with development by reporting bugs.

I suppose that if you were stuck in an older version, you could work
up your own patch, but seeing you're running the latest trunk, that
seems unlikely.


--

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



Re: Newforms clean_data

2006-12-29 Thread Waylan Limberg


On 12/29/06, Vadim Macagon <[EMAIL PROTECTED]> wrote:


Adrian Holovaty wrote:
>
> Would it help if the form automatically called its validation the
> first time you accessed form.clean_data? I'm trying to decide whether
> that would be convenient or too magic.
>

I kind of like the way it is now, if form.clean_data did the validation
on first access how would you tell if the validation was successful?
You'd have to call form.is_valid() anyway, so it seems logical to me not
to try to access form.clean_data before checking if validation
succeeded. If it's not valid you probably have to redisplay the form
anyway, so no point doing extra work processing clean_data that will get
discarded.



My thought exactly. I couldn't have said it better myself. Although, I
will admit that my confusion came from thinking that accessing
form.clean_data would call the validation. However, that could be
attributed to the current lack of documentation (a problem that will
no doubt be addressed soon) than anything else. And once I got the
logic worked out in my view, the current implementation certainly made
more sense and was less magic.


--

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



Re: Newforms clean_data

2006-12-29 Thread Waylan Limberg


On 12/29/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


I just recently started out working with newforms and they generally
seem to be a joy but I cannot seem to access form.clean_data... (I am
using the most recent dev. version)


I remember scratching my head over that too. form.clean_data is not
available until after you call form.is_valid() and only if
form.is_valid() returns true. Oh, and you need to get that from an
instance of the class, not from the class itself.

Additionaly, form.errors will always be empty if form.is_valid() is
true, so you don't need to test for both. Try these changes:

if request.method == 'POST':
new_data = request.POST.copy()
personal_form = UserPersonalForm(new_data, auto_id=True)
contact_form = UserContactForm(new_data, auto_id=True)

if personal_form.is_valid() and contact_form.is_valid() :
u.first_name = personal_form.clean_data['first_name']



--

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



Re: Screencast: Django + Aspen = Stephane (was Re: pure-HTTP deployment?)

2006-12-21 Thread Waylan Limberg


On 12/21/06, Don Arbow <[EMAIL PROTECTED]> wrote:


On Dec 21, 2006, at 10:35 AM, Jeremy Dunck wrote:
> Where does one find this tiny shim?



Well, the url is in the screencast:

http://aspen-commons.googlecode.com/svn/stephane/


Generally, in my experience retrieving that information from a
screencast is a pain. If there isn't any supporting documentation, I
won't bother taking the time to extract it all from the screencast.
Aspen's documentation seems rather sparse. If there was some written
documentation giving more details on the info covered in either
screencast, I might look more closely. The way I see it, the
screencast is just to wet our appetite for more. Unfortunately there
isn't more AFAICT.


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



Re: Is there an easy to "humanize" a list?

2006-12-20 Thread Waylan Limberg


On 12/20/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote:


Waylan Limberg wrote:

> Not that we need another way but this would work as well, and it
> doesn't need special cases for one and two item lists but does insert
> the "and" (unlike most of the solutions offered):
>
> def humanize_list(list):
> return ", and".join(map(str, ", ".join(map(str, list)).rsplit(',',1)))

 >>> humanize_list(["one", "two"])
'one, and two'


Ahh, right, when I whipped that up, I wasn't including a comma with
the and, but before posting I reread the original email and saw the
comma was included in the request so I just stuck it in there without
further testing. Personally, I would just pull that comma out (the
first comma in line 2), which gives us the same result as
django.utils.text.get_text_list.


--

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



Re: Is there an easy to "humanize" a list?

2006-12-20 Thread Waylan Limberg


On 12/20/06, Austin Govella <[EMAIL PROTECTED]> wrote:


Is there an easy way to output that as: "foo, bar, and twinky"



Not that we need another way but this would work as well, and it
doesn't need special cases for one and two item lists but does insert
the "and" (unlike most of the solutions offered):

def humanize_list(list):
return ", and".join(map(str, ", ".join(map(str, list)).rsplit(',',1)))

--

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



Re: Strange django-admin.py behaviour

2006-12-20 Thread Waylan Limberg


When you updated, did you copy a new version of django-admin.py to
C:\Python\Scripts\? If you still have an older version of the file
there that may be your problem.

On 12/20/06, Cam McVey <[EMAIL PROTECTED]> wrote:


OK, here's a wee update: if I call the script like this, I get sensible output:
"python C:\Python24\Scripts\django-admin --version"
but if I just try:
"C:\Python24\Scripts\django-admin --version"
it doesn't work (I just get the help text).
[By the way, "C:\Python24\Scripts" is on my system PATH, and I've
setup ".py" as an executable, which meant that I'd just call
"django-admin --version" from aywhere in the filesystem and it used to
work before the update.]

Anyone able to shed some light on it?

Thanks,
Cam

>




--

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



Re: Noob: is there a complete library reference somewhere?

2006-12-18 Thread Waylan Limberg

On 12/18/06, Daniel Nogradi <[EMAIL PROTECTED]> wrote:
>
> Just starting with django and I'm slightly overwhelmed by the number
> of modules, packages, etc. I usually find a complete library reference
> very useful when starting to explore a huge software package like
> django, for instance the way the standard library of python is
> documented at http://docs.python.org/lib/lib.html makes it easy to see
> through the complexity.
>
> Is there such a reference somewhere for django? I don't mean
> tutorials, usage guides, howtos and such, but a raw listing of
> available modules, objects, attributes, etc, with just the bare
> minimum text for each to explain what it is.

There's always pydoc: http://docs.python.org/lib/module-pydoc.html


-- 

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



Re: Switching branches (was "Schema Evolution code")

2006-12-15 Thread Waylan Limberg

On 12/15/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 12/15/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:
> > No mention of the cross-platform path files? I would say they are
> > easier to edit (comment/uncomment a line in a file) than symlink and
> > as they are a python feature (not an OS feature) they work on any OS.
>
> Hey Waylan,
>
> A patch to the documentation would be welcome. :)
>
Done: http://code.djangoproject.com/ticket/3147

I hope it is clear enough.


-- 

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



Re: Paths in Python 2.5

2006-12-15 Thread Waylan Limberg

On 12/14/06, kbochert <[EMAIL PROTECTED]> wrote:
>
> Thanks but I don't have, and don't want an irc client, so I'll just
> struggle along and try not to ask stupid questions. My problem is that
> Python 2.5 and sqlite3 seems to be a buggy combination. (Is that true?)
> Maybe sqlite3 hasn't really been integrated yet?
>
> I have had to edit
> "C:\Python25\lib\site-packages\django-0.95-py2.5.egg\django\db\backends\s
> qlite3\base.py"
> for instance, to refer to sqlite3 instead of  pysqlite.

That's because Django 0.95 was released before Python 2.5 and sqlite
was a third party addon (called pysqlite) prior to Python 2.5. The
latest in Django's trunk has fixed this problem which will be included
in the next release (whenever that is).
>
> I also find that the messages I have posted here are typically the
> 4-5th attempt, most simply vanishing. (replies seem to be reliable)
>
> Please forgive my frustration

It would seem that Python's most frustrating , and yet least
documented feature for newcomers is the path. Once you get past that
it'll get easier.



-- 

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



Re: Switching branches (was "Schema Evolution code")

2006-12-15 Thread Waylan Limberg

On 12/14/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> I've added some more instructions to the "Using branches" part of our
> documentation. Let me know if this helps.
>
> http://www.djangoproject.com/documentation/contributing/#using-branches
>
> Adrian
>

No mention of the cross-platform path files? I would say they are
easier to edit (comment/uncomment a line in a file) than symlink and
as they are a python feature (not an OS feature) they work on any OS.

Just place the file `django.pth` in your site-packages dir (or
anywhere on your pythonpath). The file would look something like this:

/path/to/django_src
# /path/to/django_branch1
# /path/to/django_branch2

If you want to switch to branch2, just edit the file and comment line
one and uncomment line 3. It's that easy.

For more on path files see this page:
http://bob.pythonmac.org/archives/2005/02/06/using-pth-files-for-python-development/


-- 

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



Re: Help with get absolute url

2006-12-14 Thread Waylan Limberg

This isn't working for you?

  {% for organisation in object.organisation_set.all %}
{{
organisation.org_name }}
  {% endfor %}

If the name works, but not get_absolute_url I'd say you have something
wrong with your model. Open a shell and play with you model to make
sure everything is working right.


-- 

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



Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-14 Thread Waylan Limberg

On 12/14/06, Bob <[EMAIL PROTECTED]> wrote:
>
> Waylan -
> I have revision 4198, so that's okay, and my PYTHONPATH does not have
> anything about Django or site-packages in it at all.  However, when I
> run python and print sys.path, I see:
>
> ['', 'c:\\Python24\\lib\\site-packages\\setuptools-0.6c1-py2.4.egg',
> 'c:\\Python24\\lib\\site-packages\\django-0.95-py2.4.egg', ...
>
> I bet that egg is still referring to an earlier version.  Now I just
> need to figure out how that egg is getting on the path.
> - Bob
>
>
Anything in site-packages is automatically added to your path. That's
a python feature -  and the best place for third part packages. I
would suggest moving/deleting that egg. Until you do, you'll (almost)
always get that version of django.


-- 

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



Re: manage.py - "test" not a known action - how do I do unittests?

2006-12-13 Thread Waylan Limberg

On 12/13/06, Bob <[EMAIL PROTECTED]> wrote:
>
> Don -
>
> How do I check the revision?  import django; django.__version__ prints
> '0.95' but not the revision number.

On the command line from within your django_src directory do:

svn info

That should tell you the revision number among other info.

>
> I just updated from svn with:
> svn co http://code.djangoproject.com/svn/django/trunk/
> but I still get the same behavior - manage.py doesn't know about
> "test".

Check to make sure your project is using the correct version of Django
on your system. My guess is you have multiple copies and its using the
wrong one.

./manage.py --version

should return `0.96-pre` not 0.95

Check your Pythonpath to make sure it's pointing at the right Django source.

-- 

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



Re: Problem setting up a separate media server

2006-12-13 Thread Waylan Limberg

On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote:
>
>
>
> On Dec 13, 1:58 pm, "Waylan Limberg" <[EMAIL PROTECTED]> wrote:
> > On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote:
> >
> > http://192.168.1.9:3000/gobites.jpg;>
> >
> > Generally speaking I believe the conventional way to do this when both
> > servers are on one machine is to point all traffic to the static
> > server (port 80) which then proxies any non-static requests on to the
> > server running Django (on some random port). That would avoid the
> > above problem.
> > 
> > Waylan Limberg
> > [EMAIL PROTECTED]
>
> Wayne,

Who's Wayne?? ;-)

> I did have some success when I changed my ref to  src="/media/gobites.jpg"> and this displays images fine, but I'm not
> convinced it's not serving them in apache as well as Django.

As the domain of your static files is different (a different port on
same ip is still considered a different host by the browser), you need
to explicitly list the domain/ip and port (if not 80) in your img
links. Seeing your not doing that (as I suggested), yeah,
apache/django is probably serving those files.

>
> What you suggest makes sense. How would I set a proxy on the static
> port - not done that before.

You would want to use mod_proxy [1]. I'v never used Lighttpd myself (I
use Apache for both) so I couldn't help with specifics, but this
example [2] might be helpful.

[1]: http://lighttpd.net/documentation/proxy.html
[2]: http://trac.lighttpd.net/trac/wiki/ApacheSubversionRecipe



-- 

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



Re: Problem setting up a separate media server

2006-12-13 Thread Waylan Limberg

On 12/13/06, Tipan <[EMAIL PROTECTED]> wrote:
>
> However, I can't seem to get an simple image to display through a
> Django template.
>
> I've tried all sorts of combinations and can't seem to make any
> headway.
>
> Any advice welcome. Details of my settings etc. below.
>
> Template call is simply:
>
> 

Looking at your settings shouldn't that be:

http://192.168.1.9:3000/gobites.jpg;>

Generally speaking I believe the conventional way to do this when both
servers are on one machine is to point all traffic to the static
server (port 80) which then proxies any non-static requests on to the
server running Django (on some random port). That would avoid the
above problem.



-- 

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



Re: Help with get absolute url

2006-12-13 Thread Waylan Limberg

On 12/13/06, conrad22 <[EMAIL PROTECTED]> wrote:
>
> Yes, I know. Sorry, should have been more specific:
> the problem is, that the second part of the url pattern comes from a
> different model.
>
> I've tried
> (r'^categories/(?P\d+)/(?P\w+)/$','django.views.generic.list_detail.object_detail',
> info_dict),
>
> but it's obviously not quite there...? How would I access the slugs
> from the Organisation model within the Category models url patterns?
>
You'll probably want to use a wrapper for your generic view. See:
http://www.b-list.org/weblog/2006/11/16/django-tips-get-most-out-generic-views


-- 

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



Re: Auto generate url patterns

2006-12-08 Thread Waylan Limberg

On 12/8/06, leanmeandonothingmachine <[EMAIL PROTECTED]> wrote:
>
> I did want to use flatpages but can't for the 2 reasons in my orginal
> post, unless I'm wrong about those limitations, in which case flatpages
> would be perfect.
>
> I understand about urls being a collection of patterns, but I don't see
> how I can make a pattern that fits when I won't have a set parent.
> Since some urls will need to be served by a different app... Unless I
> just put a catch all at the end so if it doesn't fit any of the above
> it will default to an app that will sort out wether to serve a page or
> show 404.

Thats exactly how I would do it. The catch_all_view would check the db
for a matching url in the url field and then do one of three things:
1. Return a HttpResponce - a simple page
2. Call another (complex) view which returns a HttpResponce
3. return Http404 if there is no matching url in db.

Remember views are just normal python code so you can do pretty much
anything you want as long as you eventually return an httpresponce

-- 

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



Re: Django and mod_python issues

2006-12-05 Thread Waylan Limberg

On 12/5/06, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
>
> Tipan a écrit :
>
> > PythonPath "['d:/program files/xampp/htdocs/myproject'] + sys.path"
>
> Try : PythonPath "['d:/program files/xampp/htdocs/'] + sys.path"

Actually, you may want to include both lines. That way,
`myproject.settings` will still work and you will be able to `import
myapp` instead of `import myproject.myapp` making your apps more
portable across projects.


-- 

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



Re: [importError] No module name py. Newby

2006-12-05 Thread Waylan Limberg

On 12/5/06, Snirp <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I am starting off with django and decided to stick with the "django
> book"
>
> The webserver initiates just fine, and i made the first example: return
> current time when requested the URL: /now/
>
> It returns the following error when requesting the url:
>
>
>
> Traceback (most recent call last):
> File "d:\webdev\python\django\core\handlers\base.py" in get_response
>   65. callback, callback_args, callback_kwargs = resolver.resolve(path)
> File "d:\webdev\python\django\core\urlresolvers.py" in resolve
>   145. for pattern in self.urlconf_module.urlpatterns:
> File "d:\webdev\python\django\core\urlresolvers.py" in
> _get_urlconf_module
>   161. self._urlconf_module = __import__(self.urlconf_name, '', '',
> [''])
>
>   ImportError at /now/
>   No module named py
>

I have a sneaking suspicion that you are trying to `import
somefile.py`. When importing in your python code, the `.py` file
extension is assumed, so leave if off: `import somefile`.

If that's not it, post your urls.py file here so we can see what may
be causing the problem.

>
>
> The path to d:\webdev\python is just fine and the welcome screen
> displays just fine.
>
>
> >
>


-- 

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



Re: Apache ErrorDocument Question.

2006-12-01 Thread Waylan Limberg

Paul Childs wrote:
> It looks like I am going down the wrong path. I think that what I
> observed was by design since Django is handling the request.
>
> I think the question should be...
>
> How do I handle the 413 error within Django?
>
> Any help would be greatly appreciated.
>
>   
You'll likely want Django to return the 413 error code. Fortunately, 
it's easy to alter headers of HttpResponce objects. See the docs[1]. 
Actually, you should be able to alter the status code like so:
response = HttpResponce (YOURTEMPLATE)
response.status_code = 413
return response

As long as YOURTEMPLATE correctly renders a template you created to 
display the error message (perhaps with context), that should do the 
trick. You may find the code for other error codes interesting as well [2].

[1]: 
http://www.djangoproject.com/documentation/request_response/#httpresponse-objects
[2]: 
http://code.djangoproject.com/browser/django/trunk/django/http/__init__.py

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: How should I store credit cards for offline processing

2006-12-01 Thread Waylan Limberg

Noah wrote:
> It's only for a couple weeks or so until actual online processing
> without storing the cards is implemented. It's also fairly likley there
> won't be a single order taken IMO...
>   
At the very least make sure you fully disclose that to any potential 
customers up front. Of course, that may scare them off for good, so you 
may be better waiting to launch when the proper system is in place a 
couple weeks from now. Perhaps offer them the option of being put on a 
(private) mailing list to announce the launch.

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Opera & caching

2006-11-29 Thread Waylan Limberg

On 11/29/06, Michal <[EMAIL PROTECTED]> wrote:
>
> Hello,
> I have problems with Opera browser and caching.
>
> I have URL /prihlaseni/.
> If user isn't logged, I give him html form for login.
> If user is already logged, I give him only text message, that inform him
> about this state, together with link to logout.
>
> So, one URL, but two different content (depends on users login).
>
> Everything work just fine in my browser (Firefox).
> I try the same in Opera browser, and there is problem. If user done
> successfull login, then click on some other URL, and then go back to
> /prihlaseni/ page, he see login form (but he should see only text). If I
> make reload (CTRL+R), content is updated to correct content (text).
>
> I suppose, that this is occasioned by Opera and his caching, but maybe
> this could be solved by some extra HTTP information send by Django (etag?).

Yep, you want to use the Cache-Control HTTP directive [1]. More
specifically, you probably want to set `no_cache=True` to force
browsers to never cache that page.

[1]: 
http://www.djangoproject.com/documentation/cache/#controlling-cache-using-other-headers

>
> I don't use Django framework.
>
> Do you have some advice?
>
>
> Thank you
> Regards
>
> Michal
>
>
> >
>


-- 

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



Re: What is __init__.py for?

2006-11-19 Thread Waylan Limberg

On 11/19/06, ringemup <[EMAIL PROTECTED]> wrote:
>
> I've noticed all these __init__.py files are generated when you create
> a new app in django, and I can't find any documentation on them.  What
> are they for?  What does one do with them?
>
> thanks.
>
>

This is a Python thing, not just a Django thing. A quick search turned
up this explanation:

"The __init__.py files are required to make Python treat the
directories as containing packages..."

For more detail, read the rest here:
http://www.python.org/doc/2.1.3/tut/node8.html#SECTION008400000


-- 

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



Re: Acces to model object inside model

2006-11-17 Thread Waylan Limberg

On 11/17/06, Kamil Wdowicz <[EMAIL PROTECTED]> wrote:
>
> It is possible to access, and do a query inside models.py ?
>
> Something like this:
>
> class Tag(models.Model):
> #props...
>
> def _get_count(self):
> return Tag.objects.all().count()
>
> counter = property(_get_count)
>
> Do you know what I mean ?
>
According to the docs [1] Model Methods (like your proposed
_get_count() method) are for "row level" functionality. That means the
method would apply to a specific row in your db at a time. However, in
your example you want to access "table wide" data. That would be were
Model Managers come in.

[1]: http://www.djangoproject.com/documentation/model_api/#id6
[2]: http://www.djangoproject.com/documentation/model_api/#managers


-- 

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



Re: Hiding directories from Django?

2006-11-15 Thread Waylan Limberg

On 11/15/06, jefurii <[EMAIL PROTECTED]> wrote:
>
> This may be more of an Apache question, but is it possible to hide
> certain directories from Django, and have them be served either as
> static HTML or as PHP?
>
> I'm refactoring a site and while I'd love to have it be pure Django,
> there are several PHP components (a wiki and a bulletin board) that
> need to be kept as they are, with their current URLs.
>
> For example, these URLs would be served by Django:
>   /
>   /about/
>   /whatever/
>   /morestuff/
>   /reports/aaa
>   /reports/bbb
>   /reports/ccc
>
> But these would need to be interpreted by PHP or served as HTML:
>   /forum/
>   /wiki/
>   /reports/super_special_report/
>
> I'm using Django with Apache/mod_python.  I was able to get it going
> using the docs at
> http://www.djangoproject.com/documentation/modpython/.
>
> 
>   SetHandler python-program
>   PythonHandler django.core.handlers.modpython
>   PythonPath "sys.path+['/var/www/django']"
>   SetEnv DJANGO_SETTINGS_MODULE myapp.settings
>   PythonDebug Off
> 
>

Add a location for each dir that you do not want served by django. You
should be doing this for media already. See this page:
http://www.djangoproject.com/documentation/modpython/#serving-media-files

So, for the forum dir do:


SetHandler None



> Many thanks!
>
>
> >
>


-- 

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



Re: Template Loader for PHP files

2006-11-08 Thread Waylan Limberg

On 11/8/06, Gerard Whittey <[EMAIL PROTECTED]> wrote:
>
> I saw the ticket for this Template Loader for PHP files
> http://code.djangoproject.com/ticket/2440
>
> I was wondering if someone could explain how you would integrate this
> into a django project. I read through the docs about templates but it
> was beyond me as I am just starting to learn python.
>
> I just need to be able to test out if this php template loader will work
>   so I can convince the "bosses" we need to switch from php to this.
>
You want to focus on the "Loading Templates" [1] section, more
specifically, the "Loader Types" [2] sub-section.  Add the new loader
to the "TEMPLATE_LOADERS" setting in your settings.py file. Then
you'll need to make sure that your TEMPLATE_DIRS [3] setting points to
 the directory which contains your php templates.


[1]: 
http://www.djangoproject.com/documentation/templates_python/#loading-templates
[2]: http://www.djangoproject.com/documentation/templates_python/#loader-types
[3]: 
http://www.djangoproject.com/documentation/templates_python/#the-template-dirs-setting

-- 

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



Re: Please whitelist me!!!

2006-11-03 Thread Waylan Limberg

On 11/3/06, Iker Jimenez <[EMAIL PROTECTED]> wrote:
> Hi, I'm trying to submit a new ticket for a bug but I always get an "
> Akismet rejected spam" response. Can you please whitelist me???
>
> Thanks.
>
see this message:

http://groups.google.com/group/django-developers/browse_thread/thread/73adcd35547d150


-- 

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



Re: Forms trouble: Extra object ID appended to form action URLs

2006-11-03 Thread Waylan Limberg

On 11/3/06, jefurii <[EMAIL PROTECTED]> wrote:
>
> Thanks for replying.  The update method looks like this:
>
> def update(request, myobject_id):
> o = get_object_or_404(MyObject, pk=myobject_id)
> o.title = request.POST['name']
> ...
> o.save()
> return HttpResponseRedirect('/myapp/%s/' % myobject.id)
>
> The redirect would break, since it goes to the site root right now, but
> I've never actually gotten that far yet.  As far as I can tell, the
> update method is never called because the request never gets past the
> 404.
>
My guess is that your use of get_object_or_404 is covering the real
error. Try commenting out that line and accessing your object directly
( I'm guessing something like this:
o=MyObject.objects.get(pk=object_id) ) and see what errors you get.
That should give you (and us) a hint of where to look.


-- 

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



Re: Sharing models between apps

2006-10-30 Thread Waylan Limberg

On 10/30/06, Vortexmind <[EMAIL PROTECTED]> wrote:
>
> Hi
> I'm new to django and I've finished the tutorial. I want now to develop
> an application of mine, but before starting I have a question. In the
> tutorial (the polls app) we define a model (Pool, Choice) inside an app
> (polls app).
>
> But what I can do if I must share a model between multiple apps? For
> example, I can have a database of something (for example, a photography
> collection with photos and albums). I can create a "gallery" app that
> list all the photos and display each photo. But I could decide to start
> a "photorating" app that let the user rate all single photos one by one
> (like, http://www.hotornot.com/ just to make an example : )))
>
> Well, in this case I should insert the appropriate view action in the
> "gallery" app. But what if I wanted to create a new app? Do I have to
> redeclare the models in the new app? Or is there a way to share them?
>
 Sure, just import the appropriate model. Perhaps something like this:

from django.db import models
from myproject.gallery.models import Photo

class Rating(models.Model):
photo = models.ForeignKey(Photo)
# the rest of your model ...

I'm not sure exactly what you have in mind, so a many-to-many or
one-to-one field may be more appropriate there, but that should get
you started.
-- 

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



Re: AJAX

2006-10-30 Thread Waylan Limberg

On 10/30/06, angel <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I know there are various topics on this subject, but my concrete
> question is: How mature is the ajax support in Django at the moment ?
> If i download django now , what kind of ajax support can it offer, in
> terms of helpers , etc , and how stable is this? (as compared to ROR
> for example). We are currently evaluating the two frameworks to be used
> in a relatively high-traffic and not so simple (as opposed to some apps
> from 37signals) ,  and since all of the performance / extensibility /
> rich UIs considerations are very important, still haven't arrived at a
>  conclusion. Thanks
>

Short answer: Pick the JS toolkit of your choice (Dojo, MochiKit,
Prototype, YUI among others) thanks to Django's built in serialization
(XML or JSON).

For a complete answer see:
http://www.b-list.org/weblog/2006/07/02/django-and-ajax

And for some examples see the wiki and these articles:
http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1
http://www.b-list.org/weblog/2006/08/05/django-tips-simple-ajax-example-part-2


-- 

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



Re: directed graph in default admin

2006-10-27 Thread Waylan Limberg

On 10/26/06, John Lenton <[EMAIL PROTECTED]> wrote:
>
[snip]
>
> this is as expected; but if you click on "Sink", you get
>
> Source | Sink v
>  Anode | Cnode
>  Cnode | Bnode
>  Mnode | Anode
>  Xnode | Anode
>
> i.e., it still sorts by Source instead of Sink. Is this a bug in
> django, or am I forgetting something?
>

I couldn't help but notice that in your example, it is also sorted by
Sink *descending*. What happens if you click on "Sink" again? If I'm
not mistaken, it should sort *ascending*. Then again, this just may be
a coincidence of a poorly written example in which case you can ignore
me.


-- 

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



Re: status of authentication updates?

2006-10-25 Thread Waylan Limberg

On 10/25/06, falcon <[EMAIL PROTECTED]> wrote:
>
> I am working on my first Django app and it looks like I will need
> RowLevelPermissions (perhaps GenericAuthorization as well).  Can anyone
> provide an estimate of its release (merge with the main branch)?  I
> need to know if I can use it in my project, which I hope will go live a
> few weeks after I have implemented my permissions.
>
I believe most of these branches are in need of real world testing and
review. If you want them merged to trunk, then the best thing you can
do is download and use them. Just be sure to offer feedback - both
good and bad.


-- 

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



Re: Help with List_display in Admin class

2006-10-23 Thread Waylan Limberg

On 10/23/06, MerMer <[EMAIL PROTECTED]> wrote:
>
> In the example below I am trying to get list_display to show the the
> "fullname" that was defined in def__str__(self).   It's not working.
> Can anybody tell me how I can do it.
>
> Many thanks
>
> MerMer


Try this:

> class UserProfile(models.Model):
>   user=models.OneToOneField(User)
>   activation_key = models.CharField(maxlength=40)
>   key_expires = models.DateTimeField()
>   street_address=models.CharField(maxlength=400)
>   city_address= models.CharField(maxlength=100)
>   postcode=models.CharField(maxlength=50)
 def fullname(self):
  return "%s %s" %(self.user.first_name, self.user.last_name)
 def __str__(self):
 return self.fullname
>   class Admin:
>   list_display=('self.fullname','city_address','postcode')
>   pass
>
>

Just understand that you can no longer sort by that column in admin.

-- 

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



Re: Import issue using signals.py

2006-10-19 Thread Waylan Limberg

On 10/19/06, MerMer <[EMAIL PROTECTED]> wrote:
>
>
> > The quick fix here is to replace that line with
> >
> > from mysite.promotions import signals
> >
>
> The quick fix here didn't work.  I would then get
> "update_review_average is undefined."

Right, however `signals.update_review_average` should work just fine.
You only imported the signals module, not the function directly.

>
> However, many thanks for the explanation, I'll go through it and if I
> have further questions come back.  In the meantime, I've resorted to
> putting the "update_review_average" into the models.py - which has
> created a new set of problems (see new post).
>
> As a newbie, I'm struggling to make much headway - guess it's not my
> day!
>
> MerMer
>
>
> >
>


-- 

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



Re: JSON serialization and non-model classes

2006-10-18 Thread Waylan Limberg

On 10/18/06, Stefán Freyr Stefánsson <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I'm creating a web application that monitors information on distributed
> computers. This information (which is numerical; the sizes of queues running
> in a process on each of the computers) is put into a single database table
> with a column identifying which computer that row is referring to. So the
> table is on the form (computer_id, queue1_size, queue2_size, queue3_size)
> roughly.
>
> I've created a web page that displays a bar chart with this information.
> Each computer gets a "group" of three bars with each bar representing each
> of the queue size. In addition to the queue sizes for each computer I also
> want to display some general information not specific to any one of the
> computers (such as the total number of processes running etc).
>
> So now (finally) to my problem. I'm trying to get this bar chart to update
> with AJAX so that the whole page isn't refreshed every other second. For
> this I was hoping to use Django's JSON serialization but this is where I'm
> running into trouble.
>
> I have two model classes. One representing a row in the aforementioned table
> and another one that represents the database table containing the "summary"
> information. When the web page updates its info (does the AJAX call) I would
> like to retrieve all information that I need in a single call and update 1)
> the summary information 2) the queue status for all the workers displayed as
> bars on the web page.
>
> Currently I only seem to be able to serialize the summary information (which
> is just one row) or a list of the queue information. What I'd like to be
> able to do is to somehow serialize:
>  1. a single row from the summary information table
> 2. a list of queue information (each item representing the latest
> information for each computer).
> in a single "datastructure" to be sent as a JSON string over to the
> JavaScript client.
>
> So, if anybody can tell me whether it's possible to create a "custom"
> datastructure and serialize that over the wire as a JSON string, I'd
> appreciate it very much.

Within your view, create your "custom" datastructure in python. When
you have everything you want, (but not before) pass that to the
serializer.



-- 

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



Re: Choosing a format for built-in comments

2006-10-16 Thread Waylan Limberg

On 10/14/06, Tool69 <[EMAIL PROTECTED]> wrote:
>
> Hi Waylan,
> Thanks for pointing me this site, I've learned a lot.
> The problem is that I'm using the built-in freecomment, so if I need to
> add a field I'm obliged to change the original Django code in
> \django\contrib\comments. Is there any problem(s) with this ?
>

Only if and when you update via svn. Generally, the suggested method
is to copy the django/contrib/comments to
path/to/yourproject/comments, then edit settings.py to point to the
new location. That way, when you upgrade the django source, you won't
overwrite your changes.

-- 

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



Re: Choosing a format for built-in comments

2006-10-12 Thread Waylan Limberg

On 10/12/06, Tool69 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I've made a little blog app, but i'm not satisfied with django's
> free-comment.

You'll find a nice writeup on hacking free-comment here [1]. That
article doesn't address your concern exactly, but should familiarize
you with the code and give you some ideas of how to proceed.

[1]: http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment

> In fact, I would like the user to choose an entry format,
> (like in my AdminPanel) : (X)HTML, ReST, Markdown or TexTile. How can I
> simply implement this? I'm actually a Django newbie, so don't blame me
> if the answer is trivial.

First add a field to your model with the choices of formats available.
Then, in your template, use if statements to check which format was
selected and display the comment with the proper filter.

-- 

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



Re: writing templatetag in database?

2006-10-12 Thread Waylan Limberg

On 10/11/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> waylan, although I don´t understand your last/second suggestion, I
> managed to store my templates in the database.
> if you think your second suggestion is by far better than the first
> one ... could you please explain it again.
>
> my current solution:
> I´m storing templates for every user in the db with a name like "db/
> user/31/sidebar/", where "31" is the userid.
> then, in my primary template (loaded from the file-system), i´m
> including the template from the db using {% include sidebar_template %}.

Glad to hear it works. I guess I was thinking it woudn't know which
user to pull the sidebar for, but I see you got that worked out just
fine -- so just ingore my second suggestion.

>
> that works fine, although I have to include the {% load ... %}-tag
> for my sidebar templatetags within the db (that´s kind of strange).

Thats correct. Any load tags do not carry over from the parent
template when included. That behavior is by design.

>
> thanks,

You're welcome


-- 

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



Re: writing templatetag in database?

2006-10-10 Thread Waylan Limberg

On 10/10/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:
[snip]
>  Although, I'm not sure how you would pass the
> current user to the loader.

Just rethinking my answer. I would probably go with a custom
templatetag instead. You already have the text of the sidebar template
(from your db) as a variable in your context so pass that (and perhaps
the user (or use RequestContext)) as an argument. Then, within your
tag, render the sidebar template [1], setting the context according to
the current user and return the rendered tag as a string, which will
then get displayed on your page.

[1]: 
http://www.djangoproject.com/documentation/templates_python/#rendering-a-context


-- 

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



Re: writing templatetag in database?

2006-10-10 Thread Waylan Limberg

On 10/10/06, patrickk <[EMAIL PROTECTED]> wrote:
>
> is it possible to store the call for a templatetag in the database?
>
> we´re having a sidebar which consists of templatetags only. now, we´d
> like the user to be able to move different sections up and down or
> even delete that section.
> the sidebar looks like:
>
> {% CommentsUser userid %}
> {% TagsUser userid %}
> {% OwnEntry 123 %}
> {% LatestComments userid %}
> {% FlickrStuff userid %}
> ...
>
> the only way I can think of letting the user change the sidebar is to
> store it in the database.
> problem is, when I store a templatetag in the database, it´s being
> displayed as text and not treated as a templatetag.
>
> any ideas?
>
You probably want to store a custom sidebar template for each user in
the database. What you need is a template loader which pulls the
correct template from the db so it can be included in the page. See
ticket 632 [1] for such a loader. There was some discussion regarding
that in this thread [2]. Although, I'm not sure how you would pass the
current user to the loader.

[1]: http://code.djangoproject.com/ticket/632
[2]: 
http://groups.google.com/group/django-users/browse_thread/thread/28a15de5843711d8



-- 

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



Re: Django and Ajax

2006-10-10 Thread Waylan Limberg

On 10/10/06, Nicolas Steinmetz <[EMAIL PROTECTED]> wrote:
>
> puyuus a écrit :
> > hello again!
> > there are 2 weeks since i started using Django and I can say that i
> > done a lot of things easier then in PHP.
> > just one problem for today what can you tell me about the
> > combination between Django and Ajax? did somebody used Ajax with
> > Django; if yes... how it was it?
>
> the topic has been discussed many times in the last few days. A search
> could give you part of the answer or even the full one ;-)
>
You can also find various solutions posted in the wiki [1]. But the
best (most complete) writeup I've seen is by James Bennet [2] & [3].

[1]: http://code.djangoproject.com/
[2]: 
http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1
[3]: 
http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-2

-- 

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



Re: django - kit

2006-10-09 Thread Waylan Limberg

On 10/7/06, Picio <[EMAIL PROTECTED]> wrote:
>
> Do you know about
> WAMP
> LAMP
> Apache2Triad (That's what I'm using now but it lacks Django)
> XAMPP

I am very aware of those 'kits', and have used them in the past (for
php dev work). However I have never heard of one that will work out of
the box for django. There was some discussion a month or so ago on the
list where someone was setting up a virtual machine which basicly
gives you the same result (a quick search of the list should get you
going). However, I don't know that I'd want to use a VM for live
hosting. Of course, my understanding is that those 'kits' aren't all
that secure or intended for live hosting out of the box either.
>
> I mean kits to avoid configuring apache mod_python django to work togheter.
> Let's say I want to install django with lighttpd:
> I have to install:
> 1 - python
> 2 - lighttpd
> 3 - flup
> 4 - django
>
> then I have to do all the configuration work to make them happy togheter! ;)
>
> What I'm searching  is a tool or a script or also some direction to
> build this "package" myself.
> Sorry if I speak in a bad way. And sorry for my english.
> Picio
>
> >
>


-- 

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



Re: Can I pre-populate fields in the admin interface?

2006-10-06 Thread Waylan Limberg

On 10/5/06, carlwenrich <[EMAIL PROTECTED]> wrote:
>
> Models:
>
> ---
> class Week(models.Model):
> beginning = models.DateField(core=True)
>
> def __str__(self):
> return str(self.beginning)
>
> class Admin:
> pass
>
>
> class Day(models.Model):
> week = models.ForeignKey(Week, edit_inline=models.TABULAR,
> num_in_admin=7)
> name = models.CharField(maxlength=50)
> opens = models.TimeField()
> closes = models.TimeField()
>
> def __str__(self):
> return self.name
> ---
>
> The admin screen (add) comes up with a week and seven days. Each day
> has a name field, and opens field, and a closes field. I'd like it to
> come up with those fields pre-populated with default values.
>
> Can I do it? If so, how?
>
http://www.djangoproject.com/documentation/model_api/#default


-- 

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



Re: how could i weakly protect comments

2006-10-04 Thread Waylan Limberg

On 10/4/06, coulix <[EMAIL PROTECTED]> wrote:
>
> Hello, i am using free comments in my app and starting to getting spam
> :)
> I dont want to use captcha yet and instead, use some content string
> scanning method.
> (sex, viagra, $$$ and other crap will not post the message).
> What is the best way to this ?
> exends comments view.py ?
> Thanks :)
>
This [1] should get you going on that. It actually uses a stronger
method, but the basics should be similar. Just use your own code
rather than the Akismet code in the example.

[1]: http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment


-- 

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



Re: Support for db declaration of "on cascade delete"?

2006-10-04 Thread Waylan Limberg

On 10/4/06, Greg Plesur <[EMAIL PROTECTED]> wrote:
>
> All,
>
> Do any of you know if there's a way to tell Django to specify "on
cascade delete" for foreign key references, when it creates DB tables?

I don't believe you can. However, you can use sql or sqlall [1] to
output the table creation sql to a file for editing.  For example:

manage.py sqlall myapp > myapp.sql

Then open myapp.sql in your favorite editor and alter the sql as you
see fit. After saving, feed that file into your db.

[1]: 
http://www.djangoproject.com/documentation/django_admin/#sql-appname-appname
>
> I'm developing an application that is mostly using Django to touch my
> DB, but that defines some SQL stored-procedures for manipulation of some
> of its data by other clients.  I'd like the db-level "on cascade delete"
> defined for these cases.
>
> Thanks,
> Greg
>
>
> >
>


-- 

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



Re: Use my own template system?

2006-10-04 Thread Waylan Limberg

On 10/4/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Is there some straightforward way to plug my own template system into
> Django?
>
> Thanks in advance,
>
Short answer: Don't use the render_to_response() shortcut (it uses
Django's template system), but just import and use your template
system within your view and pass the result onto Django's HttpReponse
object.

This thread [1] should answer your questions more throughly (with
links to the docs, etc). I realize that the question in that thread is
specific to cheetah, but the answers are general enough to apply to
any templating system. In fact, my answer above basicly paraphrases a
couple paragraphs from that thread.

[1]: 
http://groups.google.com/group/django-users/browse_thread/thread/2e5746bdd3ef3efe/


-- 

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



Re: global template tags

2006-10-04 Thread Waylan Limberg

On 10/4/06, Patrick J. Anderson <[EMAIL PROTECTED]> wrote:
>
> Hi, everyone!
>
> I have a question I've been trying to find answers to in the docs, but
> perhaps I'm not looking in the right places, because I can't find it.
>
> I'm wondering about the use of templatetags in project instead of
> application scope. I put my applications in 'apps' subdirectory and
> under each I created 'templatetags' directory to hold my template tags.
>
> I have a need for a tag that would display user and user-related
> information (no. of posts and comments, etc.) in header of each page and
> I thought that I could create a template tag for this purpose, which I
> would load in the base template.
>
> I guess the question is simple : where should this template tag be
> stored and can I import current RequestContext object to it?
>
>
This was just answered the other day:

http://groups.google.com/group/django-users/browse_thread/thread/49e9669c64e353b2/


-- 

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



Re: contrib comment system

2006-10-03 Thread Waylan Limberg

I was going to point you to the official docs [1], but that says it's
not yet documented. That said, James Bennet did a nice writeup [2]
that should get you going.

[1]: http://www.djangoproject.com/documentation/add_ons/
[2]: http://www.b-list.org/weblog/2006/07/16/django-tips-hacking-freecomment

On 10/3/06, Onno Timmerman <[EMAIL PROTECTED]> wrote:
>
> Is there somewhere some docs on the comment system in the contrib.
>
> Onno
>


-- 

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



Re: Re: Cannot get Many to Many Relationship To work - "name" not defined error message

2006-10-03 Thread Waylan Limberg

On 10/3/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> I think maybe one thing we could do is build up a list of Python
> tutorials and docs that we recommend people work through, either
> before they start playing with Django or as they go.
>

+1

This seems to come up from time to time on the list. Of course, this
page [1] already provides a decent list, but perhaps a list more
specific to the skills needed for Django would be helpful as well.
Although, is there really any difference in the skills needed? Maybe
not.

[1]: http://www.python.org/doc/

-- 

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



Re: Need help understanding Custom Views

2006-10-02 Thread Waylan Limberg

On 10/2/06, adamjspooner <[EMAIL PROTECTED]> wrote:
>
> > Do you mean that you do not understand how to pass the data to the
> > template for display, or something else?
>
> Waylan,
>
> I mean I don't understand how to pass the data from my Django app to my
> PHP webservice and then let the user know that everything went ok or
> post errors if it didn't.

Oh, you want to send data to a php webservice, not get data from it.
You'll still want to use urllib2 [1] as Gabor suggested. You will need
to determine if the php web service accepts data via GET or POST (see
below) and use the appropriate method. Assuming, POST, including code
like this simple example [2] in your view should do the trick. For an
example using GET, just keep reading that document for other examples.
Just add an `if` statement to the end to check the result for
success/failure and act accordingly.

[1]: http://docs.python.org/lib/module-urllib2.html
[2]: http://www.voidspace.org.uk/python/articles/urllib2.shtml#data

I'll assume you aren't sure of how to determine between GET and POST,
so visit the website that offers the service you plan to use and find
the page that contains the form to submit data. In your browser view
the source of that page and find the html form. The first line of that
form should look something like this:



The above form uses the POST method. If method="get", then it uses the
GET method. It is possible that the service accepts both regardless if
which is being used. If so, I'd recommend going with POST. Also note
that the url you point urllib2 at will be the the url of `action`, not
the url of the form (if they differ).

>
> I studied the same documentation you suggested over the weekend as well
> as the forms documentation. I can't seem to get my form from Django to
> communicate with my PHP webservice. I've tried setting the
> action="url/to/webservice/" with no luck (naming discrepancies I
> assume). I haven't tried the route that most likely will work,
> manipulating the data between the two from within a view because I
> don't know how. I've been working on it today...still...little progess.

You should probably get the code that submits the data working first.
Try something similar to the examples provided above right in the
python shell. When you find code that works, just copy that into your
view and you should be good to go.



-- 

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



Re: Need help understanding Custom Views

2006-10-02 Thread Waylan Limberg

On 9/29/06, adamjspooner <[EMAIL PROTECTED]> wrote:
>
> Adrian,
>
> I guess what I don't understand is how to use GET and POST...and what
> exactly they are GETting and POSTing...and what to name things and how
> to get those named things in the view to get to a template.
>
> I want to learn the basics and apply them.
>
GET refers to variables included in the URL. Take this example url:

http://example.com/some_url?a=foo=bar=blah

That url has three variables: a, b, and c which contain the values:
"foo", "bar" and "blah" respectively. To access those variables in
your view:

values = request.GET
# values == {'a' : ['foo'], 'b' : ['bar'], 'c' : ['blah']}
# if you want a single variable rather than a dictionary of all try
a = request.GET["a"]
#  a == ["foo"]
# But may want to set a default if the var is missing
b = request.GET.get(b, "defaultstring")
# b exists so b == "bar"
d = request.GET.get(d, "foobar")
# d does not exist so d == "foobar"

Post works in much the same way, except that it uses values POSTed
from an html form rather than a url. For an example see the
documentation [1]. In fact, I'd suggest reading that entire page
again.

[1]: http://www.djangoproject.com/documentation/request_response/#examples
>
> I understand the "Hello World!" example, but not the PHP connection
> one...it's the response part that I'm having trouble with.
>
Do you mean that you do not understand how to pass the data to the
template for display, or something else?


-- 

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



Re: Confused: staff / active users

2006-09-27 Thread Waylan Limberg

On 9/27/06, Enrico <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I got a little confused about the auth docs.
> Both is_staff and is_active designates that a user can log into the
> admin, so... what's the real difference?

My (limited) understanding is that a User who `is_active` is a user in
the system which may be able to access restricted views that you
create (according to your specifications). However, that user cannot
access the admin (usually a good thing).

`is_staff` indicates that the user can access the admin. Of course,
that only works when the user also `is_active`. The idea is that
rather than deleting a user (staff or not), the record would remain in
the db but would be set to "not active." Django is smart enough to
know that a "non-active" user has no perms regardless of any other
settings in that users records.

As far as "super" goes, that is just a shortcut to give "staff" all
perms. Otherwise, perms need to be manually set for each user (groups
certainly make this easier). Obviously, if a user is not "staff" they
could not be "super" either and Django is smart enough to figure that
out. the "non-active" user stuff applies here as well.

Hope that helps clear the fog. :-)

-- 

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



Re: Project Layout When Using Multiple Sites, Revisited

2006-09-25 Thread Waylan Limberg

On 9/25/06, Scott McCracken <[EMAIL PROTECTED]> wrote:
>
> In continuing to diagnose this problem I have re-read the
> DJANGO_SETTINGS documentation. Under the section for Default Settings
> it says:
>
> "A Django settings file doesn't have to define any settings if it
> doesn't need to. Each setting has a sensible default value. These
> defaults live in the file django/conf/global_settings.py.
>
> Here's the algorithm Django uses in compiling settings:
> * Load settings from global_settings.py.
> * Load settings from the specified settings file, overriding
> the global settings as necessary."
>
> Is it possible to adjust that algorithm to
>
> * first load settings from the global_settings.py
> * second load settings from a common project settings.py
> * third load settings from a specific project's settings.py
>
> In other words, is there a way to have another level of settings in
> between global and project-level without modifying the django_src.

Sure, the settings file is just python code so at the top of your
settings.py do something like:

from myproject.commonsettings import *

Of course, this assumes the file myproject/commonsettings.py



-- 

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



Re: Python 2.5 anyone

2006-09-21 Thread Waylan Limberg

On 9/20/06, John DeRosa <[EMAIL PROTECTED]> wrote:
[snip]
>
> It seems a little screwy for a file in a directory called "sqlite3" to
> do an import from "pysqlite2".  But that's what it does.
>

What you need to realize is that "sqlite" refers to the database,
while "pysqlite" are the python bindings to that database. SQLite is
currently up to version 3.x. The python bindings required to use
SQLite3 are up to version 2.x - thus "pysqlite2".

It would seem that in Python2.5 they tried to avoid this confusion by
naming the python bindings the same as the version of SQLite they are
a wrapper for. While this certainly makes sense, it is not backward
compatable as any existing projects would be importing from pysqlite2
as you found out. It looks this this is being addressed in ticket 2772
[1]. For more info on the new sqlite3 wrapper, see [2].

[1]: http://code.djangoproject.com/ticket/2772
[2]: 
http://docs.python.org/dev/whatsnew/modules.html#SECTION000144


-- 

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



Re: How to make django use psycopg2 as the default engine?

2006-09-19 Thread Waylan Limberg
On 9/19/06, 叮叮当当 <[EMAIL PROTECTED]> wrote:
>
> i got it.
>
> DATABASE_ENGINE = 'postgresql_psycopg2'
>
> but the setting.py's comment don't mention this, 郁闷ing
>
If I recall correctly, that is because it's not officially supported
as there are some compatibility issues in various cases. You may want
to search the list for specifics.


-- 

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



Re: Portlet like features

2006-09-19 Thread Waylan Limberg

On 9/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Well - yes but most MVC type applications have a dispatcher like
> architecture where the request is caught by a single resource which
> then locates the controller to handle the request.
> Anyways, I think I got most of it to work (using my sparse python
> knowledge :-) )
> but each time I tried to read from an URL to the web-server my program
> stopped (halted).
> This really puzzled me for some time (since I can't seem to find a way
> to
> get a thread dump thank you very much (yes - Im program mostly in
> java)) but
> then I thought to my self, perhaps this mini webserver is only single
> threaded and what do you know... it is...   So - If I ain't going to
> install apache is there any other way I can get an multi-threaded
> webserver, perhaps using twisted ?
>
See this [1] wikipage for a list of various solutions (twisted among
them) that could give you a multi-threaded webserver.

[1]: http://code.djangoproject.com/wiki/ServerArrangements


-- 

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



Re: Problem with INSTALLED_APPS setting

2006-09-18 Thread Waylan Limberg

On 9/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Waylan Limberg wrote:
> > First, you only point to the app, not the models in your app. Second,
> > you need to start from a place that is on your pythonpath. If liger is
> > on your pythonpath, then just 'liger' will work, However, it's more
> > likely that is not the case, so you'll need to do something like
> > 'yourproject.liger'
>
> Hi Waylan,
>
> thanks for the answer. Shouldn't my project dir be added to the
> pythonpath? I created my project called "liger" which resides in
> C:\www\liger

Go reread your first post (I did a few times). You said 'liger' was an
app not a project. Which is it? If it is an app but not within a
project, that could be your problem.
>
> I have another project residing under the same dir C:\www and has no
> problems in resolving my names.

Make sure your project and app dirs each have init.py files in them.
Of course, the files can be blank, but without them, you'll never be
able to import from that dir.

>
> > if neither of those work, open a python shell and try:
> > import youproject.liger
> > or
> > import liger
> >
> > Experiment with your path till you find something that works. Whatever
> > works is what you should use in INSTALLED_APPS.
>
> Will keep trying.
>
> Thanks,
> Lorenzo
>
>
> >
>


-- 

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



Re: Pro Django from Apress

2006-09-18 Thread Waylan Limberg

On 9/18/06, Jeff Rodenburg <[EMAIL PROTECTED]> wrote:
> I just read about this new book on Django and am looking forward to checking
> it out.  Amazon shows its availability at October 30th.
> Does anyone know if it might be available earlier than that?
>
Try searching the list, this question has been asked and answered to
varying degrees a few times before. If memory serves me right, the
authors seem to think that October is overly optimistic and it will
more likely be latter.


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



Re: Problem with INSTALLED_APPS setting

2006-09-18 Thread Waylan Limberg

On 9/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> i've got an app named liger with a settings.py file which in
> INSTALLED_APPS has:
>
> 'liger.profiles'... along with other apps

First, you only point to the app, not the models in your app. Second,
you need to start from a place that is on your pythonpath. If liger is
on your pythonpath, then just 'liger' will work, However, it's more
likely that is not the case, so you'll need to do something like
'yourproject.liger'

if neither of those work, open a python shell and try:
import youproject.liger
or
import liger

Experiment with your path till you find something that works. Whatever
works is what you should use in INSTALLED_APPS.



-- 

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



Re: Forms with error reporting

2006-09-13 Thread Waylan Limberg

On 9/12/06, Hawkeye <[EMAIL PROTECTED]> wrote:
>
> The FormWrapper design pattern seems to be great, but I have a
> question.
>
> Is there any way that I can put errors in the response that aren't
> linked with form fields?
>

There is currently a discussion[1] going on in the dev-list regarding
a proposal for reworking form validation. I don't recall if such a
thing was part of the proposal, but now's the time to add your input.

[1]: 
http://groups.google.com/group/django-developers/browse_thread/thread/7eceb616b251cbd0/

-- 

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



Re: switching to mod_python

2006-09-11 Thread Waylan Limberg

On 9/11/06, Filipe <[EMAIL PROTECTED]> wrote:
>
> solved it! there was an error in urls.py
> I have an second urls.py inside the app dir and had to fix this:
>
> 'myapp.views.start'
>
> to this:
>
> 'myproject.myapp.views.start'
>
> seems like relative "paths" are relative to the project's base dir,
> instead of the scripts dir.
> Still don't understand why it works with the buildin server though...
>
This relates to the pythonpath. When you run the dev server you run
manage.py from the current directory. As the current directory is
included in the python path, then myapp is on the path. However, when
run through mod-python, unless you explicity add myapp to your
pythonpath, it won't work.

If you don't want to explicitly name the project from within your apps
(for more modular apps) then include each app in your path settings
for mod_python.


-- 

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



Re: Creating class object in template tag?

2006-09-01 Thread Waylan Limberg

On 9/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> That might work, if I were smart enough to figure it out... but I think
> all I'm trying to do is make bookxml.Items a class, so I can treat it
> as I would other classes.
>
> I think.
>
It looks like your hardcoding the search terms in the request your
submitting to Amazon. Do the results change often? Do you really want
to re-request that with each and every page view on your site? While
you could cache the xml file localy and work from that, perhaps you
should consider creating a model in your db and then use a script run
from a cron job (using django db api) to update the db every so often.
That way you can easly acces the data as you would any other django
model.

I believe that is how most people display their
del.icio.us/ma.gnolia.com links in their blogs and it works fine.
Perhaps you should check some of the source code that has been made
available for ideas.(you'll have to do some searching, it doesn't look
like anyone has compliled a list of those on the wiki - unless I
missed it)


-- 

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



Re: group traffic

2006-09-01 Thread Waylan Limberg

On 9/1/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Gary Wilson wrote:
> > A Django forum would be another option.  IMO, forums have more of a
> > community feel, and are also probably a little more friendly for
> > newbies.  And, unlike with this mailing list, you would be able to
> > reply to posts that are more than 30 days old.
>
> In my opinion the Google Groups interface is the best: you can now
> subscribe to updates for the post u're interested in and the search
> just works. Plus all the old posts with new replies get highlighted on
> the right.
>
+1

And then I don't need to go to a different website for each group I
belong to just to see new activity. They all come to me via email (the
actual content - not a notice to go to the site - uhg.) and I can
respond right there (something you can't do with feeds). And with
google groups, you still get the benefits of a forum for those who
don't want to use email. They can read and reply right on the site.

Now if someone added the abilty for a certain forum package to also
act like a mailing list, that would be something to think about.
-- 

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



Re: MySQL backend patch

2006-08-31 Thread Waylan Limberg

On 8/31/06, Geert Vanderkelen <[EMAIL PROTECTED]> wrote:
>
>
> There is already some migration going on from 4.x to 5.0, so I think
> we should go for 5.0 as 'default' backend. But that is just my opinion.

Just remember that all those shared hosting companies are very slow to
migrate at all. I'd hate to see something that greatly limits the
ability for people to use django just because they can't afford/don't
need top of the line hosting.


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



Re: User Registration weirdness. Ian, help!

2006-08-25 Thread Waylan Limberg

On 8/25/06, Waylan Limberg <[EMAIL PROTECTED]> wrote:
> On 8/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> [snip]
> >
> > I've gone through and stripped out every extra space I can find,
> > thinking that was the problem, but still that dang trailing slash comes
> > down to the next line. Ideas?
> >
> For what its worth, Gmail does indeed display that on 2 lines (only
> the ending / on line 2), but is correctly includes both lines as a
> single link with the ending slash. In other words, it looks funny, but
> it still points to the correct url.
>
> The problem comes with email clients that do not automaticly (or
> correctly) convert urls to links. The user may not select and copy the
> second line as part of the url...
>
Yeah, I just forwarded it and Outlook gets it wrong. +1 for Google :-)


-- 

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



Re: User Registration weirdness. Ian, help!

2006-08-25 Thread Waylan Limberg

On 8/25/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
[snip]
>
> I've gone through and stripped out every extra space I can find,
> thinking that was the problem, but still that dang trailing slash comes
> down to the next line. Ideas?
>
For what its worth, Gmail does indeed display that on 2 lines (only
the ending / on line 2), but is correctly includes both lines as a
single link with the ending slash. In other words, it looks funny, but
it still points to the correct url.

The problem comes with email clients that do not automaticly (or
correctly) convert urls to links. The user may not select and copy the
second line as part of the url...


-- 

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



  1   2   >