Perhaps you could override the save method and make it like this:

def save(self,*args,**kwargs):
   pass

Would that work? This is also a curiosity I have, but didn't have a chance
to test it.

Any thoughts?

George

On Wed, Jan 26, 2011 at 12:22 AM, Russell Keith-Magee <
russ...@keith-magee.com> wrote:

> On Wed, Jan 26, 2011 at 12:19 AM, bvdb <b...@kanka.de> wrote:
> > A developer sometimes has to access and present data that existed
> > before his application. Common practice is for a database
> > administrator to define a database view (with a CREATE VIEW sql
> > command, not to be confused with the V in MVC) and give the Django
> > developer access to this. This is only a read access because in most
> > cases it is not possible or desireable to allow an UPDATE on a view.
> >
> > Now I am new to Django, have some experience with databases - and
> > couldn't find a "read-only attribute" when defining a model.
> > Without knowing that a view - that is accessed with the same SELECT
> > syntax as a table - is read-only Django would for example generate an
> > admin interface that produces errors, and leave the user wondering
> > why.
> > It makes also sense in some cases to define a table read-only for a
> > model even it is fully accessible by the Django team.
> >
> > Is it really not possible to define read-only access in Djangos ORM?
> > Or maybe I just overlooked the description?
>
> Essentially the answer is no.
>
> Django doesn't have a built-in representation of a view. You can't
> define a view in the same way that you would define a model, for
> example. This has long been on my 'things I want to look at' list, but
> I've never got around to it.
>
> You can define a Django model as a wrapper around a view by marking it
> managed, but that doesn't make the model read-only -- it just prevents
> Django from trying to create the model during syncdb.
>
> From the perspective of the admin, you can define a field to be
> readonly, but that's purely a data display level concern, and is
> controlled on a per-field basis. With a bit of effort your could make
> an admin view that is effectively readonly, but there isn't a simple
> single switch to do this.
>
> Another approach is to use the databrowse app; that's purely a
> readonly display. It's not as mature or pretty as the admin, but it
> exists, and you might be able to use it.
>
> Yours,
> Russ Magee %-)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
George R. C. Silva

Desenvolvimento em GIS
http://blog.geoprocessamento.net

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

Reply via email to