Using property fields in Models:'_QuerySet' object has no attribute 'new_summary' error

2008-04-11 Thread ydjango

I defined two property fields in my model as below

but TableName.objects.all() or filter() is not retrieving them.
It is retrieving only the regular model fields.

   Any clues on what I am doing wrong?
Ashish

   def _get_new_summary(self):
"Returns the news summary."
return '%s - %s' %(task_summary,"Ashish")
new_summary = property(_get_new_summary)

def _get_severity_desc(self):
"Returns the Severity Description."
p =Severity.object.get(pk=self.severity)
return p.display_desc

severity_desc = property(_get_severity_desc)
--~--~-~--~~~---~--~~
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: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread ydjango

Thanks, I will use Slug, which will be unique and alphanumeric but
will not be sequential.

I agree best protection is proper authorization, and that I check on
each page/request if the user is authorized to view this data or not.

I just hate the idea of some user just incrementing ids in url and
trying to view the data, he is not supposed to. (eg. putting boss's
employee id in url to see his salary)

I am restricting the data viewed through use of restrictive parameters
in queries  which can be defeated by changing the ids in url, if I use
primary ids.

thanks
Ashish


On Apr 11, 8:06 pm, Ned Batchelder <[EMAIL PROTECTED]> wrote:
> Strictly speaking, exposing the primary key is not a security issue.
> Primary keys are not a secret, just an id.  You need to secure your data
> based on authenticated credentials and some sort of authorization system
> that controls who can do what with each piece of data.
>
> Some people don't like using sequential primary keys because they are
> exposing information about their system.  For example, with your system,
> I can tell how many houses you have in your database by probing URLs.  I
> guess you might consider that a security concern.  If so, use a
> randomized slug as others have suggested.
>
> --Ned.http://nedbatchelder.com/blog
>
>
>
> ydjango wrote:
> > I am displaying a list of houses and on clicking on one of the houses
> > I want to show/edit details
>
> > currently I am using constructing url as /house/edit/123/
> > where 123 is house data base primary key for that house.
>
> > Can exposing the primary key in url be any security issue?
>
> > (r'^house/edit/(\d+)/$',editHouse)
>
> > Is there alternative way without exposing the primary key in url?
>
> > Ashish
>
> --
> Ned Batchelder,http://nedbatchelder.com
--~--~-~--~~~---~--~~
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: ModelMultipleChoiceField updating HTML choices after 2nd reload

2008-04-11 Thread Rishabh Manocha

Justin,

Thanks - that does exactly what I was looking for. Initially, I too
had to refresh the page once before I saw a list of options, but using
fields instead of base_fields fixed that.

This may be a stupid question, but is there a recommended/established
way of reading the django code. I am still fairly new to python, so I
don't quiet understand the nitty gritty's yet :(.

Best,

R

On Fri, Apr 11, 2008 at 8:50 AM, Justin <[EMAIL PROTECTED]> wrote:
>
>  In the __init__ method of the newforms.forms.BaseForm object, the
>  initialized fields
>  are copied as the fields as seen below
>
>  # The base_fields class attribute is the *class-wide* definition of
>  # fields. Because a particular *instance* of the class might want to
>  # alter self.fields, we create self.fields here by copying
>  base_fields.
>  # Instances should always modify self.fields; they should not modify
>  # self.base_fields.
>  self.fields = deepcopy(self.base_fields)
>
>
>  When I updated the attributes queryset like this:
>
>  form.base_fields['tasks'].queryset = tasks,
>
>  it was making the change to a stale copy of list.
>
>  Once I changed my code to say:
>
>  form.fields['tasks'].queryset = tasks,
>
>  everything worked out exactly how I planned.
>
>  Also, after the form has been submitted, you'll have to update the
>  queryset again like:
>  form = TestForm(request.POST)
>  form.fields['tasks'].queryset = Task.objects.filter(project=project)
>   if form.is_valid():
>  
>
>  This way, it will validate against the same queryset that the
>  selection was made from, otherwise, it'll throw a ValidationError
>
>
>
>
>  On Apr 10, 1:05 pm, Justin <[EMAIL PROTECTED]> wrote:
>  > You can also just call
>  >
>  > form.base_fields['tasks'].queryset =  tasks
>  >
>  > which will do this:
>  >
>  > form.base_fields['tasks']._set_queryset( tasks )
>  >
>  > How I found it?  I actually looked at the django code.  As you said in
>  > your post, I've never seen it documented anywhere.  I came across it
>  > after I found it in a few bug reports because apparently, there were
>  > similar issues.  I posted that ticket in my first post.
>  >
>  > When you use this, are you having the same issues with the page
>  > reloading without the set queryset until it's reloaded a second time?
>  >
>  > On Apr 10, 3:36 am, "Rishabh Manocha" <[EMAIL PROTECTED]> wrote:
>  >
>  > > I would like to get an answer for this too. Just reading through
>  > > Justin's code, I have figured out the solution to a problem I was
>  > > stuck on for a few days (I am new to Django so reading and learning
>  > > about the _set_queryset function was a godsend).
>  >
>  > > Also, I was wondering if someone can point me in the direction of any
>  > > documentation which describes other *obscure* function calls like
>  > > _set_queryset etc. I didn't see it anywhere in the main documentation
>  > > section. Had I seen it, I probably would have saved myself a few hours
>  > > of pulling my hair out.
>  >
>  > > Best,
>  >
>  > > ROn Wed, Apr 9, 2008 at 11:19 PM, Justin <[EMAIL PROTECTED]> wrote:
>  >
>  > > >  I noticed when looking at some code that after setting the queryset,
>  > > >  it appears in the form.  I can call ._get_queryset() or .queryset and
>  > > >  it looks updated.
>  >
>  > > >  The problem occurs in the actual form rendered.
>  >
>  > > >  form.as_ul() does not have the updated choices for the checkbox.  I'm
>  > > >  digging through django code but still nothing.
>  >
>  > > >  On Apr 8, 11:05 pm, Justin <[EMAIL PROTECTED]> wrote:
>  > > >  > I have a form:
>  >
>  > > >  > class TestForm(forms.Form):
>  > > >  > name = forms.CharField(max_length=128, label="Test name")
>  > > >  > tasks = forms.ModelMultipleChoiceField(required=False,
>  > > >  > label="Tasks", widget=forms.CheckboxSelectMultiple,
>  > > >  > queryset=Task.objects.none())
>  >
>  > > >  > The goal is to have checkboxes for a set of models easy enough. 
>  I
>  > > >  > initialize it to none because my goal is to update the queryset from
>  > > >  > within the views based on specific conditions.
>  >
>  > > >  > Inside my views.py, I have this:
>  >
>  > > >  > >>After clicking link to create project
>  >
>  > > >  > tasks = Task.objects.filter(project=project)
>  > > >  > form = TestForm()
>  > > >  > form.base_fields['tasks']._set_queryset( tasks )
>  > > >  > data = { "form": form, "project":project }
>  > > >  > return render_to_response("projects/create.html", data)
>  >
>  > > >  > When I click a link to this page from another, the checkboxes are 
> not
>  > > >  > there because the tasks queryset is still set to 
> Task.objects.none().
>  > > >  > If I hit F5 to reload, the correct tasks based on the project show
>  > > >  > up.  I can hit F5 infinitely and it's correct.  It's only on that
>  > > >  > first load.
>  >
>  > > >  > More weird...  I click back out to a different project page.  When I
>  > > >  > click the link, I expect it to show the form with a new

Re: Images and Stylesheets

2008-04-11 Thread Doug Van Horn

Here's my rewording of your question:

"How do I serve static content?"

Websites need to serve up your HTML, CSS, JavaScript, and images.

In Django, your views are serving up your HTML.  What you need to do
is serve up the rest of that stuff.

The first way to serve static content, when you are using the Django
development server, is to use the 'django.views.static.serve' view.
You'll find it documented here:

http://www.djangoproject.com/documentation/static_files/

Here's the gist, as you might include it in your urls.py:

from django.conf import settings
(r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),

Then, in your HTML files, you might include CSS and image files via
the following:


and


A more 'correct' way might look like this:



Note that MEDIA_URL gets included as a template variable when you use
the 'django.core.context_processors.media' template context processor
and pass a RequestContext to your template rather than a regular
Context.

When you get around to deploying into an Apache environment, you'll
need to either run a second 'media' server (think 'media.example.com'
virtual host) or you can turn off python handling for certain
locations under your app host and serve up the static files.  Consult
your Apache docs for more info (specifically, the Location, Directory,
and Alias directives).  If you're deploying against lighttpd I would
guess the concepts are similar.

I guess you don't actually /need/ to serve up your static content via
Apache, the above urls.py entry will work fine under Apache.  It's
more a matter of you /should/ (see the static_files link, they give a
better explanation...).

Hope this helps.

--
Doug Van Horn
http://maydigital.com/

On Apr 11, 9:19 pm, "Greg Lindstrom" <[EMAIL PROTECTED]> wrote:
> Hello Everyone-
>
> I started learning Django at PyCon in Chicago and have worked most of the
> way through the "Django Book" and Sams "Teach Yourself Django", as well as
> "Head First HTML with CSS and XHTML".  It's been quite a lot for this old
> dog, but I'd like to take a crack a writing my own web site using Django.  I
> have two problems, and I think they are related.  The first is how to get
> images in my site and the next is how to use css.
>
> I wrote Jacob about images and he was kind enough to point me to
> documentation on how to get the web server to "serve" the images.  I hate to
> put it this bluntly, but I don't know what that means (I've been programming
> database applications for 20 years and all this web stuff is still pretty
> new to me).  Is there something that explains to someone like me how to get
> images into the site?  Though I'm running Django on my Ubuntu laptop, I
> would like to eventually have it hosted.  I would like to know how to "do"
> images locally, then what I need to do when I host my site.
>
> The other problem is getting css to work with my site.  I have set up a
> base.html template (I love the templates, thank-you) and extend it with
> other templates, call one greg.html.  The html generates just as I expect it
> to (overriding blocks just as it should), but it doesn't "see" the style
> sheet.  One it gets "in" the template I'm OK; the "Head First" book did a
> pretty good job explaining it.  I even put a syntax error in my view  so
> Django would list out the settings, but couldn't find where Django is
> looking for the css file.  I suspect it is a similar problem to the images,
> but I just don't know.
>
> Thanks for your help,
>
> --greg
--~--~-~--~~~---~--~~
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: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread Ned Batchelder

Strictly speaking, exposing the primary key is not a security issue.  
Primary keys are not a secret, just an id.  You need to secure your data 
based on authenticated credentials and some sort of authorization system 
that controls who can do what with each piece of data.

Some people don't like using sequential primary keys because they are 
exposing information about their system.  For example, with your system, 
I can tell how many houses you have in your database by probing URLs.  I 
guess you might consider that a security concern.  If so, use a 
randomized slug as others have suggested.

--Ned.
http://nedbatchelder.com/blog

ydjango wrote:
> I am displaying a list of houses and on clicking on one of the houses
> I want to show/edit details
>
> currently I am using constructing url as /house/edit/123/
> where 123 is house data base primary key for that house.
>
> Can exposing the primary key in url be any security issue?
>
> (r'^house/edit/(\d+)/$',editHouse)
>
> Is there alternative way without exposing the primary key in url?
>
> Ashish
> >
>
>   

-- 
Ned Batchelder, http://nedbatchelder.com


--~--~-~--~~~---~--~~
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: Images and Stylesheets

2008-04-11 Thread Tim Chase

> I started learning Django at PyCon in Chicago and have worked 
> most of the way through the "Django Book" and Sams "Teach 
> Yourself Django", as well as "Head First HTML with CSS and 
> XHTML".  It's been quite a lot for this old dog, but I'd like 
> to take a crack a writing my own web site using Django.

welcome aboard!

