Re: proper use of admin screens

2006-01-23 Thread Max Battcher


char wrote:

I have a question about the proper use of Django's built-in admin
functionality. I realize that Django evolved in a newsroom environment
where there is a small number of content publishers/admins and many
readers. But what about web apps where users normally enter, update,
and delete the bulk of the application's data? Is it considered good
practice to use the built-in admin content management functionality as
general purpose input screens?


The admin site can display a lot of information that you may not want 
every user to see.  One big example is the "Documentation" section (on 
the top bar).


As with any privileged tool, the question is largely one of trust... 
can you trust all of your potential users with the functionality that 
you give them in the admin?


Another key to keep in mind here is that the current admin site doesn't 
get more intricate than add/change permissions.  If you give someone 
change permission to one of your models they can change any and all data 
in that table.


Most likely you are going to want to roll your own, as you can be a lot 
more precise with your own code, but feel free to evaluate your own 
situation.


--
--Max Battcher--
http://www.worldmaker.net/


formfields not remembering ForeignKey field's selection

2006-01-23 Thread Gary

I'm trying to use formfields.FormWrapper(users.AddManipulator(),
new_data, errors) as described in
http://www.djangoproject.com/documentation/forms/

If I submit a form which has a dropdown (for a onetomany relation) that
doesn't validate, the reloaded page/form remembers all values but not
the dropdown selection.

Is this a bug or feature?
How can I have the page remember the selection?



Re: FormField.prepare

2006-01-23 Thread foot

> I think I figured it out, you're supposed to call the manipulator's
> prepare() method explicitly which in turn calls the fields' prepare
> methods.

This works great, just add a manipulator.prepare(new_data) call into
your boilerplate add / change views. However Admin doesn't seem to do
this, are there any parameters you can pass it anywhere to get it to
call prepare()?

Thanks, 
foot



proper use of admin screens

2006-01-23 Thread char

I have a question about the proper use of Django's built-in admin
functionality. I realize that Django evolved in a newsroom environment
where there is a small number of content publishers/admins and many
readers. But what about web apps where users normally enter, update,
and delete the bulk of the application's data? Is it considered good
practice to use the built-in admin content management functionality as
general purpose input screens?



Re: sys path

2006-01-23 Thread akaihola

If you're running Django behind Apache and mod_python, you should
define the PYTHONPATH (sys.path) in your Apache virtual host
configuration. See the documentation[1] for more information. Just
include the PythonPath directive inside the  block.

When using the internal webserver (which doesn't seem to be considered
A Good Thing to do), just define the PYTHONPATH environment variable
before running the server. Here's an example of how to do it in Unix:
chmod u+x /projectroot/projectname/manage.py
PYTHONPATH=/projectroot /projectroot/projectname/manage.py runserver
8080

You could also add "import sys" and "sys.path.append('/projectroot')"
to the top of /projectroot/projectname/manage.py to avoid the clumsy
command line.

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



Re: admin interface

2006-01-23 Thread akaihola

You can get started here:

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



do_html2python returns type "str" for ForiegnKey form fields

2006-01-23 Thread cpburmester

I've noticed that a foriegn key value in data posted to a view method
is still a string after a call to do_html2python. However, it's
returned as an int (what I would expect) from flatten_data().

Is this a bug or is this intended behavior?

It's causing a bug in my template code where I compare the foriegn key
value in the form data passed to the template to the key value in a
list of objects that can be selected from (i.e. display the current set
value as selected.

For example, here payee is the ForiegnKey:


--select--
{% for payee in payee_list %}
{{
payee.org_company }}, {{ payee.org_city }}
{% endfor %}


{% ifequal form.data.payee_id payee.id %}

fails when reloading on error since payee_id is a string and payee.id
is an int. However, this works if the view is loading for the first
time, since payee_id comes from flatten_data() and is an int.

To my mind, the string should be converted to an int by the
do_html2python() method of the FormField. I've look at the django core
code, and it appears that ForiegnKey classes default to the FormField
do_html2python method, which just returns the data as is (i.e. a
string).

Chris



Re: Extending admin privileges

2006-01-23 Thread Jacob Kaplan-Moss


On Jan 23, 2006, at 11:53 AM, Andy Shaw wrote:
Quick query: is there an easy way to limit staff users so that they  
can
only alter records that belong to them? Specifically, so that only  
their
own records show up in the admin interface. All the relevant models  
have

an owner field that points to the correct user (via an intermediary
model in one case), and I've written some decidedly hacky views/model
validators that stop users altering other records, but they don't see
the error until they try to save their changes.


This currently isn't possible.

It's probably the #1 feature request for the admin and a topic of  
discussion on django-dev, so there's a good chance it'll happen in  
the not-so-distant-future.  Patches are welcome, of course :)


Jacob


Extending admin privileges

2006-01-23 Thread Andy Shaw

Hi all,

Quick query: is there an easy way to limit staff users so that they can
only alter records that belong to them? Specifically, so that only their
own records show up in the admin interface. All the relevant models have
an owner field that points to the correct user (via an intermediary
model in one case), and I've written some decidedly hacky views/model
validators that stop users altering other records, but they don't see
the error until they try to save their changes.

TIA,

-Andy


Re: Django and MS SQL

