Re: Language code prefix in url

2008-12-21 Thread Tirta K. Untario
Wow, this is exactly what I'm looking for. I'm gonna try this app soon. Thanks! --Tirta -Original Message- From: Malcolm Tredinnick Date: Mon, 22 Dec 2008 15:26:42 To: Subject: Re: Language code prefix in url On Sun,

Re: Problem with url tag

2008-12-21 Thread patrick91
On 22 Dic, 02:17, Malcolm Tredinnick wrote: > Certainly a bit unexpected. Can you paste the relevant lines from your > URL Conf file, please? > > Regards, > Malcolm Sure :) here it is: url(r'foglio/(?P[0-9]+)/$', views.show_worksheet, name='show_worksheet'), Thanks

Re: Keeping order with order_by while using id__in

2008-12-21 Thread Raisins
Thanks for the in depth feedback about what is going on with the order. Also thanks for the code snippet. I ended up doing something very similar. On Dec 21, 8:16 pm, Malcolm Tredinnick wrote: > On Sun, 2008-12-21 at 08:58 -0800, Raisins wrote: > > i = [ 1, 5,2,6] > >

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Daniel Roseman
On Dec 22, 4:49 am, "Greg Schwimer" wrote: > On Sun, Dec 21, 2008 at 1:47 PM, Daniel Roseman < > > roseman.dan...@googlemail.com> wrote: > > > You won't see errors because you haven't included them in your > > template. Either render the whole form with {{ form.as_p }} - which

Re: Understanding the execution logic of a view

2008-12-21 Thread Daniel Roseman
On Dec 22, 5:20 am, eldonp2 wrote: > Please help me understand the execution logic of a view. I have copied > the example from the official Django documentation: > > def contact(request): >     if request.method == 'POST': # If the form has been submitted... >         form =

Re: Ordering by foreign key object field

2008-12-21 Thread sunn
Thanks! On Dec 22, 10:16 am, Malcolm Tredinnick wrote: > On Sun, 2008-12-21 at 23:07 -0800, sunn wrote: > > [...] > > > I would like to order my Block objects by first page.sortorder and > > then sortorder. Any idea on how to accomplish this? > > I have tried with