> I have two problems, and I think they are related.

They are indeed

> to documentation on how to get the web server to "serve" the 
> images.  I hate to put it this bluntly, but I don't know what 
> that means

To "serve" simply means that the web-server (usually Apache or 
lighttpd) listens for requests for files and responds by 
"serving" them.  An example might be

   C:  GET /blog/2008/3/14/my-pi-day-post HTTP/1.1
   C:  Host: www.example.com
   S:  HTTP/1.1 200 OK
   S:  Date: Mon, 23 May 2005 22:38:34 GMT
   S:  Server: Apache/1.3.3.7 (Unix)  (Red-Hat/Linux)
   S:  Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
   S:  Etag: "3f80f-1b6-3e1cb03b"
   S:  Accept-Ranges: bytes
   S:  Content-Length: 438
   S:  Connection: close
   S:  Content-Type: text/html; charset=UTF-8
   S:
   S:  My first blog page

(C = client/webbrowser, S = server).

It may be helpful to learn some rudimentary HTTP (the protocol 
over which all of this is being served).

   http://en.wikipedia.org/wiki/HTTP

Or at least install the "Live HTTP Headers" FireFox extension 
that allows you to watch/record the HTTP transactions.  But the 
basic gist is that your browser requests a page; the server 
"serves" this page (dynamically, created by via Django).  Your 
browser then sees references to other external files (images, 
CSS, JavaScript, etc) and makes requests for each of these.  The 
server receives each request and returns ("serves") the requested 
content--an image, a CSS file, a JavaScript file, or even 
additional dynamic content from another Django source.

> I would like to know how to "do" images locally, then what I 
> need to do when I host my site.
> 
> The other problem is getting css to work with my site.

Both images and CSS files (as well as JavaScript source files, 
when you get there) are considered "static media".

Django's development server can serve these static media files. 
I like to use the following in my urls.py file:

if 'runserver' in argv:
urlpatterns += patterns('',
(r'^media/(?P.*)$',
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}
),
)