2006-01-23 Thread Rich Bakos


Cheng Zhang wrote:

Hi Cheng,

> Actually my previous statement isn't correct, I just realized that
> pymssql also claimed to work on Windows, except it will use M$'s
> native libraries instead of FreeTDS.

You worked this out quicker than I ever could have. Thanks.



sys path

2006-01-23 Thread mary . adel

how to set my sys.path to the place that i am putting in it the Django
projects as they are not in the sys  path of Djnagoo 
i mean how i could set this PythonPath 




Mary Adel
Software Developper
 
ITrize-Egypt 13 Naguib Hashad medan elhegaz heliopolis
email: [EMAIL PROTECTED]
Office: +202 - 6236612 EXT. 102
Mobile: +2012 5241719




Re: field lookups: isnull

2006-01-23 Thread patrick kranzlmüller


ok, i have to use
writeboard_list = project.get_writeboard_list(parent__isnull=True)

not sure if this is continous.

patrick


Am 23.01.2006 um 16:24 schrieb patrick kranzlmüller:



writeboard_list = project.get_writeboard_list(parent__id__isnull=True)
doesn´t give any results (although there are some records with 
parent_id NULL in the database)


the other way round,
writeboard_list = project.get_writeboard_list(parent__id__isnull=False)
works fine.

any suggestions?

patrick




Re: meta.Admin 'fleids' option

2006-01-23 Thread Joseph Kocherhans

On 1/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> I'm trying to use class 'collapse' in 'fields' option, like this:
> class META:
> ordering = ['title']
> admin = meta.Admin(
> list_display = ('title',),
> fields = (
> (None,
>
> {'fields':('title','alternative_feed_url','feed_enable','ping_services')}),
> ('Dublin Core',
>  {'classes':'collapse',
>
> 'fields':('dc_reator','dc_type','dc_format','dc_language')}),
> ('Geo',
>  {'classes':'collapse',
>   'fields':('geo_latitude','geo_longtitude')}),
> )
> )
>
> When try to add record in Administration (just push button - Add,
> without displaying add form), got this error:

I'm not sure exactly what the error is, but I'd start debugging by
commenting out all but one field set and see if it works. I.e. Comment
out the tuples that start with 'Dublin Core' and 'Geo'. You may just
have one of the field names spelled incorrectly.

Joseph


Re: recovering from interpreter db errors

2006-01-23 Thread Luke Skibinski Holt

excellent - exactly what I was looking for. Thanks heaps, Andreas.


Luke Skibinski Holt



Re: recovering from interpreter db errors

2006-01-23 Thread Andreas Stuhlmüller

On 1/23/06, Luke Skibinski Holt <[EMAIL PROTECTED]> wrote:
>
> Is there a way within the interpreter of recovering from these sorts of
> errors:
>
> psycopg.ProgrammingError: ERROR:  current transaction is aborted,
> commands ignored until end of transaction block

Execute these commands after the error occured:

>>> from django.core import db
>>> db.db.rollback()

Andreas


recovering from interpreter db errors

2006-01-23 Thread Luke Skibinski Holt

Is there a way within the interpreter of recovering from these sorts of
errors:

psycopg.ProgrammingError: ERROR:  current transaction is aborted,
commands ignored until end of transaction block

I get them when debugging queries and something goes awry wherein I
have to restart the interpreter and import everything again. Any help?
I have no experience with psycopg ...


Luke Skibinski Holt



Re: running django

2006-01-23 Thread Jeroen Ruigrok van der Werven
On 1/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> i really don't know how to use them instead of django server as i am
> already using Apache for the picture but how to make access to all the
> project without using Django server

Start from http://www.djangoproject.com/documentation/modpython/ would
be my first suggestion.

--
Jeroen Ruigrok van der Werven


RE: running django

2006-01-23 Thread mary . adel

i really don't know how to use them instead of django server as i am
already using Apache for the picture but how to make access to all the
project without using Django server


Mary Adel
Software Developper
 
ITrize-Egypt 13 Naguib Hashad medan elhegaz heliopolis
email: [EMAIL PROTECTED]
Office: +202 - 6236612 EXT. 102
Mobile: +2012 5241719


>  Original Message 
> Subject: Re: running django
> From: Jeroen Ruigrok van der Werven <[EMAIL PROTECTED]>
> Date: Mon, January 23, 2006 1:03 pm
> To: django-users@googlegroups.com
> 
> Mary,
> 
> On 1/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > django-admin.py doesn't have a daemon mode to run in.
> > how do i run it as a service?
> > i need this cause i don't need when the server restart for any reason i
> > had to start django server
> 
> django-admin.py/manage.py's webserver is only meant as a developer
> tool and as such it has been kept simplistic and minimal. For serious
> webserving you are best off using Apache, lighttpd, and so on.
> 
> --
> Jeroen Ruigrok van der Werven



running django

2006-01-23 Thread mary . adel

django-admin.py doesn't have a daemon mode to run in.
how do i run it as a service?
i need this cause i don't need when the server restart for any reason i
had to start django server


Mary Adel
Software Developper
 
ITrize-Egypt 13 Naguib Hashad medan elhegaz heliopolis
email: [EMAIL PROTECTED]
Office: +202 - 6236612 EXT. 102
Mobile: +2012 5241719