Re: mod_python delivering form data to wrong Django instance?

2007-11-16 Thread Steve Freitas

On Fri, 2007-11-16 at 18:55 -0800, Graham Dumpleton wrote:
> Python leaks environment variables between sub interpreters in certain
> circumstances based on the order in which the sub interpreters are
> created.
> 
> It is described a bit in section 'Application Environment Variables'
> of:
> 
>   http://code.google.com/p/modwsgi/wiki/ApplicationIssues
> 
> That Django mod_python adapter takes req.subprocess_env and pushes
> them into os.environ is not a particularly good thing and can cause
> various problems as a result as you have found.

Ah ha, thanks very much for the explanation, Graham. Yeah, it doesn't
strike me as particularly desireable, but at least now I know how to
work around it. Thanks!

Steve


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



Re: Apache mod_python config problem

2007-11-16 Thread Nimrod A. Abing

On Nov 17, 2007 12:24 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Obviously "mydomain" has been replaced as not to publish my domain
> name.  As you can see in the exception, sys.path includes the location
> of my app.  It still doesn't appear to find settings.py.

Make sure www-data can read and traverse your
/home/published/www/django directory.

You may need to:

chmod 0755 /home/published/www/django

if that still does not work, travel up to /home/published/www and see
if you have the correct permissions. Do:

chmod 0755 /home/published/www

Keep traversing up the directory structure until you get the correct
permissions.

HTH.
-- 
Best Regards,
Nimrod A. Abing

W http://arsenic.ph/
W http://preownedcar.com/
W http://abing.gotdns.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
-~--~~~~--~~--~--~---



Apache mod_python config problem

2007-11-16 Thread [EMAIL PROTECTED]

I've been writing a Django app at work using Windows XP and Apache.
Everything works fine.  When I bring the project home to run on
Ubuntu, I'm having trouble getting Apache configured.  I've worked on
this problem for about a month but can't seem to get it resolved.  It
appears to be fairly common but none of the solutions I've found have
worked.

This works fine on Ubuntu and Windows XP:

$ python manage.py runserver

Shutting down the dev server and going through apache produces this:

  File "/usr/lib/python2.5/site-packages/django/conf/__init__.py",
line 86, in __init__
raise EnvironmentError, "Could not import settings '%s' (Is it on
sys.path? Does it have syntax errors?): %s sys.path = %s" %
(self.SETTINGS_MODULE, e, sys.path)