This allows me to serve media from the development server (which 
get put in the directory specified by MEDIA_ROOT), but it
doesn't alter my urlpatterns in production where the actual
web-server handles serving media.  To move to production, you'll 
want to configure your server (likely Apache or lighttpd) to 
serve these static files.  The server is very good at serving 
static (non-dynamic content), so it's best to let it handle these 
files.  Django *can* handle them, but it's not designed to do as 
much (it's designed to serve dynamic content).  There's a good 
writeup at

http://www.djangoproject.com/documentation/static_files/

regarding how to configure your web-server (Apache or lighttpd) 
for serving these static files outside of Django.

Hopefully this gives you some hints, pointers in the right 
direction, terminology to search the web, and tips in general to 
get things working.  As always, the list is a pretty friendly 
place, and will try and help guide you.

-tim



--~--~-~--~~~---~--~~
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: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread Doug Van Horn

FWIW, I don't see a security issue with exposing a surrogate primary
key to the public...

If you're hung up on the issue, though, take Tom's advice and use a
slug for each house as an unique key.  You might find the street
address of a house to be a good slug candidate...

On Apr 11, 6:28 pm, ydjango <[EMAIL PROTECTED]> wrote:
> I am displaying a list of houses and on clicking on one of the houses
> I want to show/edit details
>
> currently I am using constructing url as /house/edit/123/
> where 123 is house data base primary key for that house.
>
> Can exposing the primary key in url be any security issue?
>
> (r'^house/edit/(\d+)/$',editHouse)
>
> Is there alternative way without exposing the primary key in url?
>
> Ashish
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Announcing the Django Dash!

2008-04-11 Thread Daniel Lindsley

We'd like to announce the first Django Dash
(http://www.djangodash.com/) to the community. Django Dash is a web
application building competition for Django developers. The gist is
that you and (optionally) one other person can form a team and have 48
hours to crank out a full Django application. Your application will
then be pitted against others for bragging rights (and hopefully some
prizes).


==

What Is Django Dash?
A 48 hour, start-to-finish race to produce the best Django-based web
application you can. Mostly for fun/bragging rights but we're working
on upping the ante.

Who Can Compete?
Anyone but myself and (hopefully) three other judges, though this is
subject to change depending on popularity.

When Is It?
We'll be hosting the Dash on May 31 - June 1, 2008.

Where?
We're running this over the web, so you can be anywhere you like.
Coffee shop, work (though we're not responsible for the ramifications
of that one), at home, wherever you can find internet access and
power.

How Can I Compete?
First, please peruse the rules and judging information at
http://www.djangodash.com/. We will be opening registration for teams
on May 3, 2008. You're not allowed to start anything but ideas and
paper mockups until the competition begins on May 31, 2008.

Why?
It's a chance to test yourself and push your limits. A chance to show
people what you're capable of. Maybe some exposure. But mostly because
we've found competitions like this to be a lot of fun.

==


More details can be found at http://www.djangodash.com/. We will keep
it updated as things develop. If you're interested in competing in the
Dash, we'd appreciate if you'd fill out the mini-email form on the
front page so we can get an idea of how many people are interested.


How can I help out?
The Dash is really missing two things right now. First, we'd like to
have three fair judges signed on to help judge the apps once the
competition is over. Second, we're looking for sponsors who can
provide prizes as awards. No minimum/maximum dollar value is
required/requested. More details on this can be found at
http://www.djangodash.com/sponsors/.



Thanks and hope to see some of you competing!

Daniel Lindsley
Toast Driven
http://www.toastdriven.com/

--~--~-~--~~~---~--~~
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: Images and Stylesheets

2008-04-11 Thread Justin Lilly
You're problems are one and the same. It seems you're runserver isn't
configured to serve images. The bit of code you're looking for is:

if settings.DEBUG:
urlpatterns += patterns('',
(r'^site_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/path/to/media'}),
)


where /site_media/* is the path of your files. So if you have master.css
that lives in a css folder in /path/to/media, you'd reference it as:

/site_media/css/master.css

similarly, if you have an img directory under site_media, you would
reference your images to /site_media/img/foo.jpg

You will also want to look into setting up the MEDIA_URL for your
settings.py file. I would suggest:  'http://localhost:8000/site_media/'

Now instead of referring to your css file as:

/site_media/css/master.css

you can now refer to it as

{{ MEDIA_URL }}css/master.css

which should ease the pain of migration when your media might not live in
/site_media/

for more info, check out
http://www.djangoproject.com/documentation/static_files/

I'm not sure if you were asking but "Serving static media" basically means
"Tell runserver it can find my images _HERE_" where _HERE_ is defined in the
code snippet above.

Hop on by #django on irc.freenode.net if you have any more problems (or just
reply here).

-justin

On Fri, Apr 11, 2008 at 10:19 PM, Greg Lindstrom <[EMAIL PROTECTED]>
wrote:

> Hello Everyone-
>
> I started learning Django at PyCon in Chicago and have worked most of the
> way through the "Django Book" and Sams "Teach Yourself Django", as well as
> "Head First HTML with CSS and XHTML".  It's been quite a lot for this old
> dog, but I'd like to take a crack a writing my own web site using Django.  I
> have two problems, and I think they are related.  The first is how to get
> images in my site and the next is how to use css.
>
> I wrote Jacob about images and he was kind enough to point me to
> documentation on how to get the web server to "serve" the images.  I hate to
> put it this bluntly, but I don't know what that means (I've been programming
> database applications for 20 years and all this web stuff is still pretty
> new to me).  Is there something that explains to someone like me how to get
> images into the site?  Though I'm running Django on my Ubuntu laptop, I
> would like to eventually have it hosted.  I would like to know how to "do"
> images locally, then what I need to do when I host my site.
>
> The other problem is getting css to work with my site.  I have set up a
> base.html template (I love the templates, thank-you) and extend it with
> other templates, call one greg.html.  The html generates just as I expect it
> to (overriding blocks just as it should), but it doesn't "see" the style
> sheet.  One it gets "in" the template I'm OK; the "Head First" book did a
> pretty good job explaining it.  I even put a syntax error in my view  so
> Django would list out the settings, but couldn't find where Django is
> looking for the css file.  I suspect it is a similar problem to the images,
> but I just don't know.
>
>
> Thanks for your help,
>
> --greg
>
> >
>


-- 
Justin Lilly
Web Developer/Designer
http://justinlilly.com

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



Images and Stylesheets

2008-04-11 Thread Greg Lindstrom
Hello Everyone-

I started learning Django at PyCon in Chicago and have worked most of the
way through the "Django Book" and Sams "Teach Yourself Django", as well as
"Head First HTML with CSS and XHTML".  It's been quite a lot for this old
dog, but I'd like to take a crack a writing my own web site using Django.  I
have two problems, and I think they are related.  The first is how to get
images in my site and the next is how to use css.

I wrote Jacob about images and he was kind enough to point me to
documentation on how to get the web server to "serve" the images.  I hate to
put it this bluntly, but I don't know what that means (I've been programming
database applications for 20 years and all this web stuff is still pretty
new to me).  Is there something that explains to someone like me how to get
images into the site?  Though I'm running Django on my Ubuntu laptop, I
would like to eventually have it hosted.  I would like to know how to "do"
images locally, then what I need to do when I host my site.

The other problem is getting css to work with my site.  I have set up a
base.html template (I love the templates, thank-you) and extend it with
other templates, call one greg.html.  The html generates just as I expect it
to (overriding blocks just as it should), but it doesn't "see" the style
sheet.  One it gets "in" the template I'm OK; the "Head First" book did a
pretty good job explaining it.  I even put a syntax error in my view  so
Django would list out the settings, but couldn't find where Django is
looking for the css file.  I suspect it is a similar problem to the images,
but I just don't know.


Thanks for your help,

--greg

--~--~-~--~~~---~--~~
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: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread Tom Badran
Take a look at SlugField in the model documentation to do what you want.

Tom

On Sat, Apr 12, 2008 at 12:28 AM, ydjango <[EMAIL PROTECTED]> wrote:

>
> I am displaying a list of houses and on clicking on one of the houses
> I want to show/edit details
>
> currently I am using constructing url as /house/edit/123/
> where 123 is house data base primary key for that house.
>
> Can exposing the primary key in url be any security issue?
>
> (r'^house/edit/(\d+)/$',editHouse)
>
> Is there alternative way without exposing the primary key in url?
>
> Ashish
> >
>


-- 
Tom Badran
http://badrunner.net

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.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: Has anyone made an MS excel exporter in a django site yet?

2008-04-11 Thread Rock


While I have used Django to emit csv files, I have also found
that my users are quite happy at times with simply cutting and
pasting data that I display in HTML tables via Django directly
into their spreadsheats. You might want to see if this is an
adequate option for some of your use cases. It has worked out
suprisingly well for some of my users.

--~--~-~--~~~---~--~~
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: Has anyone made an MS excel exporter in a django site yet?

2008-04-11 Thread Rock


I can't believe that no one has mentioned the xlrd package:

http://scienceoss.com/read-excel-files-from-python/

http://pypi.python.org/pypi/xlrd/0.5.2


Then again I haven't used this one yet, much less tried to incorporate
it with Django.


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



alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread ydjango

I am displaying a list of houses and on clicking on one of the houses
I want to show/edit details

currently I am using constructing url as /house/edit/123/
where 123 is house data base primary key for that house.

Can exposing the primary key in url be any security issue?

(r'^house/edit/(\d+)/$',editHouse)

Is there alternative way without exposing the primary key in url?

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



Problems using feedparser and memcached in RSS model

2008-04-11 Thread dpweb

I have a model to store information about an RSS feed, which has the
method:

def refresh(self):
 dict = feedparser.parse(self.feed_url)
 # Do some processing


and a view:

def refresh_rss(request, rss_id):
  rss_feed = RSSFeed.objects.get(pk=rss_id)
  rss_feed.refresh()
  # Extra processing

When I run the refresh function off of the shell, it works fine
regardless of memcached.  Also, when I access the refresh_rss view
with memcached disabled, it works fine.  However, when I access the
refresh_rss view or run the refresh function with memcached enabled,
it doesn't work.  In particular, it seems that the feedparser.parse
function is not actually running.  There are no error messages or
anything, dict just ends up being None.  Anyone have any ideas why
this might be happening?  I've tried everything I could think of, and
am nearly certain that either feedparser.parse or memcached is to
blame.  My only thought was that since parse takes some time to run,
memcached or django might impose some sort of timeout that stops
execution of slow functions, but I couldn't find any documentation of
anything like this.  Thanks in advance for any help whatsoever.

GM
--~--~-~--~~~---~--~~
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 on plesk - Virtual Host

2008-04-11 Thread andy baxter

Tim wrote:
> I've got a couple Django apps running on Plesk. It's not the greatest
> but it works.
>
> First, after you set up your subdomain, you'll need to create the
> file:
> /var/www/vhosts/ domain.fr/subdomains/django/conf/vhost.conf
>
> Here's the contents of mine:
> --
> DocumentRoot /var/www/django_projects/myproject
>
> 
> SetHandler python-program
> PythonHandler django.core.handlers.modpython
> SetEnv DJANGO_SETTINGS_MODULE myproject.settings
> PythonPath "['/var/www/django_projects'] + sys.path"
> PythonDebug On
> 
>
> 
>   Options +Indexes
>   SetHandler none
> 
> --
>   
It's a bit of a more general question really, but does this sort of set 
up work OK, where you send '/' to django but have a sub-path of that 
served straight from the disk? I need to do something like this to serve 
my media files when I take my project live, but I was worried it would 
mean at some point having to create a separate IP address and virtual 
host to run a server on, rather than just serving everything from the 
same path.

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



United Kingdom IP Addresses

2008-04-11 Thread International Alliance Privacy Services

Hi Guys,

Just wanted to let all of you new forum users know that we have plenty
of United Kingdom ip addresses still available for those of you that
are abroad and want to watch the BBC, ITV, BBC Sport, BBC News, East
Enders, Dr. Who, and all your other favorite British programs. But it
doesn't stop there! Our service also lets you listen to British radio,
watch British movies live, and stream and/or download any British
media to your heart's contentment.

Our service works in every country, no matter where you are located!
Even if you live in the middle of no where and only have a dial up
connection, our service will work for you! We are currently supporting
Microsoft Windows and Apple Mac operating systems at this time.

We do offer a 24 hour trial period for you to try out this service. We
can issue you your own United Kingdom ip address to be used any where
on the internet that you desire. Our service is not restricted at all.
There are no bandwidth limitatons, so use the service as long as you
want.

This is a service provided by an online privacy organization. We do
not share our transactions or your identity with any third party. We
respect you, your computer, and your privacy. Keeping you safe and
secure is our number one priority. If you have any questions, please
feel free to click on
http://www.intl-alliance.com/e-store/store/index.php?main_page=contact_us
and we would be more than happy to answer any questions you may have.
Thank you.


Best Regards,

International Alliance Privacy Services
--~--~-~--~~~---~--~~
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 on plesk - Virtual Host

2008-04-11 Thread Tim

I've got a couple Django apps running on Plesk. It's not the greatest
but it works.

First, after you set up your subdomain, you'll need to create the
file:
/var/www/vhosts/ domain.fr/subdomains/django/conf/vhost.conf

Here's the contents of mine:
--
DocumentRoot /var/www/django_projects/myproject


SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproject.settings
PythonPath "['/var/www/django_projects'] + sys.path"
PythonDebug On



Options +Indexes
SetHandler none

--

In my set up, the media folder is all the images, css and js files.

After you create the file, you have to go back into the plesk control
panel and go into your subdomain and save it again (even if you don't
change anything). When you put the vhost.conf file in the directory,
plesk doesn't automatically load it so by resaving your subdomain
settings, you'll tell it to find the file.

I hope this helps.

Tim

On Apr 11, 9:27 am, martyn <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm just copying my django project on my Fedora-Plesk server and
> something is missing in my mind.
> All my projects are Virtual hosts.
>
> My main domain :
> domain.fr
>
> My django project :
> django.domain.fr
>
> And my medias :
> medias.domain.fr
>
> On plesk, you cannot write directly on the httpd.conf because it's
> overwriten by plesk itself, you have to add other vhost.conf files on
> each subdomains.
>
> Plesk did that for me into the httpd.conf file :
>
> 
> ServerName   django.domain.fr:80
> DocumentRoot /var/www/vhosts/domain.fr/subdomains/django/
> httpdocs
> CustomLog  /var/www/vhosts/domain.fr/statistics/logs/
> access_log plesklog
> ErrorLog   /var/www/vhosts/domain.fr/statistics/logs/error_log
> 
> SSLEngine off
> 
>  httpdocs>
> 
> php_admin_flag engine off
> 
> 
> php_admin_flag engine off
> 
> 
> 
> SetHandler python-program
> PythonHandler   mod_python.cgihandler
> 
> 
> Options -Includes -ExecCGI
> 
> 
>
> I'm not allow to modify this file.
> In my own vhost.conf, what do I have to write ?
> I tried this (and other derivated 
> fromhttp://www.djangoproject.com/documentation/modpython/)
> :
>
> 
> ServerName django.domain.fr
> SetEnv DJANGO_SETTINGS_MODULE myproject.settings
> 
>
> With no success.
> I really want to improve my knowledge into Django Deployement on
> apache.
> Thanks in advance.
>
> Martyn
--~--~-~--~~~---~--~~
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: Allowing html tags for filter.

2008-04-11 Thread [EMAIL PROTECTED]

It sounds like you want to use an inclusion tag here:
http://www.djangoproject.com/documentation/templates_python/#inclusion-tags.

--
Rob Tirrell
[EMAIL PROTECTED]

On Apr 11, 2:23 pm, "Erik Vorhes" <[EMAIL PROTECTED]> wrote:
> >  I have a custom filter that outputs some html code. The problem is
> >  that it converts all "greater than" and "less than" symbols to
> >  appropriate  > and < symbols. How is it possible to say to
> >  filter not to do this?
>
> You're running into the autoescape tag, which is on by default in
> templates. Check the template (for Python) docs to see how to mark
> your filter as "safe".
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Chicago Djangonauts list / meetings

2008-04-11 Thread Tom Tobin

I've started a Chicago Djangonauts list; apologies for the noise for
the 99%+ of you not in the Chicago area.  :-)

http://groups.google.com/group/django-chicago

I'll be starting discussion soon about when and where our first
meeting should be (sometime in May); if we have enough interest, we'll
make it a monthly thing (probably during those weeks ChiPy isn't
running).

--~--~-~--~~~---~--~~
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: unknown encoding: utf-8 error

2008-04-11 Thread Cephire

I hope this will be last one on this thread.
Now I am able to compile without any error and create an exe file out
of it.
I have hooked this with cherrypy (as I dont know how to hook the
development server).

When I open the browser, I get the below error:

Traceback (most recent call last):
  File "wsgiserver.py", line 624, in communicate
  File "wsgiserver.py", line 357, in respond
  File "C:\Python25\lib\site-packages\django\core\handlers\wsgi.py",
line 205, in __call__
  File "C:\Python25\lib\site-packages\django\core\handlers\base.py",
line 64, in get_response
  File "C:\Python25\lib\site-packages\django\contrib\sessions
\middleware.py", line 13, in process_request
ImportError: No module named backends.db

I've already imported db.backends.sqlite3 (which is what I use). So i
don't know how this is happening.

incase if needed, this is how I invoke freeze

FreezePython --target-dir=c:\sol sol.py -c --include-
modules=encodings.utf_8

Any help is appreciated.

Thank you,
Joseph
--~--~-~--~~~---~--~~
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: Catch-all route?

2008-04-11 Thread Brandon Taylor

Ah, the debug setting is why it wasn't redirecting! Thanks guys!

Brandon

On Apr 11, 1:35 pm, "Erik Vorhes" <[EMAIL PROTECTED]> wrote:
> Check out the documentation on URL configuration, if you need
> something more customized than the default 404.html template. (You
> don't need to write a special regex for 404 situations, but you could
> just use, as the *absolute last* pattern something like r'^.*$' (I
> think).
>
> For the most part, floguy is right--you don't need to worry about
> customizing this stuff. Just make an appropriate template.
>
> http://www.djangoproject.com/documentation/url_dispatch/#handler404
>
> On Fri, Apr 11, 2008 at 1:07 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
> >  Hi Everyone,
>
> >  Is there a way to define a catch-all route to send people to a 404
> >  page? Obviously I need to define a route that matches anything not
> >  previously defined, but am struggling with the RegEx to do so.
>
> >  Help appreciated!
> >  Brandon
--~--~-~--~~~---~--~~
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: Has anyone made an MS excel exporter in a django site yet?

2008-04-11 Thread sserrano

Hi
  You can also try the pyXLWriter (is a port of the perl module) link:
http://pyxlwriter.sourceforge.net/

Regards, Sebastian

On Apr 10, 7:57 pm, Roboto <[EMAIL PROTECTED]> wrote:
> lol I actually have a job that use my programming skills (lol lack
> of),  but when I view some of your code out there, lol you guys are
> programming circles around me.
>
> On Apr 10, 6:53 pm, Roboto <[EMAIL PROTECTED]> wrote:
>
> > whoa!
>
> > Lots of great answers here.  Thanks for the help, I'm going to go
> > through all these answers one by one and figure out which is best for
> > me.
> > I won't be doing a straight dump, so it's gonna be interesting =p
>
> > It's easy to do in C# though! But hopefully a solution listed here
> > will be just as painless
>
> > Once again, thanks
>
> > On Apr 10, 8:39 am, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > On Apr 10, 3:22 am, Tim Chase <[EMAIL PROTECTED]> wrote:
>
> > > > > yeah but the thing is XLS spreadsheets have a lot more
> > > > > meta-data than CVS can handle
>
> > > > I've found the easiest way for us was to use the "XML
> > > > Spreadsheet" option (available via the Save As->Type drop-down in
> > > > at least Excel 2003 if not 2000, and readable in 2007 too).  It's
> > > > fairly easy to reverse-engineer from an exported example, and
> > > > much cleaner than OOXML or pure XLS format.  It's pretty easy to
> > > > turn into a Django template too.  Most importantly for my uses,
> > > > it's possible to do things like keep leading zeros, which Excel
> > > > likes to dump from CSV/Tab files.
>
> > > I generate OpenXML docs from within the admin app. They're fairly easy
> > > to store in the db as well. I do this as then I can edit them online
> > > and then zip them up when I need them. I'd recommend spending the time
> > > to get your head around OpenXML, though that does depend on whether
> > > you're looking for CSV+abitofmetadata or an actual Excel document.
>
> > > Regards,
>
> > > Felix
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Accessing data from previous steps in Form Wizard

2008-04-11 Thread leifbyron

Hi there,

I am developing a form wizard comprised of about 20 forms. Some of
those forms require access to the previous forms for validation. Is it
possible to pass user-submitted data from previous forms to subsequent
forms in a form wizard?

Thanks,
Leif


--~--~-~--~~~---~--~~
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: tutorial question

2008-04-11 Thread Erik Vorhes

Using a database doesn't by default make your site searchable. It's a
more efficient storage system (usually) than having a bunch of static
files.

SQLite is an easy way to develop, especially if you're running Python
2.5, but I usually move to a PostgreSQL backend for "production"
sites, since SQLite doesn't allow for password protection of the
database.

Oh, and Django does most of the SQL heavy lifting for you, so it's not
as if you need to become proficient in it before developing something.
Just glance at the SQLite documentation, and when you're in your
database, make sure to type ".databases" (everything inside the
quotes) to see the path to your database, so you can put it in your
settings.py file.

On Fri, Apr 11, 2008 at 1:56 PM, sebey <[EMAIL PROTECTED]> wrote:
>
>  you make a good point i will say but I have a few reasons for this:
>
>  1.I try and keep things easy
>  2. I don't want them to be searchable(I know that sound odd but I my
>  site is designed so that I do not have the need for search
>  3. I don't really want to add another thing to my "to learn list" as
>  well I have enough on my plate already
>
>  but a remark on point three SQLite looks like a solution to my
>  problem,am I correct?
>
>  On Apr 11, 11:45 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
>
>
> > On Fri, Apr 11, 2008 at 5:20 AM, sebey <[EMAIL PROTECTED]> wrote:
>  > >  i am on a mac and I am running a podcasting network so I will proabley
>  > >  be storing all my files in XML/RSS
>  >
>  > I think you're suffering from very severe conceptual confusion.
>  >
>  > Take a podcast and think about it logically:
>  >
>  > Each podcast has a name.
>  > Each podcast has one or more "authors".
>  > Each podcast has one or more "episodes".
>  >
>  > Each "episode" has a publication date and an audio file, and maybe
>  > some other metadata.
>  >
>  > The logical way to build this, then, is to set up database tables
>  > which store this information, and then query it to dynamically
>  > generate an up-to-date feed, and that (modeling data for storage in a
>  > database, inserting it through a web-based interface, querying it back
>  > out again and rendering it into the output format of your choice
>  > through a templating system) is what Django is good at.
>  >
>  > --
>  > "Bureaucrat Conrad, you are technically correct -- the best kind of 
> correct."
>  >
>
>

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



Django API interface adapter for Google App Engine

2008-04-11 Thread Siddhi

Hi,

I'm working on an interface adapter for Google App Engine's datastore.
I've just started out and have created a project for it here with some
basic code - http://code.google.com/p/django-gae-helpers/

The intro page has an explanation of what I'm trying to do -
http://code.google.com/p/django-gae-helpers/wiki/Intro

And you can get the current code from the repository -
http://code.google.com/p/django-gae-helpers/source/browse/trunk/gaeadapter.py

It is released under MIT license.

So far a few of the methods have been implemented, basically those
that I needed to port one of my projects. I think it would be pretty
cool if we could adapt most of the API like this. Any thoughts?

--
Siddharta Govindaraj
http://siddhi.blogspot.com
http://www.silverstripesoftware.com/blog/

--~--~-~--~~~---~--~~
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: Using form wizard to complete form over multiple sessions

2008-04-11 Thread leifbyron

It does. Thanks so much! I'll let you know how it goes.

Leif



On Apr 11, 5:08 am, "Honza Král" <[EMAIL PROTECTED]> wrote:
> if you are using the wizard class, it doesn't remember the state
> anywhere, so if you supply the correct POST data, you will get thrown
> exactly to the point you wanted to be. The only thing you have to do
> is save the form data somewhere (perhaps just pickle the POST in a
> database), retrieve them later and create the form (see Wizard.render
> and render_template how the data is passed to the template).
>
> hope this helps
>
>
>
> On Mon, Mar 31, 2008 at 11:54 PM, leifbyron <[EMAIL PROTECTED]> wrote:
>
> >  Hi there,
>
> >  I have a 20-step form wizard that many users prefer to complete over
> >  multiple sessions. I am considering adding save_for_later() and
> >  resume_form_wizard() functions that would save the serialized form
> >  data to the database, and allow users to resume the wizard at a later
> >  time.
>
> >  Has anyone tried this? Any advice/thoughts?
>
> >  Best,
> >  Leif
>
> --
> Honza Král
> E-Mail: [EMAIL PROTECTED]
> ICQ#: 107471613
> Phone: +420 606 678585
--~--~-~--~~~---~--~~
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: tutorial question

2008-04-11 Thread sebey

you make a good point i will say but I have a few reasons for this:

1.I try and keep things easy
2. I don't want them to be searchable(I know that sound odd but I my
site is designed so that I do not have the need for search
3. I don't really want to add another thing to my "to learn list" as
well I have enough on my plate already

but a remark on point three SQLite looks like a solution to my
problem,am I correct?

On Apr 11, 11:45 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 5:20 AM, sebey <[EMAIL PROTECTED]> wrote:
> >  i am on a mac and I am running a podcasting network so I will proabley
> >  be storing all my files in XML/RSS
>
> I think you're suffering from very severe conceptual confusion.
>
> Take a podcast and think about it logically:
>
> Each podcast has a name.
> Each podcast has one or more "authors".
> Each podcast has one or more "episodes".
>
> Each "episode" has a publication date and an audio file, and maybe
> some other metadata.
>
> The logical way to build this, then, is to set up database tables
> which store this information, and then query it to dynamically
> generate an up-to-date feed, and that (modeling data for storage in a
> database, inserting it through a web-based interface, querying it back
> out again and rendering it into the output format of your choice
> through a templating system) is what Django is good at.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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: Catch-all route?

2008-04-11 Thread Erik Vorhes

Check out the documentation on URL configuration, if you need
something more customized than the default 404.html template. (You
don't need to write a special regex for 404 situations, but you could
just use, as the *absolute last* pattern something like r'^.*$' (I
think).

For the most part, floguy is right--you don't need to worry about
customizing this stuff. Just make an appropriate template.

http://www.djangoproject.com/documentation/url_dispatch/#handler404



On Fri, Apr 11, 2008 at 1:07 PM, Brandon Taylor <[EMAIL PROTECTED]> wrote:
>
>  Hi Everyone,
>
>  Is there a way to define a catch-all route to send people to a 404
>  page? Obviously I need to define a route that matches anything not
>  previously defined, but am struggling with the RegEx to do so.
>
>  Help appreciated!
>  Brandon
>  >
>

--~--~-~--~~~---~--~~
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: Catch-all route?

2008-04-11 Thread [EMAIL PROTECTED]

This is the default behavior.  If no pattern matches the URL from the
request, it will load and display "404.html".  This is assuming that
DEBUG=False.  If debug is set to True, then you will get a helpful
debug page.

On Apr 11, 1:07 pm, Brandon Taylor <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> Is there a way to define a catch-all route to send people to a 404
> page? Obviously I need to define a route that matches anything not
> previously defined, but am struggling with the RegEx to do so.
>
> Help appreciated!
> Brandon
--~--~-~--~~~---~--~~
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: Link that performs an action

2008-04-11 Thread Taylor

Thanks, I'll definitely check that out.  The last time I did AJAX
stuff was a couple of years ago when it was the hot spanking-new thing
(even though it isn't new), so there weren't really any good libraries
out yet.  Thanks for pointing me to the serialization doc.

My other thought is to create a custom tag that automatically builds
the from with a hidden data in it, but I haven't looked into custom
tags to see if that's possible yet.

Thanks!

On Apr 11, 10:11 am, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> Taylor wrote:
> > Thanks for the replies, but I guess I didn't make myself clear
> > enough.  Counter was just as an example, I don't want an actual page
> > counter.
>
> > I guess part of my question is:  Yes, I can use AJAX-y XMLHttpRequest
> > to send info to the server in the background, but has someone done
> > this already in django somewhere and posted code that can be plugged
> > in?
>
> > The idea is to have a view like this:
> > def my_view(request,num=0):
> >  counter = Counter.objects.get(id=someid)
> >  counter.count += num
> >  counter.save()
> >  # setup view stuff
>
> > but without specifying num in the URL or having to use a  in my
> > template.
>
> > Thanks
>
> If num isn't in the URL and it isn't a GET/POST parameter, where is it
> coming from?
>
> For front end of AJAX, use whatever Javascript lib/code you like, Jquery
> is my choice. Django doesn't come with or dictate a particular one.  The
> back end, Django part, of AJAX works exactly like any other view but
> return JSON or XML data instead of HTML.
>
> def my_view(request)
> data = simplejson.dumps(Model.objects.filter(somefilter=whatever))
> return HttpResponse(data, mimetype="text/javascript")
>
> orhttp://www.djangoproject.com/documentation/serialization/
>
> --
> Norman J. Harman Jr.  512 912-5939
> Technology Solutions Group, Austin American-Statesman
>
> ___
> Get out and about this spring with the Statesman! In print and online,
> the Statesman has the area's Best Bets and recreation events.
> Pick up your copy today or go to statesman.com 24/7.
--~--~-~--~~~---~--~~
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: Allowing html tags for filter.

2008-04-11 Thread Erik Vorhes

>  I have a custom filter that outputs some html code. The problem is
>  that it converts all "greater than" and "less than" symbols to
>  appropriate  > and < symbols. How is it possible to say to
>  filter not to do this?

You're running into the autoescape tag, which is on by default in
templates. Check the template (for Python) docs to see how to mark
your filter as "safe".

--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-11 Thread Erik Vorhes

It doesn't necessarily hurt to have apps inside the project folder,
but it does make it harder to extract and reuse them.

If I remember correctly, you don't need much, aside from settings.py,
urls.py, and __init__.py.


On Fri, Apr 11, 2008 at 1:09 PM, andy baxter
<[EMAIL PROTECTED]> wrote:
>
>  James Bennett wrote:
>  > On Tue, Apr 8, 2008 at 1:38 AM, jurian <[EMAIL PROTECTED]> wrote:
>  >
>  >>  Are django applications meant to be implemented in such a manner as to
>  >>  allow the entire application directory to be copied into another
>  >>  project and used without having to alter any of the code?
>  >>
>  >
>  > Though I often get flamed for saying this:
>  >
>  > Django applications should be implemented as Python modules that live
>  > standalone directly on the import path. If you have an application
>  > directly inside a project folder and it's not the poll app from the
>  > tutorial, something is wrong.
>  >
>  What /should/ be inside the project folder?
>
>
>
>  >
>

--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-11 Thread andy baxter

James Bennett wrote:
> On Tue, Apr 8, 2008 at 1:38 AM, jurian <[EMAIL PROTECTED]> wrote:
>   
>>  Are django applications meant to be implemented in such a manner as to
>>  allow the entire application directory to be copied into another
>>  project and used without having to alter any of the code?
>> 
>
> Though I often get flamed for saying this:
>
> Django applications should be implemented as Python modules that live
> standalone directly on the import path. If you have an application
> directly inside a project folder and it's not the poll app from the
> tutorial, something is wrong.
>   
What /should/ be inside the project folder?

--~--~-~--~~~---~--~~
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: Loading ChoiceField in forms

2008-04-11 Thread ydjango

There is really no need to pass anything to __init__ in form

In view itself you can access the forms member/global variables. It is
python, so not much is private. unlike java.
(other way would be to create setter methods in form, if you are an OO
purist)

in the View itself, I added
 form = NewCaseForm()
 form.fields['owner'].queryset =
Participant.objects.filter(group__exact=my_group)

and it works. If I am missing some nuance which can cause issues later
on , please let me know.

Ashish

On Apr 9, 12:21 pm, ydjango <[EMAIL PROTECTED]> wrote:
> I need to load ChoiceField in form from table and need it to be
> filtered based on parameter.
>
> Following seemed like a good way and works for forms.form , I can
> replace object.all() by objects.filter() and pass an arg to __init_
>
> But it works for class ContactUs(form.Form) but NOT for
> ContactUs(ModelForm). For model form I get value in choice dropdown as
> "Contact_Topics Object" rather than the display_desc
>
> Looks like it is common need with no good documented answers.
>
> Any clues,
> Ashish
>
> (ModelChoiceField does not appear to have an easy way of filter
> parameterizing the query set.)
>
> def __init__(self, *args, **kwargs):
> super(ContactUs, self).__init__(*args, **kwargs)
>self.fields['topic'].choices =  [(topic.topic_name,
> topic.topic_display_desc) for topic in  Contact_Topics.objects.all()]
>
> topic = forms.ChoiceField(widget=forms.Select(attrs=attrs_dict))
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Catch-all route?

2008-04-11 Thread Brandon Taylor

Hi Everyone,

Is there a way to define a catch-all route to send people to a 404
page? Obviously I need to define a route that matches anything not
previously defined, but am struggling with the RegEx to do so.

Help appreciated!
Brandon
--~--~-~--~~~---~--~~
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: Tricky newforms problem

2008-04-11 Thread Brian Morton

Thanks.  This works perfectly.

Is there a better way to implement what I am trying to do?

Also, does anyone know how I can capture these elements again in the
view when processing the form?  Since there are an arbitrary number of
fields for songs, I don't know how many I should be looking for in
cleaned_data.  Ideally, I need to capture the song ids that were
selected in some kind of iterable datatype, then loop through them and
look them up in the model to get info for output.

On Apr 11, 6:10 am, "Phil Davis" <[EMAIL PROTECTED]> wrote:
> On 11/04/2008, Brian Morton <[EMAIL PROTECTED]> wrote:
> [...]
>
> >  The problem occurs in the template.  I am trying to differentiate
> >  these fields from the other normal fields on the form for presentation
> >  purposes.  I have tried assigning a custom property to each of the
> >  dynamic fields.
>
> >  field = forms.BooleanField(label='%s (%s)' % (song.title, " &
> >  ".join([str(artist) for artist in song.artists.all()])))
> >  field.is_song = True
> >  self.fields['song_%s' % song.id] = field
>
> >  However, this custom property is not accessible in the template.  How
> >  can I differentiate these dynamic fields from the others in the
> >  template (with limited access to Python code)?
>
> If your template looks something like:
>
>   {% for field in form %}
> {% if field._is_song %}
> ...
>
> then the for loop 'field' is actually a boundfield instance which
> wraps the real field. To get to the real field use 'field.field' in
> the template. I.e. your template would look like:
>
>{% for field in form %}
>  {% if field.field.is_song %}
> ...
>
> --
> Phil Davis
--~--~-~--~~~---~--~~
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: Application Concepts

2008-04-11 Thread Juanjo Conti

jurian escribió:
> Does anyone else think I should add a ticket request for this as a
> future feature?

I do.

Juanjo
-- 
mi blog: http://www.juanjoconti.com.ar

--~--~-~--~~~---~--~~
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: Allowing html tags for filter.

2008-04-11 Thread James Bennett

On Fri, Apr 11, 2008 at 11:35 AM, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote:
>  I have a custom filter that outputs some html code. The problem is
>  that it converts all "greater than" and "less than" symbols to
>  appropriate  > and < symbols. How is it possible to say to
>  filter not to do this?

Have you read the documentation on writing custom filters? It explains
what's going on and what you need to do...


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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: Allowing html tags for filter.

2008-04-11 Thread Dmitriy Sodrianov

Sure, here it is. It's quite simple.


@register.filter
def show_actions(obj):
ret = '''
execute
edit''' % (obj.id, obj.id)

return ret

Kenneth Gonsalves:
> On 11-Apr-08, at 10:05 PM, Dmitriy Sodrianov wrote:
>
> > I have a custom filter that outputs some html code. The problem is
> > that it converts all "greater than" and "less than" symbols to
> > appropriate  > and < symbols. How is it possible to say to
> > filter not to do this?
>
> unless we see the code of the custom filter we could not give a solution
>
> --
>
> regards
> kg
> http://lawgon.livejournal.com
> http://nrcfosshelpline.in/code/
--~--~-~--~~~---~--~~
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: Allowing html tags for filter.

2008-04-11 Thread Kenneth Gonsalves


On 11-Apr-08, at 10:05 PM, Dmitriy Sodrianov wrote:

> I have a custom filter that outputs some html code. The problem is
> that it converts all "greater than" and "less than" symbols to
> appropriate  > and < symbols. How is it possible to say to
> filter not to do this?

unless we see the code of the custom filter we could not give a solution

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Kenneth Gonsalves


On 11-Apr-08, at 9:42 PM, Jeff Gentry wrote:

> On Fri, 11 Apr 2008, Kenneth Gonsalves wrote:
>>> {% if forloop.counter % 2 %}
>> divisibleby
>
> Actually, he should be using 'cycle'

my reply was simply to let him know that there are such things as  
filters

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




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



Allowing html tags for filter.

2008-04-11 Thread Dmitriy Sodrianov

Hi to all!

I have a custom filter that outputs some html code. The problem is
that it converts all "greater than" and "less than" symbols to
appropriate  > and < symbols. How is it possible to say to
filter not to do this?

Thanks.
--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Norman Harman

Kenneth Gonsalves wrote:
> On 11-Apr-08, at 9:36 PM, Kenneth Gonsalves wrote:
>
>   
>> On 11-Apr-08, at 9:28 PM, Chas. Owens wrote:
>>
>> 
>>> {% if forloop.counter % 2 %}
>>>   
>> divisibleby
>> 
>
> http://www.djangoproject.com/documentation/templates/#divisibleby
>
>   
Wouldn't http://www.djangoproject.com/documentation/templates/#cycle be 
a better solution?  I think it was designed exactly for zebra tables.

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman

___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

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



Music & Movie Download ipod psp

2008-04-11 Thread mattden blowton
Music & Movie Download ipod psp
http://www.web4easy.com/music-movie-download.html

--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Chas. Owens

On Fri, Apr 11, 2008 at 12:13 PM, James Bennett <[EMAIL PROTECTED]> wrote:
>
>  On Fri, Apr 11, 2008 at 11:10 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:
>  >  Alright, call me a moron, but this isn't working.  What am I doing wrong?
>
>  You got bad advice. You want to read the docs on the "cycle" tag,
>  because this specific sort of thing is what it exists for.
snip

Thanks, this seems a lot cleaner:



-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--~--~-~--~~~---~--~~
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: unknown encoding: utf-8 error

2008-04-11 Thread andy baxter

Cephire wrote:
> Thanks Karen. It helped. But I got another error.
>
> AttributeError: 'module' object has no attribute 'admin'. Searching
> through the net, I found that __init.py__ should be present in the
> directory. It does have __init.py__.
>
> Should all directories (like media, templates) have __init.py__?
>
> As I said before, this works fine in development (using the django
> server) and production server too(apache+mod_python).
>
> Thank you,
> Joseph
>   
I think the rule is that every directory including and above the one you 
are referring to up to the point where the directory tree is added to 
the python path should have a __init.py__

As far as I know this doesn't apply to templates, just to .py modules - 
it's a python language thing not a django thing.

--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Jeff Gentry

On Fri, 11 Apr 2008, Kenneth Gonsalves wrote:
> > {% if forloop.counter % 2 %}
> divisibleby

Actually, he should be using 'cycle'


--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread [EMAIL PROTECTED]

Chas,
I think the forloop.counter starts at 1 and forloop.counter0 starts at
0.

On Apr 11, 12:10 pm, "Chas. Owens" <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 12:09 PM, Kenneth Gonsalves<[EMAIL PROTECTED]> wrote:
>
> snip>  >> {% if forloop.counter % 2 %}
>
> >  > divisibleby
>
> >  http://www.djangoproject.com/documentation/templates/#divisibleby
>
> snip
>
> Alright, call me a moron, but this isn't working.  What am I doing wrong?
>
> {% if {{ forloop.counter|divisibleby:"2" }} %}
>
> --
> Chas. Owens
> wonkden.net
> The most important skill a programmer can have is the ability to read.
--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread James Bennett

On Fri, Apr 11, 2008 at 11:10 AM, Chas. Owens <[EMAIL PROTECTED]> wrote:
>  Alright, call me a moron, but this isn't working.  What am I doing wrong?

You got bad advice. You want to read the docs on the "cycle" tag,
because this specific sort of thing is what it exists for.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Chas. Owens

On Fri, Apr 11, 2008 at 12:10 PM, Chas. Owens <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 12:09 PM, Kenneth Gonsalves
>  <[EMAIL PROTECTED]> wrote:
>  snip
>
> >  >> {% if forloop.counter % 2 %}
>  >  >
>  >  > divisibleby
>  >
>  >  http://www.djangoproject.com/documentation/templates/#divisibleby
>  snip
>
>  Alright, call me a moron, but this isn't working.  What am I doing wrong?
>
>  {% if {{ forloop.counter|divisibleby:"2" }} %}
snip

Nevermind, I am a moron, it should be

{% if forloop.counter|divisibleby:"2" %}

Thanks.
-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Chas. Owens

On Fri, Apr 11, 2008 at 12:09 PM, Kenneth Gonsalves
<[EMAIL PROTECTED]> wrote:
snip
>  >> {% if forloop.counter % 2 %}
>  >
>  > divisibleby
>
>  http://www.djangoproject.com/documentation/templates/#divisibleby
snip

Alright, call me a moron, but this isn't working.  What am I doing wrong?

{% if {{ forloop.counter|divisibleby:"2" }} %}


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

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



How to add other class attributes to Admin's fields attribute?

2008-04-11 Thread [EMAIL PROTECTED]

I have a class attribute decorated with the Property decorator.
But I can't add it to the fields attribute of the Admin class, because
it's not a Django field. The reason we want to add it is that we would
want it to appear in a certain order.

How else can I do it?

Thanks
--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Kenneth Gonsalves


On 11-Apr-08, at 9:36 PM, Kenneth Gonsalves wrote:

> On 11-Apr-08, at 9:28 PM, Chas. Owens wrote:
>
>> {% if forloop.counter % 2 %}
>
> divisibleby

http://www.djangoproject.com/documentation/templates/#divisibleby

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~-~--~~~---~--~~
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 do I create a zebra table using a template?

2008-04-11 Thread Kenneth Gonsalves


On 11-Apr-08, at 9:28 PM, Chas. Owens wrote:

> {% if forloop.counter % 2 %}

divisibleby

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




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



how do I create a zebra table using a template?

2008-04-11 Thread Chas. Owens

I am a new Python and Django user, but I have a good deal of
experience in other languages.  I am trying to create a zebra table
(alternating colors for list items or table rows).  The way I would
normally go about this is


{% for greeting in greetings %}
{% if forloop.counter % 2 %}

{% else %}

{% endif %}
On {{ greeting.date }},
{% if greeting.author %}
{{ greeting.author.nickname }} 
wrote:
{% else %}
an anonymous person wrote:
{% endif %}
{{ greeting.content|escape }}

{% endfor %}


But, of course, the if statement can only test a variable for truth.
Is there a way to do this in the template, or am I going to have to
resort to stupid JavaScript tricks?
--~--~-~--~~~---~--~~
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: unknown encoding: utf-8 error

2008-04-11 Thread Cephire

got it resolved by manually importing all __import__ statements.

thanks guys,
joseph
--~--~-~--~~~---~--~~
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.cgi on Linux Hosting

2008-04-11 Thread Karen Tracey
On Fri, Apr 11, 2008 at 9:28 AM, Aldo <[EMAIL PROTECTED]> wrote:

>
> Fair point.
>
> My problem is - Initially i created my index.html in the root(DOCUMENT
> ROOT).
> Now I have downloaded Django as described - put it in my root.
> I have created my .htaccess files as
> RewriteEngine on
> RewriteRule ^cgi-bin/ - [L]
> RewriteRule ^media/ - [L]
> RewriteRule ^(.*)(/)$ cgi-bin/dj/$1/
> RewriteRule ^$ cgi-bin/dj/home/
> Ive created the cgi-bin/dj file and gave permissions.
> However when i try to access that file(http://www.musicischarity.com/
> cgi-bin/dj ) it gives me an
> error -  Error 500: Internal Server Error


You are not supposed to access the script directly like this.  Rather you
are supposed to use your application's normal urls (e.g.
http://www.muicscharity.com/admin/ for, say, the Django admin app), and the
RewriteRules convert that to an invocation of your dj script.


>
> (Usually I would have content-type in it - but its not in the
> examples. tried it and still no good.)
> The dj file was edited to contain my own details. paths etc. maybe i
> have them wrong.
> sys.path.append("/hsphere/local/home/musicisc/Django-0.96")
> sys.path.append("/hsphere/local/home/musicisc")
> and
> # Change this to the directory above your site code.
> sys.path.append("/hsphere/local/home/musicisc/Django-0.96/")
> os.chdir("/hsphere/local/home/musicisc/Django-0.96/")
> # Change mysite to the name of your site package
> os.environ['DJANGO_SETTINGS_MODULE'] = 'musicischarity.settings'
> run_with_cgi(django.core.handlers.wsgi.WSGIHandler())
>
> I am not sure anyone will be able to help - but my alternative is to
> give up - ive been working on this for hours.
>

CGI is not at all a recommended way to run Django (see the discussion in
http://code.djangoproject.com/ticket/2407) but it seems it can be made to
work after a fashion if it's your only option.

Karen


>
> On Apr 11, 1:23 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> > On Fri, Apr 11, 2008 at 6:48 AM, Aldo <[EMAIL PROTECTED]> wrote:
> >
> > > Hi folks I have a linux hosting account with digiweb. I want to run my
> > > django app on it - but am running into problems.
> >
> > >http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle.
> ..
> >
> > >http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-.
> ..
> >
> > > I am trying to follow examples such as below but to no avail. Could
> > > anyone be able to help me out? or give me pointers?
> >
> > You provide links to two sites with detailed instructions on how to do
> what
> > you are interested in, but no details on what trouble you have run into
> > trying to follow those instructions.  It's rather hard to provide any
> > guidance with no clues as to what isn't working.
> >
> > Karen
> >
>

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



Django on plesk - Virtual Host

2008-04-11 Thread martyn

Hi,

I'm just copying my django project on my Fedora-Plesk server and
something is missing in my mind.
All my projects are Virtual hosts.

My main domain :
domain.fr

My django project :
django.domain.fr

And my medias :
medias.domain.fr

On plesk, you cannot write directly on the httpd.conf because it's
overwriten by plesk itself, you have to add other vhost.conf files on
each subdomains.

Plesk did that for me into the httpd.conf file :


ServerName   django.domain.fr:80
DocumentRoot /var/www/vhosts/domain.fr/subdomains/django/
httpdocs
CustomLog  /var/www/vhosts/domain.fr/statistics/logs/
access_log plesklog
ErrorLog   /var/www/vhosts/domain.fr/statistics/logs/error_log

SSLEngine off



php_admin_flag engine off


php_admin_flag engine off



SetHandler python-program
PythonHandler   mod_python.cgihandler


Options -Includes -ExecCGI



I'm not allow to modify this file.
In my own vhost.conf, what do I have to write ?
I tried this (and other derivated from 
http://www.djangoproject.com/documentation/modpython/)
:


ServerName django.domain.fr
SetEnv DJANGO_SETTINGS_MODULE myproject.settings


With no success.
I really want to improve my knowledge into Django Deployement on
apache.
Thanks in advance.

Martyn

--~--~-~--~~~---~--~~
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 middleware appropriate for this?

2008-04-11 Thread Panos Laganakos

Thanks for the link Chris, but this is not what I'm trying to do. I'm
not worried about the way the price look, but the price currency
itself. Since the user is allowed to select that per session.

If there's a way for a filter to access the session variables I would
be OK, since instead of multiplying with the currency passed to the
filter like the post above (product.price|currency:"EUR"), I could
just do product.price|session_currency or something and have the
filter return the price multiplied with the session's currency.

On Apr 11, 5:18 pm, "Chris Moffitt" <[EMAIL PROTECTED]> wrote:
> Take a look at what we use in Satchmo. Maybe this will help -
>
> http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop...
>
> -Chris
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



FilePathField problem

2008-04-11 Thread Michael Ang

Hi,
I found that FilePathField does not detect new files or deleted 
files on the destinate path. I have to restart Django for it to get the 
new files, anyone can help?
Thanks.
:]Michael
<<

--~--~-~--~~~---~--~~
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: unknown encoding: utf-8 error

2008-04-11 Thread Cephire

Thanks Karen. It helped. But I got another error.

AttributeError: 'module' object has no attribute 'admin'. Searching
through the net, I found that __init.py__ should be present in the
directory. It does have __init.py__.

Should all directories (like media, templates) have __init.py__?

As I said before, this works fine in development (using the django
server) and production server too(apache+mod_python).

Thank you,
Joseph




On Apr 11, 5:02 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 4:54 AM, Cephire <[EMAIL PROTECTED]> wrote:
>
> > Hello all:
> > I have the below in models.py
>
> > class solForm(ModelForm):
> >"""
>
> >"""
> >body = forms.CharField(max_length=150,
> > widget=forms.Textarea(attrs={'rows':2, 'cols': 40}),label= u'Your
> > Sol:')
> >author = forms.CharField(widget=forms.HiddenInput)
> >date = forms.CharField(widget=forms.HiddenInput)
> >group = forms.CharField(widget=forms.HiddenInput)
>
> >class Meta:
> >model = sol
>
> > This works fine.
>
> > However when I try to package via cx_freeze and run the executable, it
> > throws the error as:
>
> > Traceback (most recent call last):
> >  File "C:\django_projects\initscripts\console.py", line 27, in
> > 
> >exec code in m.__dict__
> >  File "sol.py", line 7, in 
> >  File "cool\sol\models.py", line 103, in 
> >  File "cool\sol\models.py", line 107, in solForm
> >  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
> > 129, in _
> > _init__
> >super(CharField, self).__init__(*args, **kwargs)
> >  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
> > 70, in __
> > init__
> >self.help_text = smart_unicode(help_text or '')
> >  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
> > 37, in sma
> > rt_unicode
> >return force_unicode(s, encoding, strings_only, errors)
> >  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
> > 58, in for
> > ce_unicode
> >s = s.decode(encoding, errors)
> > LookupError: unknown encoding: utf-8
>
> > I'm lost. Any help to identify the problem and a possible resoultion?
>
> It would seem you have to explicitly tell cx_Freeze what encodings your
> program is going to need.  See this thread on the cx-freeze-users mailing
> list:
>
> http://sourceforge.net/mailarchive/forum.php?thread_name=aed435370803...
>
> Karen
--~--~-~--~~~---~--~~
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 middleware appropriate for this?

2008-04-11 Thread Chris Moffitt
Take a look at what we use in Satchmo. Maybe this will help -

http://www.satchmoproject.com/trac/browser/satchmo/trunk/satchmo/shop/templatetags/satchmo_currency.py

-Chris

--~--~-~--~~~---~--~~
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: Link that performs an action

2008-04-11 Thread Norman Harman

Taylor wrote:
> Thanks for the replies, but I guess I didn't make myself clear
> enough.  Counter was just as an example, I don't want an actual page
> counter.
>
> I guess part of my question is:  Yes, I can use AJAX-y XMLHttpRequest
> to send info to the server in the background, but has someone done
> this already in django somewhere and posted code that can be plugged
> in?
>
> The idea is to have a view like this:
> def my_view(request,num=0):
>  counter = Counter.objects.get(id=someid)
>  counter.count += num
>  counter.save()
>  # setup view stuff
>
> but without specifying num in the URL or having to use a  in my
> template.
>
> Thanks
>
>   
If num isn't in the URL and it isn't a GET/POST parameter, where is it 
coming from?

For front end of AJAX, use whatever Javascript lib/code you like, Jquery 
is my choice. Django doesn't come with or dictate a particular one.  The 
back end, Django part, of AJAX works exactly like any other view but 
return JSON or XML data instead of HTML.

def my_view(request)
data = simplejson.dumps(Model.objects.filter(somefilter=whatever))
return HttpResponse(data, mimetype="text/javascript")

or
http://www.djangoproject.com/documentation/serialization/

-- 
Norman J. Harman Jr.  512 912-5939
Technology Solutions Group, Austin American-Statesman

___
Get out and about this spring with the Statesman! In print and online,
the Statesman has the area's Best Bets and recreation events.
Pick up your copy today or go to statesman.com 24/7.

--~--~-~--~~~---~--~~
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.cgi on Linux Hosting

2008-04-11 Thread Aldo

Fair point.

My problem is - Initially i created my index.html in the root(DOCUMENT
ROOT).
Now I have downloaded Django as described - put it in my root.
I have created my .htaccess files as
RewriteEngine on
RewriteRule ^cgi-bin/ - [L]
RewriteRule ^media/ - [L]
RewriteRule ^(.*)(/)$ cgi-bin/dj/$1/
RewriteRule ^$ cgi-bin/dj/home/
Ive created the cgi-bin/dj file and gave permissions.
However when i try to access that file(http://www.musicischarity.com/
cgi-bin/dj) it gives me an error -  Error 500: Internal Server Error
(Usually I would have content-type in it - but its not in the
examples. tried it and still no good.)
The dj file was edited to contain my own details. paths etc. maybe i
have them wrong.
sys.path.append("/hsphere/local/home/musicisc/Django-0.96")
sys.path.append("/hsphere/local/home/musicisc")
and
# Change this to the directory above your site code.
sys.path.append("/hsphere/local/home/musicisc/Django-0.96/")
os.chdir("/hsphere/local/home/musicisc/Django-0.96/")
# Change mysite to the name of your site package
os.environ['DJANGO_SETTINGS_MODULE'] = 'musicischarity.settings'
run_with_cgi(django.core.handlers.wsgi.WSGIHandler())

I am not sure anyone will be able to help - but my alternative is to
give up - ive been working on this for hours.

On Apr 11, 1:23 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Apr 11, 2008 at 6:48 AM, Aldo <[EMAIL PROTECTED]> wrote:
>
> > Hi folks I have a linux hosting account with digiweb. I want to run my
> > django app on it - but am running into problems.
>
> >http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle...
>
> >http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-...
>
> > I am trying to follow examples such as below but to no avail. Could
> > anyone be able to help me out? or give me pointers?
>
> You provide links to two sites with detailed instructions on how to do what
> you are interested in, but no details on what trouble you have run into
> trying to follow those instructions.  It's rather hard to provide any
> guidance with no clues as to what isn't working.
>
> Karen
--~--~-~--~~~---~--~~
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 middleware appropriate for this?

2008-04-11 Thread Panos Laganakos

Dan, I don't think context_processors will do any good, since I'd have
to load each product and its price on the context.

imagine a model:

Product(models.Model):
price = models.FloatField(...)

and a

Currency(models.Model):
code = models.CharField(maxlength=3) # USD, YEN, etc
factor = models.FloatField(...) # defines the difference to euro

and in a template I do:

{% for product in product_list %}
{{ product.name }}
{{ product.price|currency:"EUR" }}
...
{% endfor %}

All that does, is take the product price and multiply it with the
currency's factor.

I've already set up a context_processor which registers CURRENCY,
which the user can set his preferred currency (EUR, USD, etc).

But since I cannot do {{ product.price|currency:{{ CURRENCY }} }}, as
only strings are allowed, and filters don't have access to context
variables or the request session, I am wondering if middleware is the
answer here. But I have no prior middleware experience :)

Maybe a template tag would do it, not sure if it gets access to the
request.

On Apr 11, 2:55 pm, Dan Ellis <[EMAIL PROTECTED]> wrote:
> On Apr 11, 11:37 am, Panos Laganakos <[EMAIL PROTECTED]>
> wrote:
>
> > I'm wondering if working on a
> > middleware, `process_view` or something would be the right place to
> > make the conversion.
>
> Not a middleware, but a context 
> processor.http://www.djangoproject.com/documentation/templates_python/#subclass...
> You write a function that takes a request as an argument (therefore
> giving you your session) and returns a dictionary of items to be
> merged into the template's context, which is of course available to
> your template tag.
--~--~-~--~~~---~--~~
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: Overwriting RSS item links

2008-04-11 Thread Ian Lawrence

On Fri, Apr 11, 2008 at 7:40 AM, Ian Lawrence <[EMAIL PROTECTED]> wrote:
> Hi
>
> > Is there any way I can change this behaviour as I need to overwrite the URL
>  > completely to something like
>  you could do something like in settings.py:
>  ROOT_URL = whogotmassive.com
>
>  and in your feed.py:
>  link = "%s/balls" % settings.ROOT_URL

sorry ...forgot this bit too:
def item_link(self, obj):
return  '%s' % (self.link)

Ian

-- 
http://ianlawrence.info

--~--~-~--~~~---~--~~
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.cgi on Linux Hosting

2008-04-11 Thread Karen Tracey
On Fri, Apr 11, 2008 at 6:48 AM, Aldo <[EMAIL PROTECTED]> wrote:

>
> Hi folks I have a linux hosting account with digiweb. I want to run my
> django app on it - but am running into problems.
>
>
> http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=110&nav=0,21
>
> http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-using-djangocgi/
>
> I am trying to follow examples such as below but to no avail. Could
> anyone be able to help me out? or give me pointers?
>

You provide links to two sites with detailed instructions on how to do what
you are interested in, but no details on what trouble you have run into
trying to follow those instructions.  It's rather hard to provide any
guidance with no clues as to what isn't working.

Karen

--~--~-~--~~~---~--~~
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: Using form wizard to complete form over multiple sessions

2008-04-11 Thread Honza Král
if you are using the wizard class, it doesn't remember the state
anywhere, so if you supply the correct POST data, you will get thrown
exactly to the point you wanted to be. The only thing you have to do
is save the form data somewhere (perhaps just pickle the POST in a
database), retrieve them later and create the form (see Wizard.render
and render_template how the data is passed to the template).

hope this helps

On Mon, Mar 31, 2008 at 11:54 PM, leifbyron <[EMAIL PROTECTED]> wrote:
>
>  Hi there,
>
>  I have a 20-step form wizard that many users prefer to complete over
>  multiple sessions. I am considering adding save_for_later() and
>  resume_form_wizard() functions that would save the serialized form
>  data to the database, and allow users to resume the wizard at a later
>  time.
>
>  Has anyone tried this? Any advice/thoughts?
>
>  Best,
>  Leif
>
>
>  >
>



-- 
Honza Král
E-Mail: [EMAIL PROTECTED]
ICQ#: 107471613
Phone: +420 606 678585

--~--~-~--~~~---~--~~
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: unknown encoding: utf-8 error

2008-04-11 Thread Karen Tracey
On Fri, Apr 11, 2008 at 4:54 AM, Cephire <[EMAIL PROTECTED]> wrote:

>
> Hello all:
> I have the below in models.py
>
> class solForm(ModelForm):
>"""
>
>"""
>body = forms.CharField(max_length=150,
> widget=forms.Textarea(attrs={'rows':2, 'cols': 40}),label= u'Your
> Sol:')
>author = forms.CharField(widget=forms.HiddenInput)
>date = forms.CharField(widget=forms.HiddenInput)
>group = forms.CharField(widget=forms.HiddenInput)
>
>class Meta:
>model = sol
>
> This works fine.
>
> However when I try to package via cx_freeze and run the executable, it
> throws the error as:
>
> Traceback (most recent call last):
>  File "C:\django_projects\initscripts\console.py", line 27, in
> 
>exec code in m.__dict__
>  File "sol.py", line 7, in 
>  File "cool\sol\models.py", line 103, in 
>  File "cool\sol\models.py", line 107, in solForm
>  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
> 129, in _
> _init__
>super(CharField, self).__init__(*args, **kwargs)
>  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
> 70, in __
> init__
>self.help_text = smart_unicode(help_text or '')
>  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
> 37, in sma
> rt_unicode
>return force_unicode(s, encoding, strings_only, errors)
>  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
> 58, in for
> ce_unicode
>s = s.decode(encoding, errors)
> LookupError: unknown encoding: utf-8
>
> I'm lost. Any help to identify the problem and a possible resoultion?
>
>
It would seem you have to explicitly tell cx_Freeze what encodings your
program is going to need.  See this thread on the cx-freeze-users mailing
list:

http://sourceforge.net/mailarchive/forum.php?thread_name=aed435370803011441o54721ecfke10cc5f8db7abd3c%40mail.gmail.com&forum_name=cx-freeze-users

Karen

--~--~-~--~~~---~--~~
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 middleware appropriate for this?

2008-04-11 Thread Dan Ellis

On Apr 11, 11:37 am, Panos Laganakos <[EMAIL PROTECTED]>
wrote:

> I'm wondering if working on a
> middleware, `process_view` or something would be the right place to
> make the conversion.

Not a middleware, but a context processor.
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext
You write a function that takes a request as an argument (therefore
giving you your session) and returns a dictionary of items to be
merged into the template's context, which is of course available to
your template tag.

--~--~-~--~~~---~--~~
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: Overwriting RSS item links

2008-04-11 Thread Ian Lawrence

Hi
> Is there any way I can change this behaviour as I need to overwrite the URL
> completely to something like
you could do something like in settings.py:
ROOT_URL = whogotmassive.com

and in your feed.py:
link = "%s/balls" % settings.ROOT_URL

the challenging thing for me now is trying to use the
request.META('HTTP_HOST') variable as the ROOT_URL to prevent this
extra configuration setup step in settings.py and the need for the
sites table setup in the admin. I believe this is possible in svn
using RequestSite but i need it working on 0.96. I am thinking call
some template to get the variable and pass it back into the view but i
have not yet fully thought out the technique...any advice is obviously
welcome
Ian

-- 
http://ianlawrence.info

--~--~-~--~~~---~--~~
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: Two sites, one django project

2008-04-11 Thread andy baxter

Hello,

I've been thinking about this - probably the best way is if you can find 
something built into django (like the i18n framework) which will do 
this, but failing that you could try this:

- for the templates, just have two sets of templates, one for each site.
- for strings that are written into the python code, you could do it by 
defining a file (call it 'site-strings.py'), which looks something like 
this:

site_strings={
'search_error': 'There is an error in your search parameters',
'search_help': 'Enter a title of a video to search for',
...
}

Then in any file where you need to generate hard coded strings, instead 
of putting the string in directly, first import site-strings.py, then 
refer to the string from the site_strings dictionary.

If you want to have the same django instance running both sites, you 
could adapt the above by expanding the dictionary to include a 
sub-dictionary for each word:

i.e.:

site_strings={
'search_help': {
videosite: 'enter a title of a video to search for',
   musicsite: 'enter a title of an album to search for'
   }

}

The only problem (I can see) with this method is it might make it hard 
to later on add i18n alternate language functionality to your code using 
the django framework for that.

andy.


Polat Tuzla wrote:
> Hi,
> I'd like to build two sites, say, two polls sites, each having their
> own domain name. Their functionalities are almost exactly the same.
> They're different only by theme. By theme, I mean both the site design
> (visual theme) and the site messages. For example one is for polls
> about music and the other is about videos.
>
> I'd like to be able to use the same source code (i.e same django
> project) for running both of these sites for the ease of maintenance.
> This may be by running either a single instance of django, or two. But
> again, I'd prefer single instance for the ease of administration. This
> would also let me have a single sign-on functionality as a side
> effect.
>
> The site message strings are scattered in models, views  and template
> files. I don't want to duplicate any of these codes just for the sake
> of alternating between different messages. I tried to find a way out,
> by using sites framework, but wasn't able to without actually
> duplicating views and templates.
> Another option was using i18n, and two different translation files
> between two django instances. But this only works for languages other
> than English, I guess.
>
> What exact way of achieving this would you suggest me?
> I've been doing research on this for quite a long time, but really
> could not come up with a solution. Any suggestion is greatly
> appreciated, even those like "don't do this, duplicate the project" :)
> Thanks,
>
> >
>
>   


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



Django.cgi on Linux Hosting

2008-04-11 Thread Aldo

Hi folks I have a linux hosting account with digiweb. I want to run my
django app on it - but am running into problems.

http://care.register365.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=110&nav=0,21
http://seamusc.com/blog/2007/jun/11/how-get-django-working-digiwebie-using-djangocgi/

I am trying to follow examples such as below but to no avail. Could
anyone be able to help me out? or give me pointers?

--~--~-~--~~~---~--~~
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: tutorial question

2008-04-11 Thread James Bennett

On Fri, Apr 11, 2008 at 5:20 AM, sebey <[EMAIL PROTECTED]> wrote:
>  i am on a mac and I am running a podcasting network so I will proabley
>  be storing all my files in XML/RSS

I think you're suffering from very severe conceptual confusion.

Take a podcast and think about it logically:

Each podcast has a name.
Each podcast has one or more "authors".
Each podcast has one or more "episodes".

Each "episode" has a publication date and an audio file, and maybe
some other metadata.

The logical way to build this, then, is to set up database tables
which store this information, and then query it to dynamically
generate an up-to-date feed, and that (modeling data for storage in a
database, inserting it through a web-based interface, querying it back
out again and rendering it into the output format of your choice
through a templating system) is what Django is good at.


-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

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



Is middleware appropriate for this?

2008-04-11 Thread Panos Laganakos

I've written a currency filter that takes the 3 letter code of a
currency and gives you the price.

{{ product.price|currency:"EUR" }}

There's a context variable called CURRENCY which specifies the current
session's currency.

I'm not able to pass that variable in the filter itself instead of a
string, so I'm curious how to make this happen.

I don't want to do it in the model level (maybe defining a OneToMany
with each currency to price), so I'm wondering if working on a
middleware, `process_view` or something would be the right place to
make the conversion.
--~--~-~--~~~---~--~~
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: tutorial question

2008-04-11 Thread sebey

i am on a mac and I am running a podcasting network so I will proabley
be storing all my files in XML/RSS

On Apr 11, 11:11 am, Brett Parker <[EMAIL PROTECTED]>
wrote:
> On 11 Apr 01:35, sebey wrote:
>
>
>
> > I see that in page 1 of the django tutorial in the django docs it sets
> > you up with a database
>
> > can you skip this or is the a very easy way to get a database setup
> > and then uninstaill or is the another tutorial that you can learn
> > without a database needed?
>
> You'll be wanting a database, that's where the models store their data.
> If you don't want anything too complicated, sqlite would probably be the
> easiest to set up (depending on what OS you're using etc).
>
> Thanks,
> --
> Brett Parker
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Troubles with JavaScript localization

2008-04-11 Thread Peter Melvyn

Hi all,

perhaps I've missed something important in my very-beginning with
Django, because I encouter a problems with JavaScript localization.

1. I serve .js as a static files directly by Apache, so they reside on
MEDIA_ROOT out of project/apps folder tree

-> I cannot build message files. I need to move .js files among
remaining source files and do manual deployment of those files
into proper location on MEDIA_ROOT

2.  Once .js moved, I can build them into myproject/locale/ folders,
 by I cannot refer them from templates - if I enter 'myproject', it does
 not work. I have to move locale folder into next level, eg.
 'myproject.myapp' to be found.

###

ad 1. What is a recommended way to manage .JS files in Django projects?
ad 2. Is there a way how to refer project level locales or they can reside
  just on application level only?


Thanks, Peter

--~--~-~--~~~---~--~~
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: tutorial question

2008-04-11 Thread Brett Parker

On 11 Apr 01:35, sebey wrote:
> 
> I see that in page 1 of the django tutorial in the django docs it sets
> you up with a database
> 
> can you skip this or is the a very easy way to get a database setup
> and then uninstaill or is the another tutorial that you can learn
> without a database needed?

You'll be wanting a database, that's where the models store their data.
If you don't want anything too complicated, sqlite would probably be the
easiest to set up (depending on what OS you're using etc).

Thanks,
-- 
Brett Parker

--~--~-~--~~~---~--~~
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: Tricky newforms problem

2008-04-11 Thread Phil Davis

On 11/04/2008, Brian Morton <[EMAIL PROTECTED]> wrote:
[...]
>  The problem occurs in the template.  I am trying to differentiate
>  these fields from the other normal fields on the form for presentation
>  purposes.  I have tried assigning a custom property to each of the
>  dynamic fields.
>
>  field = forms.BooleanField(label='%s (%s)' % (song.title, " &
>  ".join([str(artist) for artist in song.artists.all()])))
>  field.is_song = True
>  self.fields['song_%s' % song.id] = field
>
>  However, this custom property is not accessible in the template.  How
>  can I differentiate these dynamic fields from the others in the
>  template (with limited access to Python code)?

If your template looks something like:

  {% for field in form %}
{% if field._is_song %}
...

then the for loop 'field' is actually a boundfield instance which
wraps the real field. To get to the real field use 'field.field' in
the template. I.e. your template would look like:

   {% for field in form %}
 {% if field.field.is_song %}
...

-- 
Phil Davis

--~--~-~--~~~---~--~~
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: middleware that works with Ajax

2008-04-11 Thread Chris Hoeppner

Russ for president!

This is actually one of the big reasons to prefer django over and above
so many other frameworks. Take rails for example. You *can* use whatever
js stuff you fancy, but if you don't use *their* stuff, you're giving up
on much of what the framework offers.

~ Chris
El jue, 10-04-2008 a las 07:50 +0800, Russell Keith-Magee escribió:
> On Thu, Apr 10, 2008 at 6:42 AM, Todd O'Bryan <[EMAIL PROTECTED]> wrote:
> >
> > On Wed, Apr 9, 2008 at 6:54 AM, Russell Keith-Magee <[EMAIL PROTECTED]>
> > wrote:
> > > On Wed, Apr 9, 2008 at 1:47 AM, andy baxter
> > > >
> > > >  Do you mean middleware specifically written for django? If so not sure,
> > > >  but it might be worth looking at dojo (http://www.dojotoolkit.org/). It
> > > >  is a javascript toolkit which provides an API to make cross platform
> > > >  programming easier, and also supports ajax and a variety of widgets. I
> > > >  think it will be the official javascript toolkit of django at some
> > point
> > > >  as well.
> > >
> > > No, it won't. The Core devs have said on a number of occasions that we
> > > aren't in the business of recommending JS toolkits, and I don't think
> > > that position will change any time soon.
> > >
> > Isn't some JS toolkit getting used in newforms-admin?
> 
> Not to the best of my knowledge. There is some javascript, but it has
> all been custom written.
> 
> Yours,
> Russ Magee %-)
> 
> > 


--~--~-~--~~~---~--~~
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: app engine db backend project

2008-04-11 Thread Chris Hoeppner

I've been looking into this too last night. Though I never before looked
into a backend and I'm not on qsrf branch, after looking into the
trunk's backends, I can tell that they're a tad over my head.

It's a shame that this is not documented (though I'm not whining at the
devs for not writing it, I recon there are more important things to do
than document maybe-unstable low-level components).

If I can do anyhing to help, I'm in.

~ Chris

El mar, 08-04-2008 a las 15:00 -0700, Greg Taylor escribió:
> This would be great, I'd love to see this although I'm not really
> experienced enough to help much.
> 
> On Apr 8, 10:21 am, "Peter Baumgartner" <[EMAIL PROTECTED]> wrote:
> > Anybody interested in starting an app engine/big table db backend
> > project? Should be interesting and might help pave the way for some
> > other non-traditional databases like CouchDB or SimpleDB. While I'm
> > not a database expert, I'm sure I can chip in.
> >
> > It seems like most of the basic functionality is already there and
> > more advanced queries could be simulated with multiple queries and
> > some magic on the backend.
> >
> > --
> > Pete
> > 


--~--~-~--~~~---~--~~
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: [OT] Django based full fledged forum app

2008-04-11 Thread Jonathan Buchanan

On Thu, Apr 10, 2008 at 6:12 PM, myst3rious <[EMAIL PROTECTED]> wrote:
>
>  Hi,
>  I am working on a Django project for Intranet. and I took a lots time
>  in developing apps, just opposite to the Django philosophy of quick
>  but clean development. That is completely my fault, and overtime in
>  requirement analysis and application architecture design.
>  Now, I need to create/integrate a good Forum application. I don't
>  think it feasible to start working a new way, and neither do I respect
>  reinventing the Wheel.
>  I looked into google and google-code, there are some listed as Django
>  based forum. But I could not find the exact what I am looking for.
>
>  I am looking for a full-fledged forum, something like vBulletine
>  (because discussion about it rated vBulletine as best).
>  I am preferring Django based app.
>  Otherwise, I would go with SimpleMachineForum (SMF). So if the django-
>  app for forum is not available, please tell me how to integrate the
>  SMF with django (session and authetication sharing).
>  Thanks a lot in advance.

Have you seen this wiki page?

http://code.djangoproject.com/wiki/ForumAppsComparison

Regards,
Jonathan.

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



unknown encoding: utf-8 error

2008-04-11 Thread Cephire

Hello all:
I have the below in models.py

class solForm(ModelForm):
"""

"""
body = forms.CharField(max_length=150,
widget=forms.Textarea(attrs={'rows':2, 'cols': 40}),label= u'Your
Sol:')
author = forms.CharField(widget=forms.HiddenInput)
date = forms.CharField(widget=forms.HiddenInput)
group = forms.CharField(widget=forms.HiddenInput)

class Meta:
model = sol

This works fine.

However when I try to package via cx_freeze and run the executable, it
throws the error as:

Traceback (most recent call last):
  File "C:\django_projects\initscripts\console.py", line 27, in

exec code in m.__dict__
  File "sol.py", line 7, in 
  File "cool\sol\models.py", line 103, in 
  File "cool\sol\models.py", line 107, in solForm
  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
129, in _
_init__
super(CharField, self).__init__(*args, **kwargs)
  File "C:\Python25\lib\site-packages\django\newforms\fields.py", line
70, in __
init__
self.help_text = smart_unicode(help_text or '')
  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
37, in sma
rt_unicode
return force_unicode(s, encoding, strings_only, errors)
  File "C:\Python25\lib\site-packages\django\utils\encoding.py", line
58, in for
ce_unicode
s = s.decode(encoding, errors)
LookupError: unknown encoding: utf-8

I'm lost. Any help to identify the problem and a possible resoultion?

Thank you all,
Joseph
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



tutorial question

2008-04-11 Thread sebey

I see that in page 1 of the django tutorial in the django docs it sets
you up with a database

can you skip this or is the a very easy way to get a database setup
and then uninstaill or is the another tutorial that you can learn
without a database needed?
--~--~-~--~~~---~--~~
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: Tree from the model.

2008-04-11 Thread shabda


Though I do not always use a reusable app, even if it exists, (leaky
abstractions[1]), django-mptt is awesome. It does what it claims to
do, and stays out of the way. Very recommended if you need to model
hierarchical data.

On Apr 11, 11:43 am, "James Bennett" <[EMAIL PROTECTED]> wrote:
> 2008/4/11 Dmitriy Sodrianov <[EMAIL PROTECTED]>:
>
> >  Is it possible to use only Django's built-in functions?
>
> Yes, but you will end up essentially re-implementing all the code in
> the application Alex suggested.
>
> When an application exists that helps you to do what you want, it's
> quite silly to go duplicating all the code.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of correct."
--~--~-~--~~~---~--~~
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: [OT] Django based full fledged forum app

2008-04-11 Thread eXt

Have you seen: http://sct.sphene.net/wiki/show/Start/ (see 'Forum'
link for a working forum).

myst3rious napisał(a):
> Hi,
> I am working on a Django project for Intranet. and I took a lots time
> in developing apps, just opposite to the Django philosophy of quick
> but clean development. That is completely my fault, and overtime in
> requirement analysis and application architecture design.
> Now, I need to create/integrate a good Forum application. I don't
> think it feasible to start working a new way, and neither do I respect
> reinventing the Wheel.
> I looked into google and google-code, there are some listed as Django
> based forum. But I could not find the exact what I am looking for.
>
> I am looking for a full-fledged forum, something like vBulletine
> (because discussion about it rated vBulletine as best).
> I am preferring Django based app.
> Otherwise, I would go with SimpleMachineForum (SMF). So if the django-
> app for forum is not available, please tell me how to integrate the
> SMF with django (session and authetication sharing).
> Thanks a lot in advance.
--~--~-~--~~~---~--~~
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: Annoying little bug that just won't stop -- new forms admin

2008-04-11 Thread Dan

I Just had a problem with this and it came down to the PIL component
on my server not having jpeg support, maybe try installing libjpeg and
rebuilding and installing PIL.



On Feb 15, 6:59 am, Michael Newman <[EMAIL PROTECTED]> wrote:
> As I continue to test this, it appears that inlineimagefields don't
> work at all in newforms Admin. Yikes!!! Can someone confirm?
>
> My code:
>
> from django.db import models
>
> class TestObject(models.Model):
> somefield = models.CharField(max_length=100)
>
> class TestObjectImageInline(models.Model):
> test_object = models.ForeignKey(TestObject)
>image= models.ImageField(upload_to='images')
> anotherfield = models.BooleanField(default=True)
>
> from django.contrib import admin
>
> class TestObjectInline(admin.TabularInline):
> model = TestObjectImageInline
>
> class TestObjectAdmin(admin.ModelAdmin):
> model = TestObject
> inlines = [TestObjectInline]
>
> admin.site.register(TestObject, TestObjectAdmin)
>
> On Feb 14, 4:34 pm, Michael Newman <[EMAIL PROTECTED]> wrote:
>
> > I get an 'Uploadavalidimage. Thefileyouuploadedwaseithernot
> > animageor acorruptedimage.' When I try to save a model in the
> > admin. I had this issue in the oldforms admin as well. I was passed to
> > this 
> > article:http://scottbarnham.com/blog/2007/08/22/edit-inline-with-imagefield-o...
> > . The ticket was thrown out because of the anticipation of newforms
> > admin. Odd thing is FileField doesnotthrow the same error.
>
> > Here is my code:
>
> > from django.db import models
>
> > class TestObject(models.Model):
> > somefield = models.CharField(max_length=100)
>
> > class TestObjectImageInline(models.Model):
> > test_object = models.ForeignKey(TestObject)
> >image= models.ImageField(upload_to='images')
>
> > from django.contrib import admin
>
> > class TestObjectInline(admin.TabularInline):
> > model = TestObjectImageInline
>
> > class TestObjectAdmin(admin.ModelAdmin):
> > model = TestObject
> > inlines = [TestObjectInline]
>
> > admin.site.register(TestObject, TestObjectAdmin)
>
> > Can others duplicate? I am planning on filing a ticket but I would
> > like to figure out where it is that the error is being thrown. Any
> > insight on that would be great as well.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Overwriting RSS item links

2008-04-11 Thread Matt Davies
Hello everyone

I have a need to overwrite the item_link of my rss items in my feed.

I'm using the item_link method described here.

http://www.djangoproject.com/documentation/syndication_feeds/

If I use this code

def item_link(self, obj):
return 'balls'

and my site url in djangoadmin  is whogotbig.com

the link that is created for each article is

http://whogotbig.comballs

Is there any way I can change this behaviour as I need to overwrite the URL
completely to something like

http://whogotmassive.com/balls

I can't change the name of the site in django admin as that would break
everything else.

Any tips or advice would be gratefully welcomed.

matt

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