Unicode in unit tests

2011-10-10 Thread Bastian Ballmann
Hi all, I try to use a utf8 string in a Django unit test and have included # -*- coding: utf-8 -*- but django-admin.py still complaints there is no encoding. Traceback (most recent call last): File "/home/basti/work/virtualenv/bin/django-admin.py", line 5, in management.execute_from_comma

Re: Installing Django

2011-10-10 Thread Cal Leeming [Simplicity Media Ltd]
I've seen quite a few people now with this problem of corrupt Django installs - specifically for users who are new to Django. Perhaps someone could shed some light as to why this keeps happening. Bob - why are you using version 1.0, and is there any particular reason you are using it within a Win

Viewing IP address in the login screen, using Django authentication

2011-10-10 Thread peter-ctp
Folks I am using the standard django authentication to allow people access to various web resources. I manage the password/username logins through the template login.html file and almost everything works fine. However: I would like to show the IP address of the user's computer, as it is seen by t

Re: How to do equivalent of LEFT JOIN ON in Django (returning all Left rows, when Right item may not exist)

2011-10-10 Thread Attempting Django
Thanks everyone for your comments. I solved the problem, not very elegantly, but solved nevertheless: q1 = OurProduct.objects.select_related().exclude(productoverride__customer=1) q2 = ProductOverride.objects.select_related().filter(customer=1) from itertools import chain customerpricelis

Re: Installing Django

2011-10-10 Thread Karen Tracey
On Mon, Oct 10, 2011 at 6:25 AM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > I've seen quite a few people now with this problem of corrupt Django > installs - specifically for users who are new to Django. > > Perhaps someone could shed some light as to why t

Re: Viewing IP address in the login screen, using Django authentication

2011-10-10 Thread Cal Leeming [Simplicity Media Ltd]
Hi Peter, You need to be using the RequestContext middleware - see 'option #1' on the following: http://lincolnloop.com/blog/2008/may/10/getting-requestcontext-your-templates/ Once you've got that, you can then use {{request.META}} within your templates. There is also a how to here, which shows

Re: Viewing IP address in the login screen, using Django authentication

2011-10-10 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Oct 10, 2011 at 12:30 PM, Cal Leeming [Simplicity Media Ltd] < cal.leem...@simplicitymedialtd.co.uk> wrote: > Hi Peter, > > You need to be using the RequestContext middleware - see 'option #1' on the > following: > ^^^ sorry - I misused the word middleware - possibly cos I was thinking ab

Re: Installing Django

2011-10-10 Thread Cal Leeming [Simplicity Media Ltd]
Wow - that's pretty retarded :X Thanks for clarifying this Karen! On Mon, Oct 10, 2011 at 12:25 PM, Karen Tracey wrote: > On Mon, Oct 10, 2011 at 6:25 AM, Cal Leeming [Simplicity Media Ltd] < > cal.leem...@simplicitymedialtd.co.uk> wrote: > >> I've seen quite a few people now with this problem

An application for hierarchical tagging?

2011-10-10 Thread Jim
Is there an application that would characterize the data by hierarchy? That is, I want a taxonomy for my data to go something like this. books books > fiction books > fiction > murder mysteries and my data can be associated with one or more sub-branches of this tree. I'm using django-taggin

Re: An application for hierarchical tagging?

2011-10-10 Thread BILLION Sébastien
Hi, I think this can be exactly what you want: https://github.com/django-mptt/django-mptt BILLION Sébastien the Answer to the ultimate question of life, the universe and everything is 42 http://www.sebastienbillion.com/ Le 10/10/2011 15:00, Jim a écrit :

Re: An application for hierarchical tagging?

2011-10-10 Thread Fabrizio Mancini
On 10 October 2011 15:00, Jim wrote: > Is there an application that would characterize the data by hierarchy? > > That is, I want a taxonomy for my data to go something like this. > books > books > fiction > books > fiction > murder mysteries > and my data can be associated with one or more su

How to use DJANGO as reverse proxy over HTTPS?

2011-10-10 Thread deepak gupta
Hi All, Do any one knows How to use DJANGO as reverse proxy over HTTPS? Do DJANGO webserver support HTTPS? Thanks. Deepak G. -- 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

Re: can't use django session object

2011-10-10 Thread Saba Bokhari
Found a workaround to this: 1st view: baos=ByteArrayOutputStream() #make an outputstream cred.save(baos) #store the credential to the outputstream request.session['user_cred']=baos.toString() #store the string 2nd view: outstring=String(request.session['user_cred']) #get the string bais=ByteArray

Re: How to use DJANGO as reverse proxy over HTTPS?

2011-10-10 Thread Phang Mulianto
dj@ngo is a web development framework to create web application. to serve as proxy better use real web server like apache, nginx, lighttpd or squid. django buildin web server for development use only. if you want to build a proxy, from ground up you can use python which django base on. On Oct 1

Re: Problem in registration form

2011-10-10 Thread Shawn Milochik
Your problem is made clear in the error message. -- 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...@googlegr

Re: Problem in registration form

2011-10-10 Thread BILLION Sébastien
The response is in the message... MultipleObjectsReturned at /accounts/register/ get() returned more than one User -- it returned 4! You can't use get to return more than one object! If you want return multiple object, use .filter If you try to get user with email='jaspritsa...@gmail.com'