EnvironmentError: Could not import settings 'musicshare.settings' (Is
it on sys.path? Does it have syntax errors?): No module named
musicshare.settings sys.path = ['/home/published/www/django/', '/home/
published/www/django/musicshare', '/usr/lib/python2.5', '/usr/lib/
python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2',
'/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/
local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-
packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/
python2.5/site-packages/PIL', '/usr/lib/python2.5/site-packages/
gst-0.10', '/var/lib/python-support/python2.5', '/usr/lib/python2.5/
site-packages/gtk-2.0', '/var/lib/python-support/python2.5/gtk-2.0', '/
usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode']


The exception output shows sys.path because I modified Django to
display it.  My app is actually located at "/home/published/www/django/
musicshare"

This is my httpd.conf:


ServerName  music.mydomain.com
DocumentRoot/home/published/www/django
SetHandler  python-program
PythonHandler   django.core.handlers.modpython
PythonDebug On
PythonPath  "['/home/published/www/django/', '/home/
published/www/django/musicshare', '/usr/lib/python2.5'] + sys.path"

SetEnv  DJANGO_SETTINGS_MODULE
musicshare.settings
PythonInterpreter   musicshare



Obviously "mydomain" has been replaced as not to publish my domain
name.  As you can see in the exception, sys.path includes the location
of my app.  It still doesn't appear to find settings.py.

Any ideas?

TIA.
--~--~-~--~~~---~--~~
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: URL/Request Question

2007-11-16 Thread Malcolm Tredinnick


On Fri, 2007-11-16 at 19:19 -0800, [EMAIL PROTECTED] wrote:
> 
> 
> On Nov 17, 4:15 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
> wrote:
> > On Fri, 2007-11-16 at 19:04 -0800, [EMAIL PROTECTED] wrote:
> >
> > [...]
> >
> > > Is there a way to have access to exactly the url used for the request?
> >
> > Seehttp://www.djangoproject.com/documentation/request_response/#methods
> >
> > Looking at the documentation for the "request" object would seem to be
> > an obvious first place to look here. And, sure enough, get_full_path()
> > is documented there.
> >
> > Malcolm
> >
> > --
> > Honk if you love peace and quiet.http://www.pointy-stick.com/blog/
> 
> That's where I started but if I do a request for
> www.example.com/test/?
> the get_full_path() returns
> www.example.com/test/
> which isn't what we are needing in this situation,  I am looking for
> exactly what was requested through the url.

Ah, I see. Then you're doomed. The interface to the web server might not
be passing through enough information for this to be determined. So any
way to do this is going to be very dependent on how you are interacting
with the web server.

Try poking around inside request._req if you're using mod_python or
request.environ if you're using the WSGI handler and maybe you'll get
lucky, but I doubt it (particularly with WSGI, you're not going to be
able to tell the difference between an empty query string and an omitted
query string).

Malcolm

-- 
Atheism is a non-prophet organization. 
http://www.pointy-stick.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: URL/Request Question

2007-11-16 Thread [EMAIL PROTECTED]



On Nov 17, 4:15 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Fri, 2007-11-16 at 19:04 -0800, [EMAIL PROTECTED] wrote:
>
> [...]
>
> > Is there a way to have access to exactly the url used for the request?
>
> Seehttp://www.djangoproject.com/documentation/request_response/#methods
>
> Looking at the documentation for the "request" object would seem to be
> an obvious first place to look here. And, sure enough, get_full_path()
> is documented there.
>
> Malcolm
>
> --
> Honk if you love peace and quiet.http://www.pointy-stick.com/blog/

That's where I started but if I do a request for
www.example.com/test/?
the get_full_path() returns
www.example.com/test/
which isn't what we are needing in this situation,  I am looking for
exactly what was requested through the url.

Any ideas?
--~--~-~--~~~---~--~~
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: URL/Request Question

2007-11-16 Thread Malcolm Tredinnick


On Fri, 2007-11-16 at 19:04 -0800, [EMAIL PROTECTED] wrote:
[...]
> Is there a way to have access to exactly the url used for the request?

See http://www.djangoproject.com/documentation/request_response/#methods

Looking at the documentation for the "request" object would seem to be
an obvious first place to look here. And, sure enough, get_full_path()
is documented there.

Malcolm

-- 
Honk if you love peace and quiet. 
http://www.pointy-stick.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: URL/Request Question

2007-11-16 Thread [EMAIL PROTECTED]



On Nov 16, 11:56 pm, Daniel Roseman <[EMAIL PROTECTED]>
wrote:
> On Nov 16, 9:49 pm, bfrederi <[EMAIL PROTECTED]> wrote:
>
> > I am currently working with a form persistent identifiers. As part of
> > the persistent system, users can add '?' to the end of the urls to
> > receive a data-only view of the digital object they are trying to link
> > to via the persistent identifier, such as this:
> > Normal view:http://ark.cdlib.org/ark:/13030/tf5p30086k
> > Specific data view:http://ark.cdlib.org/ark:/13030/tf5p30086k?
>
> > When using Django, I've found that if I try to put a ? on the end of
> > my urls, it gets lost. It says there is no GET, and I can't seem to
> > differentiate whether there is a '?' on the end of the url or not with
> > any method I am familiar with in Django. Is there any way to get the
> > exact url that was requested ('?' and all)? So that way I know whether
> > they are wanting the normal view or the data view. The '?' is crucial
> > to the system, to keep things homogeneous with everyone else's objects
> > that use this persistent identifying system.
>
> This is almost certainly because you have the APPEND_SLASH setting on,
> and Django is redirecting your /13030/tf5p30086k to /13030/tf5p30086k/
> (appending a slash), in the process of which the GET settings are
> lost.
>
> Try using the URL with the slash already appended - /13030/
> tf5p30086k/?
> --
> DR.

I don't think this is the answer to this problem...
Is there a way to tell if there is a single question mark at the end
of a url given to django?
Is there a way to have access to exactly the url used for the request?
--~--~-~--~~~---~--~~
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: mod_python delivering form data to wrong Django instance?

2007-11-16 Thread Graham Dumpleton

On Nov 17, 6:07 am, Steve Freitas <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Yes, I realize that maybe this should go to the mod_python list instead,
> but I wanted to rule Django out first. Here's my configuration, with
> Apache2 on Linux (sorry I couldn't make this shorter):
>
> I've got four Django sites I host under different domain names, which
> are actually all identical except for the HTML. (It's a simple form
> submission page.) So I'm using a single Django application to serve them
> all. Since they're SSL, I need a different VirtualHost entry for each.
> In addition, I have a fifth instance running under another VirtualHost
> entry as a test site. Again, it is aimed at the same
> .settings file, just like the others.
>
> To set the test site apart from the others, I use Apache's SetEnv
> directive to set 'DJANGO_TEST_MODE' to 1, and then in settings.py, I
> check for the existence of 'DJANGO_TEST_MODE' in os.environ. In that
> case, settings.py sets the database name to "databasename_test". (This
> database is identical to the production database.)
>
> The problem is that when people submit that form from the deployment
> sites, that data intermittently (maybe 5-10% of the time) ends up in the
> test database. I've verified in the logs that their URLs are correct
> deployment URLs, so it's not that.
>
> To fix the problem, I had to set 'DJANGO_TEST_MODE' to 0 in the
> deployment VirtualHost entries, and modify settings.py to check its
> value explicitly.
>
> Is this something that happens when using the same settings file, or
> something? Anyone else seen this?

Python leaks environment variables between sub interpreters in certain
circumstances based on the order in which the sub interpreters are
created.

It is described a bit in section 'Application Environment Variables'
of:

  http://code.google.com/p/modwsgi/wiki/ApplicationIssues

That Django mod_python adapter takes req.subprocess_env and pushes
them into os.environ is not a particularly good thing and can cause
various problems as a result as you have found.

Setting the variable in all virtual host contexts as you are doing is
possibly all you can do when using mod_python if you want to control
it from Apache configuration. Only other option is for settings.py to
import 'mod_python.apache' and look at 'mod_python.apache.interpreter'
and key off the sub interpreter name to work out from table in
settings.py as to what to do. The 'interpreter' attribute is possibly
only available in mod_python 3.3.1.

Graham
--~--~-~--~~~---~--~~
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: attn list admins - [EMAIL PROTECTED]

2007-11-16 Thread Kenneth Gonsalves


On 17-Nov-07, at 7:38 AM, Malcolm Tredinnick wrote:

>> hi,
>> could you remove wilsonlau from the list - his mail box is full
>> again, and I get a bounce from his mailbox every time I send a mail
>> to the list
>
> It's not really a good idea to involuntarily unsubscribe somebody
> (unless they're an obvious spammer), since once they fix the problem
> they won't know they've been unsubscribed. Google automatically  
> disables
> sending to a particular user once a few bounces occur.

oh, did not know that. just that this is the second time his box has  
got full - guess I'll mail him privately once he cleans his box.

-- 

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



--~--~-~--~~~---~--~~
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: attn list admins - [EMAIL PROTECTED]

2007-11-16 Thread Malcolm Tredinnick


On Fri, 2007-11-16 at 17:22 +0530, Kenneth Gonsalves wrote:
> hi,
> could you remove wilsonlau from the list - his mail box is full  
> again, and I get a bounce from his mailbox every time I send a mail  
> to the list

It's not really a good idea to involuntarily unsubscribe somebody
(unless they're an obvious spammer), since once they fix the problem
they won't know they've been unsubscribed. Google automatically disables
sending to a particular user once a few bounces occur.

Malcolm

-- 
Experience is something you don't get until just after you need it. 
http://www.pointy-stick.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 variable(path) and string(file name) in ssi or include tags

2007-11-16 Thread Malcolm Tredinnick


On Thu, 2007-11-15 at 23:50 -0800, timbu wrote:
> I am trying to use variable(path) and string(file name) in ssi or
> include tags.
> 
> In template:
> {{dir}}file.html
> Prints:
> /dir/file.html
> but..
> How to do: {% include /dir/file.html %}
> using {{dir}} variable and string in include or ssi tag?

You don't. Either the full name to include is in the variable, or you
only use a literal string.

Malcolm

-- 
Many are called, few volunteer. 
http://www.pointy-stick.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: Taconite + jquery + Django

2007-11-16 Thread [EMAIL PROTECTED]

Can you please create a simple example.

Maybe you could post it on:

http://www.djangosnippets.org/

When you have it online please let me know.

Best reagards,

Luís

On Nov 8, 4:52 pm, Brian Costlow <[EMAIL PROTECTED]> wrote:
> Just thought I'd pass this along. I've been lurking about learning as
> I work on a couple of Django-based projects, and thought it was time
> to share something back.
>
> I've been having a lot of success with this combination in an app I've
> been tweaking and extending the past week.
>
> It's basically a web-based reporting application, reading out of a
> MySQL db that's updated by other sources.
>
> The first version of this, done a couple of years ago in PHP and JS
> with no framework, did some AJAXy stuff to update parts of the page
> without a full reload.
>
> Version 2 was redone in Django, but the AJAX updates were still hand-
> coded JS. (Django's serializer was used to return JSON for the
> updates).
>
> After hearing Simon talk about jquery at OSCON, the next time I needed
> to make substantial changes, I redid the JS part in jquery, which made
> extending the app with additional reports much simpler. The only
> problem was, parts of the pages had two different sets of code that
> fetched data from the view and formatted the content. On load of the
> full page, a Django template was rendered, on the updates, JSON was
> returned and jquery interpreted the result to modify the DOM. As the
> design evolved, we had to make sure both parts stayed in sync.
>
> I was about to go for pass three, in which the page load didn't fetch
> all of the database data, and all of the AJAX updated content, even on
> initial load, was handled by JSON serializer and jquery.
>
> But I stumbled across the Taconite jquery plug-in. This allows you to
> return an xml file from any jquery AJAX call. The plugin will iterate
> over the XML and make DOM changes, abstracting away the need to define
> callbacks to do these kind of updates.
>
> By using Taconite, I was able to rework our Django templates, with
> careful use of inheritance and includes, so that I could pass in the
> same context, and use the template 'reportn.html' to render a page for
> the browser or 'reportn.xml' to render xml for Taconite.  So now, when
> I get told, for example, to add a column of data to one of the
> reports, I can make the change in a single Django template file, and
> if necessary, modify a single view function. It's an internal app, and
> my employer won't let me post any code, but if anyone is interested in
> this approach, I can work up a simple example and post it.
>
> Info on the plug-in is here:
>
> http://www.malsup.com/jquery/taconite/
--~--~-~--~~~---~--~~
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: Dynamically load objects

2007-11-16 Thread Ramiro Morales

On Nov 16, 2007 8:18 PM, Grupo Django <[EMAIL PROTECTED]> wrote:
>
> Thanks a lot! get _model works.
> Only one thing, I've been reading the code in te file django/db/models/
> loading.py and I don't understand how it works, and now I need to know
> or I won't sleep :-)
>
> What should I do to reference stuff?
>
> app = __import__('app_name',{},{},['models'])
> mods = getattr(app,'models')
> module = getattr(mods,'ModuleIWant')
>
> This actually works, but I'm not sure if it's the right way or the
> "python way".
>

Do you want to reimplement or do you want to use
get_model()?. If the answer is the latter you might
find this article helpful:

http://www.b-list.org/weblog/2007/nov/03/working-models/

Regards,

-- 
 Ramiro Morales

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



Permissions for generic modules

2007-11-16 Thread Grupo Django

I figured out this code to get the permissions of a dynamic module:

def my_view( request ):
...
app_label = module._meta.app_label
add_p = app_label+'.'+module._meta.get_add_permission()
chg_p = app_label+'.'+module._meta.get_change_permission()
del_p = app_label+'.'+module._meta.get_delete_permission()
perm_add = request.user.has_perm( add_p )
perm_chg = request.user.has_perm( chg_p )
perm_del = request.user.has_perm( del_p )

But I think this is ugly, and I'm pretty sure there is a better way
that I can't see now.
Any sugestion?

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: Dynamically load objects

2007-11-16 Thread Grupo Django

Thanks a lot! get _model works.
Only one thing, I've been reading the code in te file django/db/models/
loading.py and I don't understand how it works, and now I need to know
or I won't sleep :-)

What should I do to reference stuff?

app = __import__('app_name',{},{},['models'])
mods = getattr(app,'models')
module = getattr(mods,'ModuleIWant')

This actually works, but I'm not sure if it's the right way or the
"python way".

Thanks.


On 16 nov, 20:56, Doug B <[EMAIL PROTECTED]> wrote:
> I'd love to know if there is a better method, but this is the best I
> could come up with... pretty much the same thing you are doing, but
> forcing the view functions to call 'import_feed' which can only load a
> restricted set of modules.
>
> AVAILABLE_FEEDS =
> {'columbia':'columbia.search','glvar':'glvar.search'}
>
> def import_feed(name):
> if name in AVAILABLE_FEEDS:
> return __import__(AVAILABLE_FEEDS[name])
> else:
> return None
>
> That only gets me the app, so if I do
> feed=import_feed('columbia')
> I still have to reference stuff like feed.search.myfunction() instead
> of feed.myfunction()
>
> Hmm.. now that I reread your post, I might have confused module with
> model.  If so you might want to take a look at:
> from django.db.models.get_model
>
> m=get_model(appname,modelname)
--~--~-~--~~~---~--~~
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: design Q: where to put peoples names

2007-11-16 Thread justquick


> Can the username be Null?
>From the help text on username attr:
"Required. 30 characters or fewer. Alphanumeric characters only
(letters, digits and underscores)."

> What if it was 1,000,000 names, like if I was publishing a phone book?
Then using the user model, which does keep track of a lot more
information than you need (username,email,etc.) and does not keep
track of information you do need (phone,address,etc.). You should
probably come up with your own model/storage mechanism for keeping
track of this data.


On Nov 16, 9:54 am, Carl Karsten <[EMAIL PROTECTED]> wrote:
> Marty Alchin wrote:
> > My first question would be: Are you absolutely certain that none of
> > those 1000 other people will ever need a login?
>
> anything is possible.
>
> I would think at some point it isn't a good idea to use the User table.  What 
> if
> it was 1,000,000 names, like if I was publishing a phone book?
>
>
>
> > Basically, if any of those users would ever need to be promoted to
> > login status, the User model is your best bet. As Samuel mentioned,
> > just set "is_active" to False and probably set the password field to
> > "!" since they wouldn't be expected to supply a password. As for
> > username, you can probably just make a slug out of their real name and
> > use that.
>

>
> Carl K
--~--~-~--~~~---~--~~
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: URL/Request Question

2007-11-16 Thread Daniel Roseman

On Nov 16, 9:49 pm, bfrederi <[EMAIL PROTECTED]> wrote:
> I am currently working with a form persistent identifiers. As part of
> the persistent system, users can add '?' to the end of the urls to
> receive a data-only view of the digital object they are trying to link
> to via the persistent identifier, such as this:
> Normal view:http://ark.cdlib.org/ark:/13030/tf5p30086k
> Specific data view:http://ark.cdlib.org/ark:/13030/tf5p30086k?
>
> When using Django, I've found that if I try to put a ? on the end of
> my urls, it gets lost. It says there is no GET, and I can't seem to
> differentiate whether there is a '?' on the end of the url or not with
> any method I am familiar with in Django. Is there any way to get the
> exact url that was requested ('?' and all)? So that way I know whether
> they are wanting the normal view or the data view. The '?' is crucial
> to the system, to keep things homogeneous with everyone else's objects
> that use this persistent identifying system.

This is almost certainly because you have the APPEND_SLASH setting on,
and Django is redirecting your /13030/tf5p30086k to /13030/tf5p30086k/
(appending a slash), in the process of which the GET settings are
lost.

Try using the URL with the slash already appended - /13030/
tf5p30086k/?
--
DR.
--~--~-~--~~~---~--~~
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: Taconite + jquery + Django

2007-11-16 Thread ashwoods

i am trying to learn jquery + django so a very easy example would be
very useful :)

thx..
ash

On Nov 8, 5:52 pm, Brian Costlow <[EMAIL PROTECTED]> wrote:
> Just thought I'd pass this along. I've been lurking about learning as
> I work on a couple of Django-based projects, and thought it was time
> to share something back.
>
> I've been having a lot of success with this combination in an app I've
> been tweaking and extending the past week.
>
> It's basically a web-based reporting application, reading out of a
> MySQL db that's updated by other sources.
>
> The first version of this, done a couple of years ago in PHP and JS
> with no framework, did some AJAXy stuff to update parts of the page
> without a full reload.
>
> Version 2 was redone in Django, but the AJAX updates were still hand-
> coded JS. (Django's serializer was used to return JSON for the
> updates).
>
> After hearing Simon talk about jquery at OSCON, the next time I needed
> to make substantial changes, I redid the JS part in jquery, which made
> extending the app with additional reports much simpler. The only
> problem was, parts of the pages had two different sets of code that
> fetched data from the view and formatted the content. On load of the
> full page, a Django template was rendered, on the updates, JSON was
> returned and jquery interpreted the result to modify the DOM. As the
> design evolved, we had to make sure both parts stayed in sync.
>
> I was about to go for pass three, in which the page load didn't fetch
> all of the database data, and all of the AJAX updated content, even on
> initial load, was handled by JSON serializer and jquery.
>
> But I stumbled across the Taconite jquery plug-in. This allows you to
> return an xml file from any jquery AJAX call. The plugin will iterate
> over the XML and make DOM changes, abstracting away the need to define
> callbacks to do these kind of updates.
>
> By using Taconite, I was able to rework our Django templates, with
> careful use of inheritance and includes, so that I could pass in the
> same context, and use the template 'reportn.html' to render a page for
> the browser or 'reportn.xml' to render xml for Taconite.  So now, when
> I get told, for example, to add a column of data to one of the
> reports, I can make the change in a single Django template file, and
> if necessary, modify a single view function. It's an internal app, and
> my employer won't let me post any code, but if anyone is interested in
> this approach, I can work up a simple example and post it.
>
> Info on the plug-in is here:
>
> http://www.malsup.com/jquery/taconite/
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



New Program Send Big File Fast and Easy Apply For FREE!!!

2007-11-16 Thread pishate chond
This is New program Send Big File Fast and Easy
Send, Receive and Track files with YouSendIt.
apply for free. be urgent , there is the time limits.

Get Free Code:  Limited Time Only!
http://www.tkqlhce.com/click-2667396-10501907

--~--~-~--~~~---~--~~
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: design Q: where to put peoples names

2007-11-16 Thread Marty Alchin

My first question would be: Are you absolutely certain that none of
those 1000 other people will ever need a login?

Basically, if any of those users would ever need to be promoted to
login status, the User model is your best bet. As Samuel mentioned,
just set "is_active" to False and probably set the password field to
"!" since they wouldn't be expected to supply a password. As for
username, you can probably just make a slug out of their real name and
use that.

Then, if/when they get promoted to full users, you just have to prompt
for a username and password, update those fields and set is_active to
True and you're all set.

-Gul

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



Using variable(path) and string(file name) in ssi or include tags

2007-11-16 Thread timbu

I am trying to use variable(path) and string(file name) in ssi or
include tags.

In template:
{{dir}}file.html
Prints:
/dir/file.html
but..
How to do: {% include /dir/file.html %}
using {{dir}} variable and string in include or ssi 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
-~--~~~~--~~--~--~---



please help

2007-11-16 Thread riaz

Dear All,

Please  see this petition by clicking on the following link,

http://www.Petition Online.com/ freepakn/ petition. html

If you agree all or part of it, please sign and feel free to make
comments. What we have done or not done to deserve this.
regards

Riaz Ahmed


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



Re: Noob Question

2007-11-16 Thread Kenneth Gonsalves


On 16-Nov-07, at 11:14 AM, bdixon wrote:

>  t = loader.get_template(template_name) # You need to create a
> 500.html template.

it is not mac specific, look at the line above

-- 

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



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



attn list admins - [EMAIL PROTECTED]

2007-11-16 Thread Kenneth Gonsalves

hi,
could you remove wilsonlau from the list - his mail box is full  
again, and I get a bounce from his mailbox every time I send a mail  
to the list
-- 

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



--~--~-~--~~~---~--~~
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: Dynamically load objects

2007-11-16 Thread Doug B

I'd love to know if there is a better method, but this is the best I
could come up with... pretty much the same thing you are doing, but
forcing the view functions to call 'import_feed' which can only load a
restricted set of modules.

AVAILABLE_FEEDS =
{'columbia':'columbia.search','glvar':'glvar.search'}

def import_feed(name):
if name in AVAILABLE_FEEDS:
return __import__(AVAILABLE_FEEDS[name])
else:
return None

That only gets me the app, so if I do
feed=import_feed('columbia')
I still have to reference stuff like feed.search.myfunction() instead
of feed.myfunction()

Hmm.. now that I reread your post, I might have confused module with
model.  If so you might want to take a look at:
from django.db.models.get_model

m=get_model(appname,modelname)


--~--~-~--~~~---~--~~
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: design Q: where to put peoples names

2007-11-16 Thread Samuel Adam

Want more info ?

Create a profile model and tie it to the user in settings.py:
AUTH_PROFILE_MODULE = 'profile.UserProfile'

Then you can use
user.get_profile().phone_number for example.

http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/

When i started using Django i made the mistake of wanting to go my
way.
Now, i compromise and go Django's Way.

If you use Django, you are tied to Django's rules and the guys that
made those are very clever.

Now that i understood that, my code is way cleaner and easier to
extend.


On Nov 16, 4:02 pm, justquick <[EMAIL PROTECTED]> wrote:
> > Can the username be Null?
>
> From the help text on username attr:
> "Required. 30 characters or fewer. Alphanumeric characters only
> (letters, digits and underscores)."
>
> > What if it was 1,000,000 names, like if I was publishing a phone book?
>
> Then using the user model, which does keep track of a lot more
> information than you need (username,email,etc.) and does not keep
> track of information you do need (phone,address,etc.). You should
> probably come up with your own model/storage mechanism for keeping
> track of this data.
>
> On Nov 16, 9:54 am, Carl Karsten <[EMAIL PROTECTED]> wrote:
>
> > Marty Alchin wrote:
> > > My first question would be: Are you absolutely certain that none of
> > > those 1000 other people will ever need a login?
>
> > anything is possible.
>
> > I would think at some point it isn't a good idea to use the User table.  
> > What if
> > it was 1,000,000 names, like if I was publishing a phone book?
>
> > > Basically, if any of those users would ever need to be promoted to
> > > login status, the User model is your best bet. As Samuel mentioned,
> > > just set "is_active" to False and probably set the password field to
> > > "!" since they wouldn't be expected to supply a password. As for
> > > username, you can probably just make a slug out of their real name and
> > > use that.
>
> > Carl K
--~--~-~--~~~---~--~~
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: Method 'allow_tags' doesn't work?

2007-11-16 Thread wowar

> Today, after updating django to revision 6678 method 'allow_tags'
> doesn't work. Despite it is set to True I've got html code.

mark_safe() is a solution e.g.

from django.utils.safestring import mark_safe

class Ewidencja(models.Model):
...
data_przyjecia = models.DateField('data przyjęcia')
...

def format_data_przyjecia(self):

return mark_safe('%s' %
(self.data_przyjecia,))

format_data_przyjecia.short_description = 'data przyjęcia'

format_data_przyjecia.allow_tags = True

format_data_przyjecia.admin_order_field = 'data_przyjecia'

--~--~-~--~~~---~--~~
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: Accessing request.user inside a model methods

2007-11-16 Thread Alex Koshelev

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

On 16 нояб, 20:07, "Dan-Cristian Bogos" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Can anyone tell me if it is possible to access logged user instance
> inside a model method, like save() is?
>
> I need to rewrite save() method, so I should have some automatic
> triggers on model.save(), and use information inside
> user.groups.all().
>
> Ta,
> DanB
--~--~-~--~~~---~--~~
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: Redacted Fields

2007-11-16 Thread Tim Chase

> Could you do something like a wrapper object in your view before it
> hits the context?  The wrapper below relies on a field list, but you
> could easily have it inspect the Meta class on the model and build the
> list.

This is a nice sort of idea.  Is there a way to expand it from an
individual item-wrapper to a QuerySet wrapper?  The idea usage
would be something that redacts all objects including
ForeignKey/ManyToMany relationships as well.  Thus, if you have
something like the hypothetical

  class Person(Model):
name = CharField(...)
ssn = CharField(...)
pin = CharField(...)
class Meta:
  redacted = set('ssn', 'pin')

  class Account(Model):
owner = ForeignKey(Person)
acct_no = CharField(...)
balance = DecimalField(...)
class Meta:
  redacted = set('acct_no', 'balance')

and then have the view do something like

  return render_to_response("foo.html",
 RequestContext(request, {
   'people':redact_queryset(request,
   Person.objects.filter(name="Smith"))
 })

where the foo.html template has something like

  {% for person in people %}
  Account Information for
  {{ person.name }}
  ({{ person.ssn }})
  
  The PIN {{ person.name }} is "{{ person.pin }}"
  {% if person.account_set %}
You have the following accounts
  {% for account in person.account_set %}
   {{ account.acct_no }}:
   {{ account.balance }}
   
  {% endfor %}

  {% endif %}
  {% endfor %}

ideally the redaction process would correctly redact the account
information as well.

The more I think about it, the more it seems that the place to
put the redaction is as you describe.  Something has to be done
in each view to intercept the results and then pass them off to
the redactor with the request.  I don't know if there's really a
way to bypass the minimal duplication in each view.

I guess a recursively redacting QS wrapper would look something like

  REDACTED = '[REDACTED]'
  def should_redact(request):
return True or False # based on request
  class RedactedItem(object):
def __init__(self, request, item):
  self.item = item
  self.should_redact = should_redact(request)
def __getattr__(self, name):
  # untested pseudocode
  if name in self.item._meta.meta.redacted and \
   self.should_redact:
return REDACTED
  else:
result = getattr(self.item, name)
if is_queryset(result): # mystery function?
  return redact_queryset(request, result)
else:
  return result

  def redact_queryset(request, qs):
for item in qs: yield RedactedItem(request, item)

Does that look kosher?  I think that should do the trick.  I'll
play with it a bit more when I get a chance.  Thanks,

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



GeoDjango: Can't find libraries and geos errors

2007-11-16 Thread Sean

Is there a way to specify the location of gdal et. al.?

On OS X, using MacPorts, ctypes doesn't look in /opt/local/lib unless
you set LD_LIBRARY_PATH. On Ubuntu Feisty, the gdal package uses a
weird naming convention and isn't found. Is it possible to specify
these library locations in settings.py or somewhere?

Also, on both OS X and Ubuntu, I get symbol not found errors for
GEOSCoordSeq_getOrdinate when trying to import the geos tests (see
below).

Any help appreciated.

Sean


-: python manage.py shell
Python 2.4.4 (#1, Nov  7 2007, 11:38:36)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
from django.contrib.gis.tests import test_geos
Traceback (most recent call last):
 File "", line 1, in ?
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/tests/
test_geos.py", line 3, in ?
   from django.contrib.gis.geos import \
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/geos/
__init__.py", line 31, in ?
   from django.contrib.gis.geos.base import GEOSGeometry, wkt_regex,
hex_regex
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/geos/
base.py", line 11, in ?
   from django.contrib.gis.geos.coordseq import GEOSCoordSeq
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/geos/
coordseq.py", line 10, in ?
   from django.contrib.gis.geos.prototypes import cs_clone,
cs_getdims, cs_getordinate, cs_getsize, cs_setordinate
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/geos/
prototypes/__init__.py", line 8, in ?
   from django.contrib.gis.geos.prototypes.coordseq import create_cs,
get_cs, \
 File "/opt/local/lib/python2.4/site-packages/django/contrib/gis/geos/
prototypes/coordseq.py", line 67, in ?
   cs_getordinate = cs_operation(lgeos.GEOSCoordSeq_getOrdinate,
ordinate=True, get=True)
 File "/opt/local/lib/python2.4/site-packages/ctypes/__init__.py",
line 325, in __getattr__
   func = self.__getitem__(name)
 File "/opt/local/lib/python2.4/site-packages/ctypes/__init__.py",
line 330, in __getitem__
   func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x10f7e0, GEOSCoordSeq_getOrdinate): symbol not
found


--~--~-~--~~~---~--~~
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: Method 'allow_tags' doesn't work?

2007-11-16 Thread Arnold Chen

I also faced this problem, i have a rolled-out site, using the
allow_tags method to do a critical mission in a customized admin site.

regards,
Arnold

On Nov 16, 3:34 am, wowar <[EMAIL PROTECTED]> wrote:
> Today, after updating django to revision 6678 method 'allow_tags'
> doesn't work. Despite it is set to True I've got html code.
>
> Regards,
> WW
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



mod_python delivering form data to wrong Django instance?

2007-11-16 Thread Steve Freitas

Hi all,

Yes, I realize that maybe this should go to the mod_python list instead,
but I wanted to rule Django out first. Here's my configuration, with
Apache2 on Linux (sorry I couldn't make this shorter):

I've got four Django sites I host under different domain names, which
are actually all identical except for the HTML. (It's a simple form
submission page.) So I'm using a single Django application to serve them
all. Since they're SSL, I need a different VirtualHost entry for each.
In addition, I have a fifth instance running under another VirtualHost
entry as a test site. Again, it is aimed at the same
.settings file, just like the others.

To set the test site apart from the others, I use Apache's SetEnv
directive to set 'DJANGO_TEST_MODE' to 1, and then in settings.py, I
check for the existence of 'DJANGO_TEST_MODE' in os.environ. In that
case, settings.py sets the database name to "databasename_test". (This
database is identical to the production database.)

The problem is that when people submit that form from the deployment
sites, that data intermittently (maybe 5-10% of the time) ends up in the
test database. I've verified in the logs that their URLs are correct
deployment URLs, so it's not that.

To fix the problem, I had to set 'DJANGO_TEST_MODE' to 0 in the
deployment VirtualHost entries, and modify settings.py to check its
value explicitly.

Is this something that happens when using the same settings file, or
something? Anyone else seen this?

Thanks,

Steve


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



Dynamically load objects

2007-11-16 Thread Grupo Django

Hello,
In a view, I have:
from app.models import something

def my_view( request, mod_name ):
   m = __import__('app.models',globals(),locals(),['something'] )

Now I'd like to do:
   items = m.filter( ... )
   for item in items:
   ...

What I need is to load a model dynamically and then use it.
Well, I think this is  very insecure, and I'd like you to give me a
different approach.
Anyway, If I'd like to do it this way, how could I do it, just for
learning purposes.
--~--~-~--~~~---~--~~
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: Deploying Django

2007-11-16 Thread Chris Hoeppner


El jue, 15-11-2007 a las 12:42 -0800, RajeshD escribió:
> > Well, just to know. What are you using? This should also be useful for
> > my "little" project, the django deployer, still unnamed.
> 
> I've been using Lighttpd + FCGI on Joyent containers (my favorite
> production deployment enviroment).
> 
> In my setups, the Lighty/FCGI combo seems to use server memory more
> effectively than Apache/mod_python (in my tests. YMMV)

I've been hearing a lot about the lighty+fcgi combo lately. I'll bear
that in mind. Thanks, RajeshD.
-- 
Chris Hoeppner <[EMAIL PROTECTED]>


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



Re: Testing forms

2007-11-16 Thread Thomas Guettler

Responding to myself:

I choosed solution 2 (parse HTML form) with the help of ClientForm:
  http://www.djangosnippets.org/snippets/467/

Comments welcome

Am Freitag, 16. November 2007 13:03 schrieb Thomas Guettler:
> Hi,
>
> my  has a lot of input widgets which are build from several
> newform.form instances.
>
> If I want to test the form with client.post(), I need to pass all values of
> the input fields in a dictionary, even if I just want to modify one value.
>
> It would be nice if I could get all initial values in a dictionary, in such
> a way that I don't need to alter the test if a field is added to the form.
>
> I think about two solutions:
>
> 1. Alter the view method, so that it can return all forms. Then
> read all initial values from the forms and fill in the post dict.
>
> 2. Call the view with client.get(url) first, parse the HTML and build
> the post dict from the input tags.

--~--~-~--~~~---~--~~
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: Redacted Fields

2007-11-16 Thread Doug B

Could you do something like a wrapper object in your view before it
hits the context?  The wrapper below relies on a field list, but you
could easily have it inspect the Meta class on the model and build the
list.

class RedWrap(object):
def __init__(self,restrict,obj,attrlist=[]):
super(RedWrap,self).__init__()
self.obj = obj
self.restrict = restrict
self.attrlist = attrlist

def __getattr__(self,name):
if not (name in self.attrlist and self.restrict):
return getattr(self.obj,name)
else:
return "[REDACTED]"


def view_person(request,id):
   person = RedWrap(request.redact,Person.objects.get(id=id),
['redactedfield1','redactedfield2'])
   ...

--~--~-~--~~~---~--~~
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 request.user inside a model methods

2007-11-16 Thread Dan-Cristian Bogos

Hello,

Can anyone tell me if it is possible to access logged user instance
inside a model method, like save() is?

I need to rewrite save() method, so I should have some automatic
triggers on model.save(), and use information inside
user.groups.all().

Ta,
DanB

--~--~-~--~~~---~--~~
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: Custom methods for ManyToManyManager

2007-11-16 Thread Samuel Adam

I've been hacking some filtering for related managers, have a look at
the BoxManager here:
http://django-pm.googlecode.com/svn/trunk/myproject/pm/models.py

My app misses the user.inbox.new() feature, i will add it soon. :)

On Nov 16, 2:18 pm, "Tomi Pieviläinen" <[EMAIL PROTECTED]> wrote:
> Hi group,
>
> Is it possible to have custom filtering methods for MTMManagers? More
> precisely I'd like to be able to use user.received_messages.new in my
> templates. I can define a custom manager for my Message model with a
> custom new method, but unfortunately this returns all new messages in
> the system, not just the ones that belong to current user even if I
> use it through the MTMManager.
--~--~-~--~~~---~--~~
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: Redacted Fields

2007-11-16 Thread Marty Alchin

On Nov 16, 2007 7:41 AM, Tim Chase <[EMAIL PROTECTED]> wrote:
> - how to mark a field as redacted

My thought here would be to use some kind of modifier function that
you can wrap around a model's Fields.

fromo django.db import models
from redaction import redact

class Person(models.Model):
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
ssn = redact(models.CharField(max_length=11))

redact() could basically just add an attribute to the Field object
object or store in some kind of cache or something, to know what's
been marked.

> - where to implement the redaction (and how to get the request
> object to it)

I don't have code to back this up, but my initial thought would be to
look at subclassing RequestContext. It's the one place that gets all
the data going to the template, as well as the request object itself.
If the request isn't secure, it might be able to intercept template
references to redacted fields and return the redaction message
instead. As I said, I don't have code for that, so I don't know if
that's even possible, but it seems to me like it'd be the best place
to start.

from django.shortcuts import render_to_response
from myapp.models import Person
from redaction import RedactedContext

def view_person(request, id):
person = Person.objects.get(id=id)
return render_to_response('myapp/view_person.html', {
'person': person,
}, context_instance=RedactedContext(request))

> - any obvious bits I've missed

Unfortunately, I'm sure it's the subtleties that'll hit you the hardest.

-Gul

--~--~-~--~~~---~--~~
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: Custom methods for ManyToManyManager

2007-11-16 Thread Samuel Adam

I've added it, line 228

On Nov 16, 3:32 pm, Samuel Adam <[EMAIL PROTECTED]> wrote:
> I've been hacking some filtering for related managers, have a look at
> the BoxManager 
> here:http://django-pm.googlecode.com/svn/trunk/myproject/pm/models.py
>
> My app misses the user.inbox.new() feature, i will add it soon. :)
>
> On Nov 16, 2:18 pm, "Tomi Pieviläinen" <[EMAIL PROTECTED]> wrote:
>
> > Hi group,
>
> > Is it possible to have custom filtering methods for MTMManagers? More
> > precisely I'd like to be able to use user.received_messages.new in my
> > templates. I can define a custom manager for my Message model with a
> > custom new method, but unfortunately this returns all new messages in
> > the system, not just the ones that belong to current user even if I
> > use it through the MTMManager.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom commands on win32 vs. BSD

2007-11-16 Thread [EMAIL PROTECTED]

I have the following structure:

myproj/core/
myproj/core/__init__.py
myproj/core/management/
myproj/core/management/__init__.py
myproj/core/management/commands/
myproj/core/management/commands/__init__.py
myproj/core/management/commands/populate.py

On Win32, when I am in the project's directory and run:

python manage.py populate

it works as expected. The exact same project on FreeBSD 6.2 with
Python 2.5.1 doesn't register the 'populate' command.

A bit of digging revealed that the project's parent directory is
getting removed from sys.path, so the import of myproj.core.management
fails (INSTALLED_APPS has "myproj.core" in it).

I had to add ".." to sys.path at the top of manage.py to get it to
work correctly.

Did I do something wrong?
--~--~-~--~~~---~--~~
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: check for request.META keys

2007-11-16 Thread Steve Potter



On Nov 16, 12:01 am, Matt McClanahan <[EMAIL PROTECTED]>
wrote:
> On Nov 15, 8:51 pm, Steve  Potter <[EMAIL PROTECTED]> wrote:
>
> > It just seem that there should be a better way of doing this.  I was
> > thinking about a method that would perform the test for me and return
> > either the contents or a blank string.
>
> Often times, when it seems like something should exist, it's useful to
> operate on the assumption that it does, and go looking for it.  In
> this case, request.META is a glorified dictionary, and dictionaries
> have a get() method:http://docs.python.org/lib/typesmapping.html
>
> So you can use request.META.get('somekey', 'defaultvalue')
>
> Matt


Thanks Matt, for pointing out the obvious.

Steve


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



Testing forms

2007-11-16 Thread Thomas Guettler

Hi,

my  has a lot of input widgets which are build from several newform.form 
instances.

If I want to test the form with client.post(), I need to pass all values of 
the input fields in a dictionary, even if I just want to modify one value.

It would be nice if I could get all initial values in a dictionary, in such a 
way that I don't need to alter the test if a field is added to the form.

I think about two solutions:

1. Alter the view method, so that it can return all forms. Then 
read all initial values from the forms and fill in the post dict.

2. Call the view with client.get(url) first, parse the HTML and build
the post dict from the input tags.

Has some a better solution or hint?

 Thomas

--~--~-~--~~~---~--~~
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: design Q: where to put peoples names

2007-11-16 Thread Carl Karsten

Marty Alchin wrote:
> My first question would be: Are you absolutely certain that none of
> those 1000 other people will ever need a login?

anything is possible.

I would think at some point it isn't a good idea to use the User table.  What 
if 
it was 1,000,000 names, like if I was publishing a phone book?

> 
> Basically, if any of those users would ever need to be promoted to
> login status, the User model is your best bet. As Samuel mentioned,
> just set "is_active" to False and probably set the password field to
> "!" since they wouldn't be expected to supply a password. As for
> username, you can probably just make a slug out of their real name and
> use that.
> 

Can the username be Null?

Carl K

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



design Q: where to put peoples names

2007-11-16 Thread Carl Karsten

The user table has first/last name.  great.  I need to manage about 1500 
people, 
and only 500 will have any need for a site login.  So where should I store the 
1000 names that don't need to be a user record?

  I can think of:

Everyone gets a User record.  (given this is the easiest, what problems could 
it 
cause?)

2nd table for the extras.  all code that needs to work with the super set will 
have to work with both tables.  (yuck)

2nd table for all people.  don't use the name fields in the User table.  figure 
out how to use it to edit a User's Real Name (not the username) in the Admin 
UI. 
  (This seems best.  if you agree, how would I fix the Admin UI?)

Thanks, Carl

--~--~-~--~~~---~--~~
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: design Q: where to put peoples names

2007-11-16 Thread Samuel Adam

Have the "is_active" field of the User model set to False for the
users that don't need a login.

The auth login will raise an error if an inactive user tries to log
in.

Always try to use what is there.

On Nov 16, 3:02 pm, Carl Karsten <[EMAIL PROTECTED]> wrote:
> The user table has first/last name.  great.  I need to manage about 1500 
> people,
> and only 500 will have any need for a site login.  So where should I store the
> 1000 names that don't need to be a user record?
>
>   I can think of:
>
> Everyone gets a User record.  (given this is the easiest, what problems could 
> it
> cause?)
>
> 2nd table for the extras.  all code that needs to work with the super set will
> have to work with both tables.  (yuck)
>
> 2nd table for all people.  don't use the name fields in the User table.  
> figure
> out how to use it to edit a User's Real Name (not the username) in the Admin 
> UI.
>   (This seems best.  if you agree, how would I fix the Admin UI?)
>
> Thanks, Carl
--~--~-~--~~~---~--~~
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: Deploying Django

2007-11-16 Thread Norman Harman

Chris Hoeppner wrote:
> Well, just to know. What are you using? This should also be useful for
> my "little" project, the django deployer, still unnamed.

I had the most frustration with a software in recent memory trying to use
lighttpd.  Config syntax was utterly weird and the docs conflicted with actual
behavior.  I dumped it for nginx.

Nginx has been a near dream.  The syntax makes sense(YMMV), and it has done what
I wanted without hassle.

Use it to:
   - serve static and proxy to three separate django-servers(on different ports)
for development
   - serve static and proxy to mod_python/apache a test server
   - serve static and proxy to mod_python/apache a production server

I'm familiar with apache/mod_python so the backend is that rather than something
"trendier".

When traffic becomes an issue, one problem we are glad to have :) we'll do some
stress/load testing. Probably comparing ngix->apache/mod_python to ngix->fcgi


nginx   -> http://wiki.codemongers.com/Main
my site -> http://StoryMash.com

I really can't recommend nginx enough,
norm


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



Custom methods for ManyToManyManager

2007-11-16 Thread Tomi Pieviläinen

Hi group,

Is it possible to have custom filtering methods for MTMManagers? More
precisely I'd like to be able to use user.received_messages.new in my
templates. I can define a custom manager for my Message model with a
custom new method, but unfortunately this returns all new messages in
the system, not just the ones that belong to current user even if I
use it through the MTMManager.
--~--~-~--~~~---~--~~
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: Digitally Sign an Email

2007-11-16 Thread [EMAIL PROTECTED]

Thanks.

Just for future reference I found this on the net:

http://chandlerproject.org/bin/view/Projects/MeTooCrypto

_LR_

On Nov 16, 1:43 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-11-15 at 17:21 -0800, [EMAIL PROTECTED] wrote:
> > Hello,
>
> > Is it possible to digitally sign an email with django email api?
>
> No. The email API only provides very simple capabilities, wrapping
> Python's native stuff. What you would do in this case is create the
> content and generate the signature yourself and then construct the
> message manually. It will probably take a bit of fiddling around to get
> the MIME types correct, but it should be possible.
>
> Malcolm
>
> --
> The hardness of butter is directly proportional to the softness of the
> bread.http://www.pointy-stick.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
-~--~~~~--~~--~--~---



Redacted Fields

2007-11-16 Thread Tim Chase

I've been playing around with some ideas and was hoping to get
feedback about what the "right" sort of way to do it would be
(the Django analog to "Pythonic").

Various models have sensitive fields associated with them that
should only be available to a template if the requester is on a
"secure" connection (whether HTTPS or on a private subnet, as
tweaked into the request object by a middleware).

I'm trying to figure out how best to both tag these fields as
redacted, and how to intercept them in the template rendering.
Thus, if you're on a secure connection (as defined above),

  person.mothers_maiden_name

returns the value

  "Smith"

whereas on a non-secure connection, it would return something like

  "[REDACTED]"

or just the empty string.

For tagging fields, since for my purposes most of them are just
CharFields, making a custom RedactedCharField might be feasible,
but I'm stymied by getting the "request" object in order to
behave properly.  I've also thought it also might be nice to have
this in the Meta instead, something like this frightening example :)

  class Meta:
redacted = set(
  'account_number',
  'social_security',
  'credit_card_number',
  'license_number',
  'mothers_maiden_name')

For the sake of DRY, I'm not sure where to put the redacting
code.  It doesn't go well in a view or template (have to
duplicate the redacting code in every view or make sure every
template filters every possibly-redacted-field through a "redact"
filter that magically gets the request context), and it doesn't
go so well in a model because it requires the "request" object to
determine whether it should be redacted or not.  The best place
I've been able to come up with is hacking the template rendering
code, but this still seems a bit ugly.

In a pinch, I can always just use a "redacted" filter in my
templates, but that requires a vigilance best left to declarative
code rather than this forgetful programmer.

The recent work on auto-escaping HTML that just hit trunk sounds
like it might have had some helpful hints in it, but I haven't
gotten to look at that quite yet.  Tales from the implementor(s)
could be full of helpful caveats from lessons learned.

I'd appreciate any thoughts on

- how to mark a field as redacted
- where to implement the redaction (and how to get the request
object to it)
- any obvious bits I've missed

Thanks,

-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: Time estimation for a Django project

2007-11-16 Thread Antoni Aloy

2007/11/16, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>
>
> Le 14.11.2007 18:03,, le perspicace hass s'exprimait en ces termes:
> > that's a very bold move.
> >
> > I'd say that if you can't estimate the time required, you're not ready
> > to take on that project.
> You may be right…
>
> > But you've got to start somewhere,
> You're definitly rigth ;-)
Hi!
You can use to start with the use case estimation, the estimation is
quite good for meddium projects if you manage to get good use cases,
but in any case is a good start point
http://www.codeproject.com/gen/design/usecasepoints.asp
or my own article but in catalan in
http://trespams.com/2007/04/03/estimacio-de-projectes-mitjancant-casos-dus/

