On May 17, 7:47 am, Brij <[EMAIL PROTECTED]> wrote:
> Please help me getting the django database api for this query which i
> can use in the my view and send the object to my template to display
> the result
Hi, check out this snippet I posted that tries to make similar SQL
like this reusable. Un
So usually when I need to do this I just do a bunch of trial and error
in lighttpd and get stuff mostly working, but I've never been happy
with it.
I want to have a Django project 'mounted' at /rta and another at /
crime, both at the same domain. Sadly lighttpd doesn't support URL
rewriting insid
On Apr 10, 8:31 pm, "Brian Beck" <[EMAIL PROTECTED]> wrote:
> I'm not sure, but it might be that tildes aren't valid URL characters.
> Web browsers have to violate the spec in order to support this thanks
> to someone screwing up a long time ago...
It might a
On Apr 10, 8:10 pm, "ryan k" <[EMAIL PROTECTED]> wrote:
> > Am I missing something simple?
I'm not sure, but it might be that tildes aren't valid URL characters.
Web browsers have to violate the spec in order to support this thanks
to someone screwing up a long time ago...
--~--~-~--~--
On Feb 23, 5:31 pm, "Chris Green" <[EMAIL PROTECTED]> wrote:
> What is happening in the CAS case, is it redirects to the CAS login
> url, which says the user is authorized and redirects to this
> particular login page and it repeats forever if the user does not have
> authorized permissions.
>
> H
u're welcome to check out the code to see what needs to be done for
such a task; it's mostly middleware stuff. Details are here: http://
blog.case.edu/bmb12/2006/12/cas_for_django_part_2
Good luck,
--
Brian Beck
Adventurer of the First Order
--~--~-~--~~~---~
The JSON method mentioned above should work fine.
Two methods that might be less fragile than code generation:
- Hidden form inputs. Less fragile because the 'escape' filter should
allow you to safely dump data into attribute values in your template, I
think. Then use form.elements or MochiKit'
Hi,
I make using static.serve a little cleaner like so:
In settings.py:
STATIC_OPTIONS = {'document_root': MEDIA_ROOT, 'show_indexes': True}
In urls.py:
from django.conf import settings
...
(r'^static/(?P.*)$', 'django.views.static.serve',
settings.STATIC_OPTIONS),
(change 'static/' above to
I think your problem is the return values. args is a tuple and request
should be there instead. In both of your decorators, return fn(request,
*args, **kwargs) instead of fn(args, kwargs).
--~--~-~--~~~---~--~~
You received this message because you are subscribed
John Matthew wrote:
> Thank you for the reply.
No problem. :)
--~--~-~--~~~---~--~~
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
Hi,
object_list takes an allow_empty argument, try settings it to True.
>From the docs:
allow_empty: A boolean specifying whether to display the page if no
objects are available. If this is False and no objects are available,
the view will raise a 404 instead of displaying an empty page. By
defa
ry order
as far as I know (I'm not sure how that could work).
But if get_absolute_url() just returns 'http://whatever/categories/' +
self.name for example, it may make sense to just do
Category.objects.order_by('name').filter(...).
--
Brian Beck
Adventurer of the First Order
Robert Slotboom wrote:
> > sorted(Category.objects.all(), key=Category.get_absolute_url)
>
> This is a very nice approach!
> Although, shouldn't these "get_absolute_url" calls be followed by () ?
Nope! Python will call it for you. The good thing is it will only call
it once per item instead of on
ll(), key=Category.get_absolute_url)
Then Python will call the method for you (and maybe cache the result for
further comparisons).
--
Brian Beck
Adventurer of the First Order
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Googl
Ramdas S wrote:
One question, validators are supposed to get deprecated once the new forms
becomes the default.
How do we use the newforms validation to do this?
Hmm. I actually rather liked django.core.validators.
My guess is that it's not currently possible to predict how this will be
done
Couple more things I discovered...
This page documents a RequiredIfOtherFieldsNotGiven validator that
doesn't actually exist!
http://www.djangoproject.com/documentation/forms/#validators (it's
close to what you want but not exactly -- you want it to be required if
*neither* of the other fields a
Whoops, don't forget to add this wherever you put that
RequiredIfNoneGiven code:
from django.core.validators import gettext_lazy, ValidationError
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Django
users" grou
borntonetwork wrote:
I have a model object called Customer. It contains the typical
attributes/fields you might expect (name, street, apt, city, state,
etc). Among these fields are 3 called home_phone, work_phone, and
cell_phone. In the admin web interface, I need to ensure that the user
must e
borough peter wrote:
Yet the admin interface doesn't allow me to leave it empty:
IntegrityError at /xxx/xx/xxx/add/
xxx_x.myfloat may not be NULL
Hi,
blank=True allows admin interface input to be an empty string, while
null=True allows it to be NULL in the database. You want both.
C
[EMAIL PROTECTED] wrote:
Any usage of Redirect breaks Back button (or at least makes it usage
more difficult since you need to
go back a one step more).
It doesn't introduce an extra Back step; this isn't like a META EQUIV
redirect or whatever. Pressing back still works to get them to the
pag
It would seem that something is happening between the authentication
middleware setting request.__class__.user and the context processor
reading it.
Couple things to try if you're in a debugging mood:
After line 11 in django/contrib/admin/middleware.py:
request.__class__.user = LazyUser()
+
Brian Beck wrote:
class Payment(models.Model):
...
class Custom:
def sortable_fields = ['amount', 'received_date']
That last line should of course just be:
sortable_fields = ['amount', 'received_date']
--~--~-~--~~--
ringemup wrote:
Does that apply to the actual sorting of the data as well? It seems to
me that it's something most efficiently accomplished at the database
level.
If sorting will always be done by field in the model (and not some
complex combination, for example), and SQL orders it how you're
A lot of time has been spent on making Django not-too-magical while
keeping the rapid development time. I've found that it rarely does too
much automatic stuff behind my back.
Just a couple examples of high-level stuff that isn't
too-high-for-your-own-good:
* Database access. You can still use
Sorry if this has been brought up before, I tried searching...
Would it be too complex/controller-y/confusing to allow sequence
unpacking in Django's for loops? As far as I can tell it isn't
supported. So for example, if I have a list...
fruits = [('apple', 10), ('orange', 5), ('banana', 7)]
from django.utils.text import get_text_list
--~--~-~--~~~---~--~~
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, s
tonemcd wrote:
> Again, thanks heaps for making this available - it's done the business
> for me!
Tone,
Awesome! Glad it worked. :)
Brian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To
Hi Tim,
James Bennett wrote about how to do this not too long ago, check it out
here:
http://www.b-list.org/weblog/2006/11/02/django-tips-auto-populated-fields
--
Brian Beck
Adventurer of the First Order
--~--~-~--~~~---~--~~
You received this message because
Ivan Sagalaev wrote:
> Brian Beck wrote:
> > I don't understand how this is related to the admin interface.
>
> Admin interface won't display a login page if you already have
> request.user set to an existing user. (if I'm not mistaken :-) ).
Yep, okay. I wa
Brian Beck wrote:
> I don't understand how this is related to the admin interface. Anyway,
> shouldn't it go after the standard auth middleware, so that
> django.contrib.auth.middleware doesn't clobber the request.user that
> the middleware posted above sets? And
I don't understand how this is related to the admin interface. Anyway,
shouldn't it go after the standard auth middleware, so that
django.contrib.auth.middleware doesn't clobber the request.user that
the middleware posted above sets? And you still need to take into
account the admin interface's
I just wanted to add that if you want to use this method in combination
with the bundled admin interface, you're gonna have to intercept any
admin requests and do the authentication so that it won't show the
login form. Check the latest post in the CAS authentication thread,
the middleware code t
Alright, I fixed things up a bit and went for the middleware approach.
The CAS module can now intercept all admin interface requests and do
the appropriate authentication routine instead of showing the login
form. Everything can now be configured in settings.py as well so
there's no need to muck
Hi,
If I'm developing middleware or an app that I want a user to be able to
configure in their settings.py, how should I go about setting defaults
in there? I checked out django.conf, and it just looks like
global_settings.py registers the defaults for every possible module
included with Django.
Alright, I'm gonna throw a question out there, maybe someone can help.
As shown above I can intercept the admin index page in order to not
display the login form which doesn't make sense for CAS authentication.
However, this only works if the user needs to be authenticated and
requests the index
Quick followup in case anyone is interested (anyone? Bueller?)...
One problem is handling the admin site, which doesn't really account
for an authentication backend that doesn't know the user's password
(making the login form useless). So, without wanting to hack up
django.contrib.admin, here's
rItem(quantity=10, price=1.5, total=2, order=o, product=p).save()
>>> OrderItem(quantity=5, price=10.5, total=20, order=o, product=p).save()
Here's the part you want:
>>> o.orderitem_set.all()
[, ]
Hope that helps.
--
Brian Beck
Adventurer of the First Order
--~--~
#x27;t forget to put 'your_site.cas' in INSTALLED_APPS and enable
'django.contrib.auth'.
Also see cas/backends.py if you have a way to automatically determine
the user's name and e-mail from the username (from LDAP for example),
or if you need to implement more of the CAS protocol
38 matches
Mail list logo