There a ticket or two for this already. For example:
http://code.djangoproject.com/ticket/8158
(I think a workaround is to set your ModelAdmin's to use your own
template name and in they pull in and override elements of the base
templates. The only drawback is you are dependent on the built-in
I've been having bad dreams about the ways in which contrib-admin can
eat your data when you have more than one administrator.
As a worst-case scenario imagine a model with some list_editable
fields:
Admin1 has the changelist open for a considerable length of time
Admin2 makes a load of changes
I did something similar by subclassing AdminSite and overriding the
index method. Copy the original method from contrib.admin and modify
app_list before you render the template.
It does break breadcrumbs and intermediate app pages (/admin/someapp/)
but with some shameless hackery I fixed this
I've got a strange issue and I'm not even sure how to go about
tracking down the source of the problem let alone fix it. I'm posting
here in the hope someone can give me a clue rather than a solution.
I've got an app that runs fine on the local development server. When I
run it on a live server
Hi,
I've got a model called Courses and a model that inherits from it
called SpecialCourses that has some extra fields.
It seems that any SpecialCourses I add also show up in the changelist
for Courses which will be confusing for content editors ("remember to
edit them under SpecialCourses or
I've got a Django app that seems to eat up a lot of memory. I posted a
message on Stack Overflow and it got a little sidetracked into a
debate about the merits of WSGI and Apache in Worker MPM mode.
Webfaction have assured me that playing around withthat kind of thing
is not going to make a
I've tried various methods to achieve this.
I decided against overriding formfield_for_dbfield as it's doesn't get
a copy of the request object and I was hoping to avoid the
thread_locals hack.
I settled on overriding get_form in my ModelAdmin class and tried the
following:
class
Hi,
Has anyone got any pointers? I'm not even sure where to begin. For non-
inlines I'm doing:
def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name == 'photo':
kwargs['widget'] = AdminImageWidget()
return db_field.formfield(**kwargs)
snotva...@gmail.com>
>
> > > It says for requesting username as password to access. Did I miss
> > > anything here?
>
> > try guest:guest
>
> > > On Nov 27, 11:14 pm, Ovnicraft <ovnicr...@gmail.com> wrote:
> > > > 2008/11/27 AndyB <andy.
Hi,
I'm a little confused how I should handle transactions in a particular
situation.
I've got some code that boils down to this:
def myview(request):
result = important_money_stuff(request)
widget = Widget.objects.get(request.get(something))
thingy =
More to the point - has anyone figured out how to! I couldn't even
find a dowload or repository link for the Django branch.
On Nov 27, 2:21 pm, Robin <[EMAIL PROTECTED]> wrote:
> hello,
>
> I have also installed it and have seen there is this
>
The amount of customization that is now possible with the Admin app
really blurs the boundry between tweaking the admin itself and
replacing it entirely. There is an entire spectrum between those two
extremes and I've been surprised how far it's possible to take the
customization while still
Thanks Malcolm,
That was so much easier than I was expecting:
class ItemOptions(admin.ModelAdmin):
def changelist_view(self, request, extra_context=None):
self.list_display = request.session['item_columns']
return super(ItemOptions, self).changelist_view(request,
I basically would like some way for staff users to choose which
columns are displaying in an object's changelist.
So far I've got an ugly solution which I can actually have some idea
how to implement and the 'correct' solution which requires quite a lot
of digging in the django internals.
The
If it's one to one then the field that maps to the primary key in the
other table should be unique. Why not designate that as a primary key?
I was in a similar situation integrating a legacy Access app. I simply
added an autonumber id field. Your old app will ignore it but it keeps
Django happy.
http://wiki.dreamhost.com/index.php/Django
Have you got the .htaccess, dispatch.fcgi etc all set up?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
I can see why it would fail - but I still wonder whether the current
behaviour is ideal. I would say that it's more likely someone would
want to override a template project wide and I can't see a neat way to
do this.
--~--~-~--~~~---~--~~
You received this message
Let's say I want to override change_list.html for an app called 'cms'.
I create a /admin/cms/change_list.html
and then call back to the original admin template overriding just want
I want to change:
{% extends "admin/change_list.html" %}
{% block extrahead %}
...
{% endblock %}
However if I
This sounds like exactly what I need to do. However my Unix-fu isn't
up to coping with the sentence 'We have an alias set up in postfix
that sends the e-mail to our script via a pipe.'... :(
My naive assumption is that one could use something like poplib in the
standard library to connect to a
Apologies for not using DPaste. I thought the snippets were small
enough. And I thought my question was cleared than it turned out to
be!
To clarify (where someobject_set is a related-object queryset):
someobject_set.all().query.as_sql()
someobject_set.select_related().query.as_sql()
Both show
>>> p.residentialunitmix_set.all().query.as_sql()
(u'SELECT `tbl_ResidentialUnitMix`.`id`,
`tbl_ResidentialUnitMix`.`Planning-id`,
`tbl_ResidentialUnitMix`.`quantity`,
`tbl_ResidentialUnitMix`.`Bedrooms`, `tbl_ResidentialUnitMix`.`Type`,
`tbl_ResidentialUnitMix`.`Tenure` FROM
be abstracting away?
On Oct 16, 7:10 pm, "Ronny Haryanto" <[EMAIL PROTECTED]> wrote:
> On Fri, Oct 17, 2008 at 12:55 AM, AndyB <[EMAIL PROTECTED]> wrote:
> > I've googled and the only problems seem to be with people trying to do
> > case-sensite lookups.
I've googled and the only problems seem to be with people trying to do
case-sensite lookups.
What could be going wrong here?:
>>> b.filter(name__icontains='Saff')
[]
>>> b.filter(name__icontains='saff')
[]
MySql 5.0.51
Django 1.0
Tables are InnoDB UTF8 collation UTF8 bin
Tried it on a my dev
- there is a point you reach where it would be quicker to write
your own views but it's rather hard to see where that point is until
you've tried pushing the boundries of what the admin can do.
regards,
AndyB
On Oct 4, 9:48 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
> Will Temperley wrote:
> >
> Then you'd be tripped up and ends up completly confused by any raw
> python code. Did you ever tried comparing a string and an int in
> Python ???
Doh. I knew that. For some reason the fact that it was template code
sent my brain to sleep.
> > Does anyone else think that there should be an
I read the following snippet with interest:
http://www.djangosnippets.org/snippets/1010/
I am trying to lock that tightly into brain as I can imagine being
tripped up by that and ending up completely confused as to why my code
doesn't work.
Does anyone else think that there should be an elegant
I also keep meaning to look at Pinax but I was rather put off by the
apparent focus on social apps (in which I don't currently have much of
an interest). I would like to see a some documentation about their
proposed standard architecture. Does this exist other than in the
current source code?
I'm happily using this snippet that could be used for editing any
column on the change list page:
http://www.djangosnippets.org/snippets/568/
On Aug 17, 8:28 am, Donn <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a model that I'd like to edit in a way that I can get to some of the
> members going
I've wondered about this myself.
You could use an 'all' placeholder so that there was always three
levels in the url:
example.com/shop/all/all/Acme
example.com/shop/all/250-500/all
example.com/shop/widgets/all/all
or your own separator and a flatter directory structure:
e:
> On Wed, Jun 4, 2008 at 5:23 AM, AndyB <[EMAIL PROTECTED]> wrote:
>
> > I'm struggling to understand the following:
> >http://dpaste.com/54745/
>
> > It's a legacy database that's had the data imported with a variety of
> > tools - not all of them ve
Hi Russ,
Do you mean you can define a custom forms and get it to appear as the
default change form in admin? Is there currently any documentation on
this?
There seems to be no end to delights you can get from newforms-
admin ;)
AndyB
On Jun 4, 7:33 am, "Russell Keith-Magee" <[EM
I'm struggling to understand the following:
http://dpaste.com/54745/
It's a legacy database that's had the data imported with a variety of
tools - not all of them very well behaved when it comes to character
encoding. The offending character is a UK pound sign (163 in unicode
and latin1 I
I struggled to work this out and it's one of those problems that's
hard to work out what you should Google for.
It would make a worthy addition to the docs IMHO.
On May 10, 4:08 am, Greg Fuller <[EMAIL PROTECTED]> wrote:
> Thanks to both. Got it working.
>
> On May 9, 9:17 pm, Aaron Fay
I've been down this road and I will say that although you can modify
the Admin to do everything you need - it actually turns out to be more
complex that just writing your own CRUD (which newforms makes a
delight).
It's a shame in some ways - Admin is so nearly ready for this kind of
thing that
I was reading this page
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser
and was wondering how the advice on avoiding the hack applied to my
own use case.
I am using the ThreadLocals hack to get the current user in a model
when overriding the save() method. Therefore I can't pass
server)
Anyway. I'll try your fix and report back.
thanks
AndyB
On Apr 1, 2:47 am, Michael <[EMAIL PROTECTED]> wrote:
> This is an instance of the AlreadyRegistered exception rearing its
> head in the contrib.auth section, something I have been banging my
> head against sin
Some code that has previously worked fine and still works fine on my
development server has started giving the following error on a
production server when I try and visit my login page:
ViewDoesNotExist at /accounts/login/
Could not import django.contrib.auth.views. Error was: cannot import
name
I've found that the only problems I encountered on my first couple of
Django projects were the following:
1. Unix problems due to not being very experienced with Unix shell
stuff.
2. Spending way too long trying to customize the admin because I
didn't realise how easy it would be to write my own
Just read James Bennett's excellent article here:
http://www.b-list.org/weblog/2007/nov/01/django-tips-template-loading-and-rendering/
In it he mentioned request_context and the context_instance parameter
to render_to_response and mentions that many people he talks to don't
know of it's
(my reply via email doesn't appear to have made it to the list - sorry
if the first paragraph is a repeat for anyone)
Thanks Chris, I didn't know about this and it would be the ideal
solution if I could get Dreamhost to install mod_xsendfile! Still
hopefully this will be useful for someone out
solution then what would be the most CPU efficient
way to read a file in and send it over HTTP?
regards,
Andy
On Oct 16, 11:46 pm, Graham Dumpleton <[EMAIL PROTECTED]>
wrote:
> On Oct 16, 11:58 pm, AndyB <[EMAIL PROTECTED]> wrote:
>
> > Hi folks,
>
> > Am I rig
Hi folks,
Am I right in thinking the only way to do is this under CGI etc. is to
either:
1. To use raw HTTP authentication
or
2. To pipe all content through Python by reading the file in and
serving it from a view
--~--~-~--~~~---~--~~
You received this message
I've just spotted something fairly obvious!
The whole thing is wrapped in:
{% if inline_admin_form.original or inline_admin_form.show_url %}
That would explain it then!
On Oct 2, 4:25 pm, AndyB <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm overriding an admin templat
Hi there,
I'm overriding an admin template (but doubt uf that is particularly
relevent) and am not sure why the following behaviour occurs.
I've modified the line:
{% if inline_admin_form.original %}{{ inline_admin_form.original }}{%
endif %}
to be:
{% if inline_admin_form.original
%}test1{{
Although I think this view is mostly true at the moment I have a
feeling that it will change in the near future.
The admin pages are currently fairly customisable and newforms-admin
expands this capability extensively.
The problem is two-fold:
1. Documentation in this area is fairly weak and a
this although there were some other
tickets on vaguely related issues:
http://code.djangoproject.com/ticket/5628
http://code.djangoproject.com/ticket/5388
I'd be grateful if anyone can confirm/deny this on trunk. Anyone got
any other thoughts on this?
cheers,
AndyB
That's AND and OR to those of us who never had to learn set theory ;-)
On Sep 24, 9:49 pm, jake elliott <[EMAIL PROTECTED]> wrote:
> hi francesco
>
> cesco wrote:
> > I have two QuerySets and I need to join them to pass them as first
> > parameter to the ObjectPaginator class.
> > How can I do
Django templates use the dot syntax for several purposes: object
attributes, dictionary lookups, list indexes and method calls. Have a
look here:
http://www.djangoproject.com/documentation/templates/#variables
(note that you can't pass parameters to method calls so only methods
calls that don't
Lovely. I'd never seen the function(**{expression}) syntax before.
For anyone else in the same boat the rather terse official explanation
is here: http://docs.python.org/ref/calls.html (search the page for
'**expression')
Tim Chase wrote:
> > if (search_query['organisation']!=""):
> >
So if I've got code like this:
if (search_query['organisation']!=""):
jobs = jobs.filter(organisation=search_query['organisation'])
if (search_query['region']!=""):
jobs = jobs.filter(region=search_query['region'])
if (search_query['category']!=""):
jobs =
Yep. Spotted your second point. All my admin change pages are broken.
Going to revert unless anyone knows a quick fix.
On Sep 16, 8:56 pm, Rob J Goedman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Today's version shows 2 problems, the first problem is related to
> date/time formats in fixtures, the 2nd
For SEO (and accessibility) reasons. I would like to see this using an
image replacement technique. I've used SIFR on a Django site and
rather liked it but if you want an image rather than SWF based
solution then there are several approaches with varying merits.
(rather too many as a quick
I just tried this against trunk and got the same results.
>From a quick perusal of the admin code I can't see any special code
for template loading. Where is this functionality supposed to reside?
--~--~-~--~~~---~--~~
You received this message because you are
I was rather pleased to read that the above was possible according to
the Django book: http://www.djangobook.com/en/beta/chapter18/ (scroll
down to the section called 'Customizing admin templates')
I've already been overriding the admin templates globally by putting
custom templates in a folder
.
thanks in advance,
AndyB
--~--~-~--~~~---~--~~
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
I'm using code like this to simulate row level permissions:
class JobOptions (admin.ModelAdmin):
def queryset(self, request):
userOrg = Organisation.objects.filter(contact=request.user.id)
if (request.user.id==1): # admin can edit all jobs
return Job.objects.all()
my admin options and hooks in models.py. Is there a
consensus for where they should go now? It would be nice to have
conventions for things like this.
On 23 Jul, 22:09, Jonathan Buchanan <[EMAIL PROTECTED]>
wrote:
> AndyB wrote:
> > Page 18 and 19 of this
> > PDF:http://www
Page 18 and 19 of this PDF: http://www.vanpyz.org/Djangojam/django_vancouver.pdf
give examples of some of the new hooks available in newforms-admin.
This is the only documentation I can find anywhere for this at the
moment.
The examples involve declaring a class called Admin. I think I might
be
Me too. I've had my share of problems but the two key things that got
it working reliably was asking Dreamhost support to increase the
servers 'softlimit' setting and to use the filename 'dispatch.fcgi'
rather than 'django.fcgi' so that Dreamhost's process pruner doesn't
keep killing Django.
Despite having three live Django sites running from Apache and FCGI I
have always felt there was a certain degree of black magic about the
process and I've succeeded only by following instructions and keeping
my fingers crossed. Quite often the process takes several hours of
fiddling and it seems
This could quite easily be another dumb question but here goes :(
Can a model have a manager that either takes a parameter or can access
the current logged in user?
I simply want to filter any query sets returned from a table called
Properties depending on the current user without having to
> You may be able to use something like mod_auth_mysql to access the db
> directly for authentication (assuming you use mysql). Authorization
> doesn't seem possible without using python.
It's a shared server (or else I'd just install mod_python). When you
say 'doesn't seem possible' what do
to as well.
I'm stuck with fcgi at the moment. The standard CGI method would be to
keep all static files away from Apache and pipe them all through
Python code.
Is there any other solution or failing that does anyone have any
advice/code on the most efficient way to go about this?
AndyB
I'm trying to have a list of images in a doc all hidden in css with
next and prev links that unhide and hide to give the appearence of
scrolling through.
I'm struggling with the Django template system. I know this is putting
logic into templates rather than views but it seems odd to move simple
Hi,
I've been trying to find some documentation on extending the admin
interface or reusing parts of it's functionality. I've found some talk
on the django dev list about enhancing support for this but I can't
quite figure out what's already possible.
Some people have mentioned a copy the
65 matches
Mail list logo