For small projects the estimation gives big numbers, but as a rule of
thum you could reduce the amount in a 40%.

This kind of estimation is more undertandable than function points and
in my oppinion gives better estimation results for web projects.

Hope it helps!

-- 
Antoni Aloy López
Binissalem - Mallorca
http://www.trespams.com
Soci de Bulma - http://www.bulma.cat

--~--~-~--~~~---~--~~
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: Strip Illegal Characters - Django Admin

2007-11-16 Thread Kenneth Gonsalves


On 16-Nov-07, at 10:04 AM, Ramdas S wrote:

> What exactly do you mean by sanitize. The biggest problem is word  
> users do is they cut and paste stuff into the text area boxes, and  
> even tiny_mce is not of much help.

the whole idea behind tiny_mce is that it converts word/excel etc to  
html (often horrible html) which may also break your page. But even  
then it is easier than insisting that word users learn to write ascii  
text

-- 

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



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



Last chance for PyCon talk & tutorial proposals!

2007-11-16 Thread [EMAIL PROTECTED]

Thanks to all the proposal authors so far, we have received lots of
proposals for PyCon talks & tutorials.  But we'd like to have even
more.  Alas, the proposal submission deadline should have been set
after a weekend, not before. So we have decided to extend the proposal
submission deadline to Monday, November 19 at midnight (Chicago
time). This gives you a *whole extra weekend* to write up your talk
and tutorial ideas!

