Re: How to call a secure url?

2008-04-20 Thread Peter Rowell
We ran into a problem where users would either a) not be in SSL mode when they should be, or b) be *in* SSL mode when they shouldn't be. We solved it with middleware to make sure that we were always in the correct mode. Note: the page you are on when filling out a form does not, technically, have

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Malcolm Tredinnick
On Sun, 2008-04-20 at 20:16 -0400, Michael wrote: > your days and months can be one your two digits. So: > (r'^(?P\d{4})/(?P > \d{1,2})/(?P\d{1,2})/(?P[a-z0-9-] > +)/$', > > You can always open up a shell and see the error that is not showing > up in your template. Use the reverse function.

Re: Post_save signal gets triggered twice

2008-04-20 Thread Malcolm Tredinnick
On Sun, 2008-04-20 at 16:05 -0700, meppum wrote: > I think I figured out what it is. After finding the post below which > referenced ticket #3951 it seems it's a known issue. > > The last time the ticket was updated was June of 2007. Am I to > understand this is not going to be fixed? If it

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread dallas lynn
I believe this is a postgres thing -- the transaction failed but postgres didn't rollback, and the message_set.create tries to put a message in the database. it's kind of ghetto, but you can also try manually rolling back postgres when you catch the exception but before you set the message.

Re: How to call a secure url?

2008-04-20 Thread Jonas Oberschweiber
As far as I understand it, you need to put the code from the snippet in its own file and either put that in your project's directory or somewhere in your python path. Then you have to add the class to settings.py (there are some existing middlewares, just see how they do it). I don't have any

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread Kenneth Gonsalves
On 21-Apr-08, at 6:42 AM, radioflyer wrote: > I've decided to manually check for uniqueness after form validation > and before saving, and that seems to work fine for now. > > Things like 'unique_for_date' and 'unique_together' seem to work great > in the admin interface, but in the wild, you

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread radioflyer
Hello Kenneth, Yes it would. If the user tries to submit a Change that is not unique on 'student' and 'date' , I want to return them back to the original page with a message that says "You've already got a change submitted for that date." I'm guessing that the programming error has to do with

How to call a secure url?

2008-04-20 Thread Greg
Hello, I have a page on my site where customers can place their order. This page is secure (https://). I'm finding that whenever some users click click submit they are presented with a message saying: // Security alert you are about to be redirected to a connection that is not secure. The

Re: Layout Questions

2008-04-20 Thread Kenneth Gonsalves
On 21-Apr-08, at 3:05 AM, Greg Lindstrom wrote: > I'll be happy to post some code, but I'd like some direction on how > to set up a page. I would like a header and sidebar. The footer > is optional, but I think it gives a nice, finished look to the page > (and it's where I have the

Re: 'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread Kenneth Gonsalves
On 21-Apr-08, at 12:50 AM, radioflyer wrote: > > Hello, > I need some help with the code after the IntegrityError exception. > > > s = Student.objects.get(pk=student_id) > > if request.method == 'POST': > form = ChangeForm(request.POST) > if form.is_valid(): > try: >

Re: Layout Questions

2008-04-20 Thread Michael
Hey Greg; It's good to see you having fun with setting up your first web app. Laying out in Django is really great because it let's you work with style and markup however you like. I generally layout the entire site in HTML and CSS before I even start working with the django application. Your

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Michael
your days and months can be one your two digits. So: (r'^(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P[a-z0-9-] +)/$', You can always open up a shell and see the error that is not showing up in your template. Use the reverse function. Check out: http://www.b-list.org/weblog/2007/sep/06/tips-and-tricks/

Re: Widgets with an error class

2008-04-20 Thread Juanjo Conti
J. Pablo Fernández escribió: > No ideas on this? Hi! By default they are wrapped in ERROR MESSAGE. Juanjo -- mi blog: http://www.juanjoconti.com.ar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: Widgets with an error class

2008-04-20 Thread J . Pablo Fernández
No ideas on this? On Apr 6, 2:38 am, J. Pablo Fernández <[EMAIL PROTECTED]> wrote: > Hello, > > Is there some way to add a class="error" or wrap the inputs in a class="error"> when the field has a validationerror? > > Thanks. --~--~-~--~~~---~--~~ You received

Layout Questions

2008-04-20 Thread Greg Lindstrom
Hello Everyone- I to the point of putting together my first Django web app (heck, my first real web app). It's for a gym where my daughter takes gymnastics (level 7, thank-you). This one is mostly static content, but I have created a few tables and it's getting me a feel for putting together a

Re: Can't get ThreadLocals (user in threadlocal storage) working.

2008-04-20 Thread Doug B
Its been a while, but I had problems getting this to work at first too. It turned out to be how I was importing the module that contained thread locals. I needed to specify the project as well as the app when doing the import. I couldn't just do from myapp import mymiddleware, I had to do from

Connect users in models.py to admin site users

2008-04-20 Thread chiefmoamba
Hello, I have a model in models.py as shown below: class Tutor(models.Model): first_name = models.CharField(maxlength=40) last_name = models.CharField(maxlength=40, core=True) etc... etc... It simply captures fname and lname and adds it to my database. It works. However, the

'message_set' causes ProgrammingError while handling Exception

2008-04-20 Thread radioflyer
Hello, I need some help with the code after the IntegrityError exception. s = Student.objects.get(pk=student_id) if request.method == 'POST': form = ChangeForm(request.POST) if form.is_valid(): try: form.save() request.user.message_set.create(message="Your

Re: best practice for creating featured field

2008-04-20 Thread Merrick
Thank you, I had various as errors as you pointed out and as soon as I implemented your suggestions and reset the database it all works now. On Apr 20, 8:43 am, Peter Rowell <[EMAIL PROTECTED]> wrote: > > featured_place = models.ForeignKey(Place, null=true, blank=true) > > 1. By any chance

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Eric Abrahamsen
Whoops, sorry, that was bad advice, please ignore! On Apr 20, 2008, at 5:19 AM, Matt wrote: > > I'm trying to get the following get_absolute_url function working in > one of my models: > > >def get_absolute_url(self): >

Re: Admin page doesn't show calendar popup

2008-04-20 Thread chiefmoamba
Hi, I had the same problem earlier - 0.96 on Leopard. How do you switch to trunk? Thanks, Ed On Apr 20, 4:53 pm, sinker <[EMAIL PROTECTED]> wrote: > Switching to trunk WORKED. Thank you so much! > > On Apr 19, 7:42 am, Polat Tuzla <[EMAIL PROTECTED]> wrote: > > > I got the same problem with

questions about Django.db

2008-04-20 Thread 小龙
Just as in table Test: name url sizetime a a1 a2 a3 b b1 b2 b3 When i get "a" ,how i can get other attrs about a1,a2,a3 while querying? Thanks a lot :D -- deSign thE fuTure http://www.freeis.cn/

Re: Leopard and Mod_Python.

2008-04-20 Thread Lee Hinde
On Apr 20, 1:32 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Apr 20, 3:54 pm, Lee Hinde <[EMAIL PROTECTED]> wrote: > > > This is more venting than anything. > > > As a long-time Mac fan boy I'm hugely disappointed at how much trouble > > it's been to get Apache/MySQL/Mod_Pythyon/django

Re: Admin page doesn't show calendar popup

2008-04-20 Thread Jon Loyens
Check that the localizations got installed when you installed .96. This was a problem I had... the installer didn't install the admin templates or any of the localization files and I had to copy them in manually. Jon. On Apr 20, 10:53 am, sinker <[EMAIL PROTECTED]> wrote: > Switching to trunk

Re: Admin page doesn't show calendar popup

2008-04-20 Thread sinker
Switching to trunk WORKED. Thank you so much! On Apr 19, 7:42 am, Polat Tuzla <[EMAIL PROTECTED]> wrote: > I got the same problem with the version 96.1 on Mac. > Then switched to trunk and everything went OK. > Unfortunately can't tell you why this happened, as I did not bother to > investigate

Re: best practice for creating featured field

2008-04-20 Thread Peter Rowell
> featured_place = models.ForeignKey(Place, null=true, blank=true) 1. By any chance are you getting an error like "NameError: name 'true' is not defined"? The python keyword is "True", not "true". 2. If you reference a mode before it is defined, you need to supply a string for the

Re: Admin page doesn't show calendar popup

2008-04-20 Thread Juanjo Conti
sinker escribió: > I checked it out on every browser I have installed on my machine > (incl. Firefox) ... no calendar on any of them. I'll try switching to > trunk. > I had no this problem in 0.96 running firefox on Ubuntu. Juanjo -- mi blog: http://www.juanjoconti.com.ar

Re: Admin page doesn't show calendar popup

2008-04-20 Thread sinker
I checked it out on every browser I have installed on my machine (incl. Firefox) ... no calendar on any of them. I'll try switching to trunk. Thanks to everyone! On Apr 19, 10:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I believe this was a Safari issue that was fixed at some point

obfuscating form fields in templates and admin

2008-04-20 Thread Jon Loyens
Hi all, I'm working on an application where a user has an a special number assigned to them. This account number must be editable both by the user and in admin. I want the number to be obfuscated in the form when it is initially displayed but then when overwritten by a customer service rep (in

Can't get ThreadLocals (user in threadlocal storage) working.

2008-04-20 Thread Hilbert Schraal
Hi All, I've followed the CookBook (http://code.djangoproject.com/wiki/ CookBookThreadlocalsAndUser) to have the user available in my model. I have added the ThreadLocals class to my code and added it to the middleware class setting. It gets called en sets values that look valid. However, when

Re: Setting up get_absolute_url with a generic view

2008-04-20 Thread Eric Abrahamsen
Matt, You're using get_absolute_url to return an actual view – it's only meant to return a string representing the the URL for that model instance. The generic view information goes in your URL config file only, and get_absolute_url should return a URL that is matched by one of the

Re: DateTimeField calendar not showing

2008-04-20 Thread chiefmoamba
Yes - sorry. In the admin. Thanks. Ed On Apr 20, 1:59 pm, Juanjo Conti <[EMAIL PROTECTED]> wrote: > chiefmoamba escribió: > > > Hi All, > > > For some reason my DateTimeField is not showing a calendar next to the > > 'DateTime' box in my view. My code from models.py is below. Can anyone > >

Re: Custom form field overrides model attributes?

2008-04-20 Thread Berco Beute
Thanks, Phil! That works perfectly. The only thing that feels awkward about Django's models is that the attributes feel like a mixture of stuff that belongs to the view and stuff that belongs to the model (blank=True, null=True anybody?). But that's about the only small complaint I have about

How to use ImageField to save images to dynamic path

2008-04-20 Thread PENPEN
I defined such a model: class Thing(models.Model): photo = models.ImageField( upload_to='images/', blank=True, null=True) Here is the form for this model: class ThingForm(ModelForm): class Meta: model = Thing Now it could handle the image upload request and save images

Re: Custom form field overrides model attributes?

2008-04-20 Thread Juanjo Conti
Berco Beute escribió: > Using: Latest from trunk > > I'm using a custom widget for datetimefields: > BTW, which one are you using? The one that wrappers jscalendar? Juanjo -- mi blog: http://www.juanjoconti.com.ar --~--~-~--~~~---~--~~ You received this

Re: DateTimeField calendar not showing

2008-04-20 Thread Juanjo Conti
chiefmoamba escribió: > Hi All, > > For some reason my DateTimeField is not showing a calendar next to the > 'DateTime' box in my view. My code from models.py is below. Can anyone > offer me any suggestions? I am using 0.96. You mean in the admin or in any other place? Juanjo -- mi blog:

Re: Question with querysets and foreignkey relationships

2008-04-20 Thread Julien
Ok, I see. After some mucking around, I managed to make it work like this: orgs = Organisation.objects.filter(blabla=something) values = orgs.values('country') country_id_list = [value['country'] for value in values] num_countries = Country.objects.filter(id__in=country_id_list).count() Looks

Setting up get_absolute_url with a generic view

2008-04-20 Thread Matt
I'm trying to get the following get_absolute_url function working in one of my models: def get_absolute_url(self): return ('django.views.generic.date_based.object_detail', (), { 'year': self.start_date.year,

DateTimeField calendar not showing

2008-04-20 Thread chiefmoamba
Hi All, For some reason my DateTimeField is not showing a calendar next to the 'DateTime' box in my view. My code from models.py is below. Can anyone offer me any suggestions? I am using 0.96. Thanks, Ed from django.db import models class Course(models.Model): course =

Re: post_save Signal Trouble

2008-04-20 Thread Malcolm Tredinnick
On Sun, 2008-04-20 at 03:49 -0700, Alex Koshelev wrote: > No, in python each module evaluates one time - at import process. Your answer depends upon the condition that things are only imported once, which isn't true if __import__() is used (it acts like reload()). Since Django uses __import__

Re: Question with querysets and foreignkey relationships

2008-04-20 Thread Malcolm Tredinnick
On Sun, 2008-04-20 at 03:32 -0700, Julien wrote: > Hi, > > Here's my code: > > class Country(models.Model): > > > class Organisation(models.Model): > country = models.ForeignKey(Country, db_index=True) > > > > Then, in a views, I select a number of organisations: > >

Re: post_save Signal Trouble

2008-04-20 Thread Alex Koshelev
No, in python each module evaluates one time - at import process. On Feb 29, 12:18 am, itodd <[EMAIL PROTECTED]> wrote: > Ok, > > I've figured out models.py was being evaluated multiple times. Where > should I put my dispatcher code to ensure this doesn't happen? > > Thanks, > > Todd > > On Feb

Re: Apache processes locked when using locmem cache

2008-04-20 Thread Graham Dumpleton
On Apr 20, 3:51 am, yish <[EMAIL PROTECTED]> wrote: > Hi, > > I am having a problem with Apache (prefork),mod_python, Django (trunk- > version 6410) and python 2.5.1. I am currently testing my site with 5 > apache processes and haven't yet set up memcached (on the list but had > some issue with

Question with querysets and foreignkey relationships

2008-04-20 Thread Julien
Hi, Here's my code: class Country(models.Model): class Organisation(models.Model): country = models.ForeignKey(Country, db_index=True) Then, in a views, I select a number of organisations: orgs = Organisation.objects.filter(blabla=something) Now, I'd like to get the

Re: Custom form field overrides model attributes?

2008-04-20 Thread Phil Davis
On 20/04/2008, Berco Beute <[EMAIL PROTECTED]> wrote: > > Using: Latest from trunk > > I'm using a custom widget for datetimefields: > > == > #models.py > class Event(models.Model): > endDateTime = models.DateTimeField('Finish', blank=True, >

Re: Custom form field overrides model attributes?

2008-04-20 Thread Malcolm Tredinnick
On Sun, 2008-04-20 at 02:20 -0700, Berco Beute wrote: > Using: Latest from trunk > > I'm using a custom widget for datetimefields: > > == > #models.py > class Event(models.Model): > endDateTime = models.DateTimeField('Finish', blank=True, > null=True) >

Custom form field overrides model attributes?

2008-04-20 Thread Berco Beute
Using: Latest from trunk I'm using a custom widget for datetimefields: == #models.py class Event(models.Model): endDateTime = models.DateTimeField('Finish', blank=True, null=True) #forms.py class EventForm(forms.ModelForm): endDateTime =

Re: Sending emails with special characters

2008-04-20 Thread Julien
Thanks Malcolm, I opted for the Django solution and it worked indeed. Here's the new code: from django.conf import settings from django.core.mail import EmailMultiAlternatives, SMTPConnection smtp_server='XXX' # Only because I want to use different settings than the default ones

Re: Need help loading template

2008-04-20 Thread spirit
I think you can write it like (r‘^([\w-]+)/(\d{4})/(\d+)/(\d+)/(?P\d+)/$’, find_seminar_occurrence), it should be OK. On 4月20日, 上午10时31分, Brandon Taylor <[EMAIL PROTECTED]> wrote: > Changing my urls.py to this: > > from django.conf.urls.defaults import * > from rdk.training.views import * > >

Re: Leopard and Mod_Python.

2008-04-20 Thread Graham Dumpleton
On Apr 20, 3:54 pm, Lee Hinde <[EMAIL PROTECTED]> wrote: > This is more venting than anything. > > As a long-time Mac fan boy I'm hugely disappointed at how much trouble > it's been to get Apache/MySQL/Mod_Pythyon/django all working together > on an Intel Mac running Leopard. > > This

Is psyco project alive?

2008-04-20 Thread bcurtu
Is psyco active and alive? Is it compatible with django? What about Pypy? Anyone using any of these jit engines to run Django? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: How to overwrite the hyperlink of objects in change list template of django admin?

2008-04-20 Thread Leon
I had worked out my way. The hyperlink for a specifc object in admin interface is actually hardcoded in contrib.admin.views.main.py, line 766: def url_for_result(self, result): return "%s/" % quote(getattr(result, self.pk_attname)) so what I did, is to overwrite this method of the

Re: how do designers create content

2008-04-20 Thread Kenneth Gonsalves
On 20-Apr-08, at 12:16 PM, James Bennett wrote: > On Sun, Apr 20, 2008 at 1:33 AM, lee <[EMAIL PROTECTED]> wrote: >> designers. Do the designers use text base editting like ultraedit or >> or graphics based software like dreamweaver? Most of the artist I >> know >> don't do much coding and

Re: how do designers create content

2008-04-20 Thread James Bennett
On Sun, Apr 20, 2008 at 1:33 AM, lee <[EMAIL PROTECTED]> wrote: > designers. Do the designers use text base editting like ultraedit or > or graphics based software like dreamweaver? Most of the artist I know > don't do much coding and are into photoshop, illustrator and > dreamweaver. Most

Re: how do designers create content

2008-04-20 Thread Kenneth Gonsalves
On 20-Apr-08, at 12:03 PM, lee wrote: > Do the designers use text base editting like ultraedit or > or graphics based software like dreamweaver? Most of the artist I know > don't do much coding and are into photoshop, illustrator and > dreamweaver. On sites like lawrence.com where there are

how do designers create content

2008-04-20 Thread lee
I am new to django, but I think it is really cool. I have used other web dev systems before like zope/plone and php. I am a little new to the template type system of django and I was wondering how most web designer create therir content when there are seperate programmers and designers. Do the