Re: Ordering by foreign key object field

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 23:07 -0800, sunn wrote: [...] > I would like to order my Block objects by first page.sortorder and > then sortorder. Any idea on how to accomplish this? > I have tried with ordering = ['page.sortorder', 'sortorder'] but this > does not work ("ordering" refers to

Ordering by foreign key object field

2008-12-21 Thread sunn
from django.db import models class Page(models.Model): sortorder = models.IntegerField() parent = models.ForeignKey('self', null=True, blank=True) class Meta: ordering = ['sortorder'] def __unicode__(self): return self.display class Block(models.Model):

Pseudo OneToOneFields

2008-12-21 Thread Brent Hagany
Hi there. I'm not looking for a fully definite answer here necessarily, but I am searching for input on the best way to attack this problem. Here it is, somewhat abstracted so that you don't have to wrap your head around my problem domain: Let's say I've got two models -

Understanding the execution logic of a view

2008-12-21 Thread eldonp2
Please help me understand the execution logic of a view. I have copied the example from the official Django documentation: def contact(request): if request.method == 'POST': # If the form has been submitted... form = ContactForm(request.POST) # A form bound to the POST data

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 21:46 -0700, Greg Schwimer wrote: > OK, that was very helpful, thank you. Yes, my problem is because I am > not setting the date. Thinking it through, I don't want the user > changing this, so it would be helpful to use the auto_now_add idea you > suggested. However, I

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Greg Schwimer
On Sun, Dec 21, 2008 at 1:47 PM, Daniel Roseman < roseman.dan...@googlemail.com> wrote: > > > You won't see errors because you haven't included them in your > template. Either render the whole form with {{ form.as_p }} - which > will render the errors as well - or for each field include a

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Greg Schwimer
OK, that was very helpful, thank you. Yes, my problem is because I am not setting the date. Thinking it through, I don't want the user changing this, so it would be helpful to use the auto_now_add idea you suggested. However, I can't get that working. Here's my mode; definition for pub_date:

where are the code that handle image file upload in Django admin page?

2008-12-21 Thread Chuck22
I have three ImageField in my form and model, I want to know how to upload the three image files in the form processing code. I found Django Admin page handles the image file upload nicely. And I want to do the exactly same work. But I can not find the piece of code that does the job when

Re: Language code prefix in url

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 19:52 -0800, Tirta K. Untario wrote: > Hi all, I'm new to Django, and trying to port my old site to Django for > practice purpose. > > Different from Django multilingual implementation by using cookie, I want to > add lang code to every url, i.e: > >

Re: accessing to a field value in the template

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 19:57 -0800, iruns...@gmail.com wrote: > Hi, > > I am new in Django and I am wondering if it is possible to access to a > form field value in through a template. > > I know that I can access to the field by {{field}} and also can access > to the field.label, errors,

RE: Language code prefix in url

2008-12-21 Thread Wayper, Paul
> From: Tirta K. Untario > Subject: Language code prefix in url > > /en/my_app/something_here/1/2/3/4/ > /de/my_app/something_here/1/2/3/4/ > /fr/my_app/something_here/1/2/3/4/ My suggestion would be to look at e.g. Apache's URL rewriting rules. Take those URLs and produce

Language code prefix in url

2008-12-21 Thread Tirta K. Untario
Hi all, I'm new to Django, and trying to port my old site to Django for practice purpose. Different from Django multilingual implementation by using cookie, I want to add lang code to every url, i.e: /en/my_app/something_here/1/2/3/4/ /de/my_app/something_here/1/2/3/4/

accessing to a field value in the template

2008-12-21 Thread irunsoft
Hi, I am new in Django and I am wondering if it is possible to access to a form field value in through a template. I know that I can access to the field by {{field}} and also can access to the field.label, errors, label_tag, but I would like to access to the intial value of a field. Suppose I

Re: Table inheritance and polymorphic admin forms

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 18:50 -0800, George Sakkis wrote: > Hi all, > > I have a situation which I think would best be modeled as (single) > inheritance, involving product reviews for various kinds of products. > Naturally, there are some fields which are common to all reviews > (overall rating,

Table inheritance and polymorphic admin forms

2008-12-21 Thread George Sakkis
Hi all, I have a situation which I think would best be modeled as (single) inheritance, involving product reviews for various kinds of products. Naturally, there are some fields which are common to all reviews (overall rating, user, review date) and some which are specific to the type of

Problems when searching acute or tilde letters in a textfield under tiny_mce.js

2008-12-21 Thread Vizcayno
Hello: Using tiny_mce.js into django Admin (change_form.html) is nice, but when you include into a textField letters such as á or ñ and try to find them using the django search engine, no results are obtained because internally the á is represented by and ñ is represented by Is there a way to

Re: "Mix and match" model form?

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 13:18 -0800, stormlifter wrote: > Well that kind of dodges the question. > I two am looking for a way to mix and match a ModelForm No, it doesn't dodge the question (although, because you top-posted, the response was hidden: the suggestion was to use two form objects).

Re: newbie question: validation of primary_key field

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 11:40 -0800, Kaaia wrote: > Hi, > > I am very new in django (and python) so my question may be quite > dummy, so be patient please. I am playing with example based on > django's tutorial. > > I have following class: > > class Pilot(models.Model): > ... > cn =

Re: Problem with url tag

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 11:45 -0800, patrick91 wrote: > Hi, I've a problem with the url tag, when I call this template: > Visualizza > I get this error: > Caught an exception while rendering: Reverse for > 'catsnc.show_worksheet' with arguments '(5537,)' and keyword arguments > '{}' not found. > >

Re: Keeping order with order_by while using id__in

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 08:58 -0800, Raisins wrote: > i = [ 1, 5,2,6] > Model.objects.filter(id__in = i) > > This currently will order them by id, even if i call order_by() with > no parameters. The docs say "If you don't want any ordering to be > applied to a query, not even the default

Re: Problems when searching acute or tilde letters in a textfield under tiny_mce.js

2008-12-21 Thread Malcolm Tredinnick
On Sun, 2008-12-21 at 16:41 -0800, Vizcayno wrote: > Hello: > Using tiny_mce.js into django Admin (change_form.html) is nice, but > when you include into a textField letters such as á or ñ and try to > find them using the django search engine, no results are obtained > because internally the á is

RE: A Top-Level Django Index for the root URL

2008-12-21 Thread Wayper, Paul
From: Ben Pritchard Subject: A Top-Level Django Index for the root URL The intention is that this page will list all my of sandbox projects. So at the moment it just links to http://localhost:8000/polls but (a) coding the link seems like a HTML solution

Re: Django Session Variables

2008-12-21 Thread j...@zigzap.com
Thanks On Dec 20, 11:26 am, Jeff FW wrote: > Looking > athttp://code.djangoproject.com/browser/django/trunk/django/contrib/aut... > it doesn't look like it clears the session.  It *does* generate a new > key, but that shouldn't affect anything.  It should only take you >

Re: S3Storage.py and Thumbnails using PIL (IOError / cannot identify image file)

2008-12-21 Thread j...@zigzap.com
>From what I can tell your not wrapping the thumbnail file in ContentFile your just returning the raw file from the string IO. To use the the ImageField django provides you must provide it with a file that is in a special wrapper called ContentFile. I would suggest trying this: from

Re: "Mix and match" model form?

2008-12-21 Thread stormlifter
Well that kind of dodges the question. I two am looking for a way to mix and match a ModelForm I've got... # Create your models here. class PersonForm(ModelForm): class Meta: model = Person exclude = ('address',) class AddressForm(ModelForm): class Meta: model =

Re: newbie question: validation of primary_key field

2008-12-21 Thread Kaaia
> I see from the traceback that the problem is occurring in > validate_unique. There were various bugs in the validation of unique > elements in forms in version 1.0, which were mainly fixed in version > 1.0.2. Try downloading that version instead and see if that fixes your > problem. Exactly!

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Daniel Roseman
On Dec 21, 7:02 am, schwim wrote: > OK, I'm a total newbie. I ran through the tutorial on the django site, > and decided to extend the poll system a bit just to learn more.  I > figured quite a bit out, but on this one I'm stuck. > > I want to provide a page at polls/new to

Re: newbie question: validation of primary_key field

2008-12-21 Thread Daniel Roseman
On Dec 21, 7:40 pm, Kaaia wrote: > Hi, > >   I am very new in django (and python) so my question may be quite > dummy, so be patient please. I am playing with example based on > django's tutorial. > > I have following class: > > class Pilot(models.Model): >     ... >    

Re: Overwriting Django Authentication / Session Logic

2008-12-21 Thread Bradley Wright
On Sun, Dec 21, 2008 at 8:00 PM, Sahil R Cooner wrote: > You don't have to store anything in the database you can just use the models > to store > information then return that the user is authenticated...I can post a code > example for you I > have made using ldap auth

newbie question: validation of primary_key field

2008-12-21 Thread Kaaia
Hi, I am very new in django (and python) so my question may be quite dummy, so be patient please. I am playing with example based on django's tutorial. I have following class: class Pilot(models.Model): ... cn = models.CharField('Soutěžní znak', max_length = 3, primary_key = True)

A Top-Level Django Index for the root URL

2008-12-21 Thread Ben Pritchard
Hello everyone, First, a warning: I'm a total noob but I have really enjoyed working through the tutorial. The first post-tutorial thing I've done is construct a top-level page that gets rendered using: urlpatterns = patterns('',     (r'^$', 'mysite.views.index'),    This was necessary

Re: i18n/setlang TypeError :(((

2008-12-21 Thread pielgrzym
Thank you Karen :) My python install had some weird patches. Now everything works absolutely fine :) Thanks again :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send

Re: Request dictionary in view

2008-12-21 Thread Alex Jonsson
Did it! Thanks a bunch. On Dec 21, 8:16 pm, Bradley Wright wrote: > Request isn't ending up in the context, try installing: > > http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-c... > > It's not enabled by default, and you need it to make request

Problem with url tag

2008-12-21 Thread patrick91
Hi, I've a problem with the url tag, when I call this template: Visualizza I get this error: Caught an exception while rendering: Reverse for 'catsnc.show_worksheet' with arguments '(5537,)' and keyword arguments '{}' not found. But when I call this code from the shell: >>> from

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Chris
Oh shit, that's awesome! Thanks! I thought it had already created the DB and wanted me to fill in that info... I'm so stupid sometimes. Thanks a bunch mrtot... On Dec 21, 3:50 am, mrtot wrote: > Hi Chris, > > maybe it's the best to just do what the error message suggest: > >

Re: Request dictionary in view

2008-12-21 Thread Bradley Wright
Request isn't ending up in the context, try installing: http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request It's not enabled by default, and you need it to make request available in templates. --~--~-~--~~~---~--~~ You

Request dictionary in view

2008-12-21 Thread Alex Jonsson
Hey guys, I want to check the user's user agent string in a template tag, but when I try to use the request variable in the template I get a Caught an exception while rendering: Failed lookup for key [request] error message. I'm using the generic list_detail templates, is there anything special

Re: Overwriting Django Authentication / Session Logic

2008-12-21 Thread Bradley Wright
I have the same issue, but my issue is that Django is interfacing with a web service and ideally will have *no user database* on the front end. All the examples I've seen involve essentially copying the user from LDAP/wherever and sticking them in the User model, which: a) Is duplication across

Re: Can anyone explain why reverse() never seems to work?

2008-12-21 Thread Bradley Wright
Cheers, I was just doing something stupid then. :) --~--~-~--~~~---~--~~ 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

Re: Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread Fridrik Mar Jonsson
Hi schwim, Welcome to Django! Glad to have you. ;-) You probably receive the same page again because there were errors in the form, most probably because you didn't include all the fields required (as you suspect). To see specifically what errors there were, please refer to:

Re: image uploading, validation by using form

2008-12-21 Thread Chuck22
Before I can write validation of uploaded images, I first need to know how to save multiple upload images in view. Can anyone share some code or reference on this? Thanks. On Dec 20, 10:31 pm, Brandon Taylor wrote: > Hi, > > You can do validation on images by using a

PDF to Text Coverter

2008-12-21 Thread Harish
Hi Friends... I know this is a not a right place to ask this question. but it is related to Python. I thought it to ask. Is there any python library is available to read a pdf files... ? Or any library to convert the pdf into text files? If you have any idea about above issues please

Re: Admin formatting

2008-12-21 Thread MS
Thanks to Graham and Jeff. I moved my code out of the document root and used the proper alias to tell Apache where to find Django's admin.media files. Problem solved ? MS > For mod_wsgi see: > >  http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango >  

Keeping order with order_by while using id__in

2008-12-21 Thread Raisins
i = [ 1, 5,2,6] Model.objects.filter(id__in = i) This currently will order them by id, even if i call order_by() with no parameters. The docs say "If you don't want any ordering to be applied to a query, not even the default ordering, call order_by() with no parameters." Is there a way to

Fwd: Optional fields in admin page

2008-12-21 Thread James PIC
Errata, this email has correct sources, sorry for the pollution. On Sun, Dec 21, 2008 at 4:46 PM, Mirat Can Bayrak wrote: > > hi, i have a state selection which has options "exists", "not exists" and > "redirected" when it is selected as exists i want to show some

Re: Optional fields in admin page

2008-12-21 Thread James PIC
On Sun, Dec 21, 2008 at 4:46 PM, Mirat Can Bayrak wrote: > > hi, i have a state selection which has options "exists", "not exists" and > "redirected" when it is selected as exists i want to show some more fields, > but on other selections i dont want him to show them.

Optional fields in admin page

2008-12-21 Thread Mirat Can Bayrak
hi, i have a state selection which has options "exists", "not exists" and "redirected" when it is selected as exists i want to show some more fields, but on other selections i dont want him to show them. can i do that it django? -- Mirat Can Bayrak

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread mrtot
Hi Chris, maybe it's the best to just do what the error message suggest: "Please fill out DATABASE_NAME in the settings module before using the database. " Put in something like '/home/chris/projects/django-tutorial/db/db.db' You can create your own name. Django just wants to know where it

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Chris
Okay... I'm on part two of the tut now and I am attemping to use Python's built-in SQLite Database just to get a feel for Django. However, the tutorial confuses me in part one when it defines DATABASE_NAME, "The name of your database. If you're using SQLite, the database will be a file on your

Django app deployment creating users without admin app

2008-12-21 Thread Juan Kinunt
Hi! What is the best practice to deploy a Django application creating a user but not installing the admin app. I want to deploy my app to clients cleanly (like i.e "make install") and I need to create a user to be able to start using the django app. I think that a Django app is a bit complicated

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Chris
Thanks Jeff - I've figured it out now... I'm new to Python - I'm 14... Anyway, it's not the UNIX that was screwing me up, it's that I hadn't installed Django properly - just dragged it into site-packages without setting a symlink. Again, thanks for replying - no doubt I'll have more questions for

Post tutorial help needed - generic.create_update.create_object

2008-12-21 Thread schwim
OK, I'm a total newbie. I ran through the tutorial on the django site, and decided to extend the poll system a bit just to learn more. I figured quite a bit out, but on this one I'm stuck. I want to provide a page at polls/new to add a new poll. I'm trying to use the

Django on Lighttpd: HTTP requests with captures in them return pages without static content.

2008-12-21 Thread jmags
Hi, I've been building a Django site using Lighttpd as a server for a local sandbox. URLs that do not capture data to send to the view, e.g.: (r'^index$', 'Gallerie500.viewer.views.index'), are working fine. However, galleries that are sending data in the request, e.g.: (r'^display/(\d)$',

Re: Installing django admin on apache/ mod_python

2008-12-21 Thread paultanner
No more input on this for a while so I tried various moving the directories around. My supposition is that it can't find the part of the distribution containing the admin code. vhost.conf (on a subdomain) --- SetHandler python-program PythonHandler django.core.handlers.modpython

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Jeff Anderson
Chris wrote: > it says it can't find django-admin.py I didn't see that for my most recent reply. Your problem is that django-admin.py isn't on your PATH. Either put it in your PATH or run it with a full path: /path/to/django-admin.py If you're unfamiliar with this terminology, you need to read up

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Jeff Anderson
Chris wrote: > No directory created in my cd, but I see you're working remotely, no? > I'm trying to get it running on my Mac first before running it on a > server or remote machine. Am I wrong? What I'd really appreciate is > someone telling me EXACTLY what I need to do – every single aspect of >

Re: custom templatetags and problem with importing photologue.models - namespace collision?

2008-12-21 Thread Bartek
Bartek pisze: > Hi all > When I loop over sys.modules in templatetags/pobierz.py there's > django.templatetags.photologue, so probably that's why "from > photologue.models import Gallery" throws ImportException - there's not > models in django.templatetags.photologue > > Anyway in sys.modules

Re: "Building you first Django app, Part 1" example not working

2008-12-21 Thread Chris
No directory created in my cd, but I see you're working remotely, no? I'm trying to get it running on my Mac first before running it on a server or remote machine. Am I wrong? What I'd really appreciate is someone telling me EXACTLY what I need to do – every single aspect of installation,