If you've been procrastinating, stop! Get started on a proposal
instead!

See the call for conference talk proposals:
http://us.pycon.org/2008/conference/proposals/

Topic ideas:
http://wiki.python.org/moin/Talk_Subjects
http://wiki.python.org/moin/PyCon2007/Feedback#head-e2dca74d1492e49fae11550e6cbc40fa18a17f40

See the call for tutorial proposals
http://us.pycon.org/2008/tutorials/proposals/

Topic ideas from the PyCon 2007 feedback:
http://wiki.python.org/moin/PyCon2007/Feedback/TutorialIdeas

I hope to see (and hear) you at PyCon 2008!
http://us.pycon.org

-- David Goodger, PyCon 2008 Chair

--~--~-~--~~~---~--~~
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: Time estimation for a Django project

2007-11-16 Thread sun . wukong


Le 14.11.2007 18:03,, le perspicace hass s'exprimait en ces termes:
> that's a very bold move.
> 
> I'd say that if you can't estimate the time required, you're not ready
> to take on that project. 
You may be right…

> But you've got to start somewhere,
You're definitly rigth ;-)

> good luck with it.
Thanks to you and Andy for your answers :-)


-- 
SunWukong

Linux User #354048
GPG Key available : 0xF4DD0AD2 on keyserver.ubuntu.com