Help with implementing dynamic views/models

2011-10-10 Thread xenses
This may seem like a very simple question and I have just missed the answer in the piles of documentation and tutorials that I've read over the past two days. I'm new to Django and trying to implement an internal site at work, and I'm the only Python/Django person we have, so this is all on me. Wh

Re: Installing Django

2011-10-10 Thread Bob Peene
Kejun/Cal/Karen: Thank you very much for the info!! I did rerun setup.py, but given this info, it probably didn't improve anything. I'll wipe the directory and start again. Cal; The 'Django 1.0' is the title of the book by Ayman Hourieh (not my install version) - from reviews I've read this see

Re: Help with implementing dynamic views/models

2011-10-10 Thread Brett Epps
I may be misunderstanding your question, but it sounds like you need to use Page.objects.get or Page.objects.filter (in your view function) to look up the particular objects that you want to send to the template. Brett On 10/10/11 9:53 AM, "xenses" wrote: >This may seem like a very simple ques

Re: Help with implementing dynamic views/models

2011-10-10 Thread xenses
That is exactly what I want to do, I can't seem to understand exactly how to implement that and have it populate in the template. Do I just define the variable in the views and then in the template use {{ variable_name }} where I need it? Because I tried that first and it didn't work. So, maybe I'm

Re: Javabean-like get & set on ModelForm

2011-10-10 Thread Kayode Odeyemi
On Sun, Oct 9, 2011 at 8:40 PM, Daniel Roseman wrote: > Aargh. Just aaargh. There are so many things wrong with this code I hardly > know where to start. Please, try reading some of the documentation, > especially the bit about the uses of `get` vs `filter`. > > On Sunday, 9 October 2011 20:00:36

Re: Constant name error undefined in custom template tags

2011-10-10 Thread Kayode Odeyemi
On Sun, Oct 9, 2011 at 8:49 PM, Daniel Roseman wrote: > On Sunday, 9 October 2011 20:26:26 UTC+1, Kayode Odeyemi wrote: > >> Hello, >> >> I'm creating a template tag that will will allow session variables stored >> as strings or >> dict in a view to be available in its template. The syntax is: >>

Re: Iteration over queryset in a model

2011-10-10 Thread eyscooby
On Oct 5, 3:11 am, Daniel Roseman wrote: > On Wednesday, 5 October 2011 01:27:54 UTC+1, eyscooby wrote: > > > new to django/python developement, can't get this one figured out. > > > I have a model that has a couple DateFields (issued_date & > > completion_date), and I'm trying to return a value

Still problems m2m, ordering, serialisation

2011-10-10 Thread Knack
Hi guys, as I understand, m2m with intermediate model and ordering is a bit (at least) tricky: https://code.djangoproject.com/ticket/11850 I need the ordering in my serialised data. The serialiser must of course be independent of any names, so I use introspection so far. Code so far is here: de

Re: Still problems m2m, ordering, serialisation

2011-10-10 Thread Knack
Forgot to copy one line in front of the many_to_many loop: many_to_manys = obj._meta.many_to_many for many_to_many in many_to_manys: field_name = many_to_many.name # here the magic should happen # ordered_related_objs = hokus_pokus(obj, many_to_many) -- You receiv

Re: Help with implementing dynamic views/models

2011-10-10 Thread Brett Epps
The direct_to_template() function can take an extra_context keyword argument (a dict). So: direct_to_template(request, template='blah.html', extra_context={'foo': bar}) Would let you use {{ foo }} in a template to output the value of the variable bar. By the way, as a replacement for direct_to_t

Re: Iteration over queryset in a model

2011-10-10 Thread Daniel Roseman
On Monday, 10 October 2011 19:14:51 UTC+1, eyscooby wrote: > > > > On Oct 5, 3:11 am, Daniel Roseman wrote: > > On Wednesday, 5 October 2011 01:27:54 UTC+1, eyscooby wrote: > > > > > new to django/python developement, can't get this one figured out. > > > > > I have a model that has a couple

contrib.auth tests - not respecting TEMPLATE_DIRS?

2011-10-10 Thread Justin Holmes
I'm running the contrib.auth tests in a situation where I have a signal hook on login which uses a template. Strangely, when I run the full test suite, I find that in state, the global template dirs contains only "/django/contrib/auth/tests/templates" and not the directory (or -ies) specified in t

Re: Your Impressions on DjangoCMS

2011-10-10 Thread Stuart
Sorry for replying so late, but please see below for inline comments. On Oct 7, 2:22 am, Kevin wrote: > I don't have any professional experience with Django-CMS, however I > did dive into it and try out their demo site and even test out an > installation myself on a server.  My first impressions

Re: Your Impressions on DjangoCMS

2011-10-10 Thread Stuart
On Oct 6, 3:57 pm, colinta wrote: > The only > curve ball is that the client will need customizable forms.  Otherwise > it's a pretty standard site. > There's an app / django-cms plugin for that. I haven't tried it though. https://github.com/philomat/django-form-designer --Stuart -- You rece

Need advice on ForeignKey query problem.

2011-10-10 Thread Sells, Fred
I've got these two tables defined where a Facility can have multiple schedules but a schedule can have only one facility. class Facility(models.Model): id = models.CharField(max_length=2, primary_key=True) name = models.CharField(max_length=30) class Schedule(models.Model):