signature.asc
Description: OpenPGP digital signature


Re: Messaging component

2007-11-16 Thread Samuel Adam

I have released my code for a private message system.

It's quite powerful, the functions are all displayed in the templates.
For example, if you don't want to have message history in the read
view, just remove it in the templates. Django is really smart and
won't trigger the SQL queries if  it doesn't need the data.

It is not polished for the end user yet but you can easily adapt it
for your project.

The trunk comes with a project configured with sqlite and the
messaging system so you can easily try it out.

If you find a bug, have a feature request or a comment, don't hesitate
to contact me.

http://code.google.com/p/django-pm/

--
Sam
If you speak french or que vous parlez français, /join #django-fr or
http://django-fr.org/










On Oct 21, 10:50 am, "Jon Atkinson" <[EMAIL PROTECTED]> wrote:
> I'm not sure about anything which is ready-made, but this is quite
> easily accomplished with one model:
>
> classMessage(models.Model):
> """This is a user-to-usermessage"""
> to = models.ForeignKey(User)
> from = models.ForeignKey(User)
>message= models.TextField(blank=True)
> sent_on = models.DateTimeField(blank=True, auto_now=True)
> read = models.BooleanField(default=True)
>
> class Admin:
> pass
>
> def __unicode__(self):
> return "Messagefrom %s to %s on %s" % (self.from, self.to, 
> self.message)
>
> Of course, replace the User foreign keys with your user model. Then
> you just create a view for the inbox (to is the currently logged in
> user, read is False), outbox (from is the currently logged in user).
> This is a very simple model, but it should get you going.
>
> --Jon
>
> On 10/21/07, Julien <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi all,
>
> > I'm aDjangonewbie, and was wondering if there was an existing
> > component/app to manageprivatemessaging features, so that registered
> > users can send messages to each other, have an inbox, etc.
> > Something like there is on community sites like Facebook, or forum
> > apps like PHPBB.
>
> > Your help is much appreciated!
>
> > Many thanks,
>
> > Julien
--~--~-~--~~~---~--~~
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: Strip Illegal Characters - Django Admin

2007-11-16 Thread Kenneth Gonsalves


On 16-Nov-07, at 12:34 AM, Joel Hooks wrote:

> My users are cutting and pasting descriptions from Word, and this
> causes HTTP 500 errors with Django AMF (but not Django more broadly.)

if your users are cutting and pasting from word, you could use  
tiny_mce to sanitise the pastes. It may be easier than convincing  
your users that there is such a thing as ascii text.

-- 

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



--~--~-~--~~~---~--~~
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: bulk modify in the admin?

2007-11-16 Thread Discdropr

This is something I'd wondered as well, since I have a photo gallery,
and would like to do mass imports/updates - instead of going through
all my photos one-by-one, display a thumbnail and a set of fields to
modify for each one - one gallery at a time.

...I eventually just wrote my own edit-multiple view and form

On Nov 14, 9:03 am, Kevin <[EMAIL PROTECTED]> wrote:
> I was just curious: has anyone fooled around with extending the admin
> to do a sort of "bulk modify"? For example: update update multiple
> entries (like an article) in the database to now have the same
> author ?
>
> I know that making the application/html and such wouldn't be too bad
> for each particular use case, but just thought it would be pretty neat
> if I there existed a way to extend/hack the admin interface to do
> something similar in a more generic fashion.
>
> Thanks!
> Kevin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Noob Question

2007-11-16 Thread Karen Tracey

You need to create your own 500.html template.  It may not be listed
in the install/setup but it is mentioned in the full docs:

http://www.djangoproject.com/documentation/0.96/request_response/#the-500-server-error-view

If you're just starting out, though, I'd recommend getting up and
running with the DEBUG value in settings.py set to True.  It's not
something you want on in production but for initial setup and
development it is invaluable and much more informative than what
you'll get with a 500 server error page.

Karen

On Nov 16, 2007 12:44 AM, bdixon <[EMAIL PROTECTED]> wrote:
>
> Sorry for what is probably a pretty basic issue but after installing
> Django (.96.1) on my MacBook Pro I am getting an odd error that is
> telling me that template 500.html is not available.  There's nothing
> in the documentation (for installation / setup) on this so I have a
> feeling that it may be a Mac specific kind of thing.  I have seen
> others had this but there does not seem to be a clear cut solution.
> Any suggestions?
>
> Traceback (most recent call last):
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/servers/basehttp.py", line 272, in
> run
> self.result = application(self.environ, self.start_response)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/servers/basehttp.py", line 614, in
> __call__
> return self.application(environ, start_response)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/handlers/wsgi.py", line 189, in
> __call__
> response = self.get_response(request)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/core/handlers/base.py", line 126, in
> get_response
> return callback(request, **param_dict)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/views/defaults.py", line 88, in
> server_error
> t = loader.get_template(template_name) # You need to create a
> 500.html template.
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/template/loader.py", line 79, in
> get_template
> source, origin = find_template_source(template_name)
>
>   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/site-packages/django/template/loader.py", line 72, in
> find_template_source
> raise TemplateDoesNotExist, name
>
> TemplateDoesNotExist: 500.html
>
>
> Thanks so much,
> Brooke

--~--~-~--~~~---~--~~
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: Strip Illegal Characters - Django Admin

2007-11-16 Thread Joe

You could try encoding the data in your view - something like:

try:
cleandata = rawinput.encode("iso-8859-1", "ignore") or 'Unknown data
type'
except:
# Whatever you want here
pass

Just an option. Also depends on what you need to capture and return to
users. I too deal with odd encodings.



On Nov 15, 2:04 pm, Joel Hooks <[EMAIL PROTECTED]> wrote:
> My users are cutting and pasting descriptions from Word, and this
> causes HTTP 500 errors with Django AMF (but not Django more broadly.)
> This textbox that I am typing in here on groups.google.com won't allow
> me to paste the offending characters at all. Is there a way to force
> the textbox in the Django admin change form to be whatever kind of box
> this is as to disallow users from breaking the system with bad
> characters? Alternatively, can I strip the bad characters somehow when
> they hit save?
>
> Best regards,
>
> Joel
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---