Re: Some questions to the Django auth system

2008-11-06 Thread Håkan Waara
6 nov 2008 kl. 05.40 skrev erdmaennchen: > > I'm doing some testruns on Django to find out how it fits me. Until > now: Just great. But - as always - there are some problems you > encounter when you are inexperienced with a specific framework. I've > some Problems at the moment with the built-in

Re: help regarding generic views

2008-11-06 Thread Håkan Waara
6 nov 2008 kl. 06.12 skrev Low Kian Seong: > > Dear all, > > Here is the excerpt of my urls.py > > (r'^stocks_edit/(?P\d+)/?$', create_update.update_object, > dict(stock_information, >post_save_redirect="/")), > I don't know about your specific problem, but I can see at least one

Re: Model ForeignKeys to other Models

2008-11-06 Thread Håkan Waara
6 nov 2008 kl. 08.42 skrev joshuajenkins: > > I'm sure I'm doing this wrong but can't really find an answer in the > docs or by searching. > > I have two models (relative to this problem). One is called events, > one is called projects > > a portion of models.py for projects looks like this: > >

Re: Model ForeignKeys to other Models

2008-11-06 Thread joshuajenkins
Thanks for the reply. I'm not new to Python so much as I'm overwhelmed fairly often by all the jargon, but I'm wading my way through it. Thanks for the link. I added the import as you suggested to my model and for some reason I'm still getting the error. I'll post my model in it's entirety, which

i18n strategy

2008-11-06 Thread Brandon Taylor
Hi everyone, I'm tasked with translating a mostly database-driven site into Spanish. I'm familiar with how to use Django's internationalization on static strings in templates, but not with text coming from a database, so I'm looking for some best practices advice... Should I: 1. Make a separate

Re: Upload Progress Bar

2008-11-06 Thread Alex Koshelev
And what error message do you receive? On Thu, Nov 6, 2008 at 09:46, Pawel Pilitowski <[EMAIL PROTECTED]>wrote: > > Hi all, > > I'm in the process of trying to write an Upload Progress Bar for my app. > > I'm using the latest trunk version of Django, mod_python 3.3.1, > Memcached, Apache 2.2.8 p

Re: i18n strategy

2008-11-06 Thread Alex Koshelev
The is an existing db internalization application - http://code.google.com/p/django-multilingual/. Try to look at it. On Thu, Nov 6, 2008 at 11:20, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi everyone, > > I'm tasked with translating a mostly database-driven site into > Spanish. I'm familiar

Re: Best practice

2008-11-06 Thread Alex Koshelev
> Profile.objects.create(name=name, foo=foo) How do you get this `name` and `foo` variables in `save` method? On Thu, Nov 6, 2008 at 08:20, meppum <[EMAIL PROTECTED]> wrote: > > I've run into a funny case and I'm not sure how to best deal with it. > Basically, I have the following classes. > >

Re: Upload Progress Bar

2008-11-06 Thread Pawel Pilitowski
No error message per se, just the value 'null', suggesting that no value is being written to the cache during the upload. When I periodically poll the upload progress, with an interval-timed GET request, the value returned is 'null' — the value being returned by o.requestText on the GET requ

Re: Model ForeignKeys to other Models

2008-11-06 Thread Daniel Roseman
On Nov 6, 8:20 am, joshuajenkins <[EMAIL PROTECTED]> wrote: > Thanks for the reply. I'm not new to Python so much as I'm overwhelmed > fairly often by all the jargon, but I'm wading my way through it. > Thanks for the link. > > I added the import as you suggested to my model and for some reason >

Re: Is it possible to output JSON like this?

2008-11-06 Thread Darthmahon
Hey Alex, I tried this hard coded JSON the other day: results = [] results.append( { 'date' : '2008-11-04 00:00:00', 'dayEvents' : [ { 'title' : 'Event 1', 'location' : '1', 'id' : '1' }, { 'title' : 'Event 2', 'location' : '1', 'id' : '2' } ] } ) But I got an error when I did this (can't remem

Re: Is it possible to output JSON like this?

2008-11-06 Thread Alex Koshelev
It's strange. I've just try this example and it is good: In [1]: results = [] In [2]: results.append( { 'date' : '2008-11-04 00:00:00', 'dayEvents' : ...: [ { 'title' : 'Event 1', 'location' : '1', 'id' : '1' }, { 'title' : ...: 'Event 2', 'location' : '1', 'id' : '2' } ] } )

model inheritance - getting data from child objects

2008-11-06 Thread Alistair Marshall
Using the example in the django writing models documentation [1] I wish to get a list of all the places, then calculate a value that depends on what the type of place it is. Say in my restraunt I have a function get_workforce() which returns a list of all the people that work in the restaraunt. T

Re: Model ForeignKeys to other Models

2008-11-06 Thread Håkan Waara
6 nov 2008 kl. 10.05 skrev Daniel Roseman: > The problem is not with the imports (you were fine with the original > method - in fact I'd recommend it, to avoid any future problems with > circular imports), but with the __unicode__ methods. As the error > states, you're referring to the related ob

Mysqldb adapter

2008-11-06 Thread achab61
Hi all, I'm in trouble trying to get running the Mysqldb adapter on Windows. My configuration is MySQL vers. 5.0.67, PythonWin vers. 2.5.2 I downloaded the .exe file from http://www.djangoproject.com/r/python-mysql/ and I installed it. But when I type import Mysqldb I still get : ImportError:

Django Using Multiple Databases in a Web Application

2008-11-06 Thread [EMAIL PROTECTED]
Hi, Django Users, Started on Django and enjoying this framework immensley, Using the DjangoProject Documentation and the book The Definitive Guide to Django Web Development Done Right, I am starting a project but I want to use more that one sqlite database. From the Docs\Book it appears that you

Getting a relationship using double underscores

2008-11-06 Thread gv
Hello What I want to achieve is the equivalent of this: select * from server, backup where backup.serverid=server.id and servername={backupserver} To do that the django way is proving challenging, maybe because the database was an existing one (not created the django way), or maybe because I'm

Re: Mysqldb adapter

2008-11-06 Thread gv
On 6 Nov, 10:39, achab61 <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm in trouble trying to get running the Mysqldb adapter on Windows. > > My configuration is MySQL vers. 5.0.67, PythonWin vers. 2.5.2 I use much the same as you, but got mysql-python from Sourceforge - no problems: http://sourcefo

Re: Model ForeignKeys to other Models

2008-11-06 Thread Daniel Roseman
On Nov 6, 10:27 am, Håkan Waara <[EMAIL PROTECTED]> wrote: > 6 nov 2008 kl. 10.05 skrev Daniel Roseman: > > > The problem is not with the imports (you were fine with the original > > method - in fact I'd recommend it, to avoid any future problems with > > circular imports), but with the __unicode_

Re: Getting a relationship using double underscores

2008-11-06 Thread Daniel Roseman
On Nov 6, 10:25 am, gv <[EMAIL PROTECTED]> wrote: > Hello > > What I want to achieve is the equivalent of this: > select * from server, backup where backup.serverid=server.id and > servername={backupserver} > > To do that the django way is proving challenging, maybe because the > database was an e

Re: Help regarding Decimal Field in models.py in Django

2008-11-06 Thread Daniel Roseman
On Nov 6, 10:32 am, "sadeesh Arumugam" <[EMAIL PROTECTED]> wrote: > Hi Friends, >     I'm a newbie to Django, i'm doing a registration form to be displayed in > Admin section. In my form i'm giving two fields namely latitude and > longitude and setting them as a DecimalField. My question how to se

Re: Getting a relationship using double underscores

2008-11-06 Thread gv
On 6 Nov, 11:56, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Nov 6, 10:25 am, gv <[EMAIL PROTECTED]> wrote: > > Well, you don't appear to have any foreign keys linking Backup and > Server. You'd need something like this in your Backup declaration: > >     server = models.ForeignKey('Server')

Re: Getting a relationship using double underscores

2008-11-06 Thread Alex Koshelev
If you have `serverid` field in database so you can add reference with custom column name [1]. For example: server = models.ForeignKey(Server, db-column="serverid") [1]: http://docs.djangoproject.com/en/dev/ref/models/fields/#db-column On Thu, Nov 6, 2008 at 15:10, gv <[EMAIL PROTECTED]> wrote:

Re: Mysqldb adapter

2008-11-06 Thread gv
On 6 Nov, 12:30, achab61 <[EMAIL PROTECTED]> wrote: > I've got the same package but I'm getting the same error. > Is there anything do once you run the exe ? Did you make any special > configuration in your Windows (I'm on XP SP2) i.e. PATH etc... I cannot remember doing anything extra. My under

Re: multi foreign keys and ordering in admin

2008-11-06 Thread Alex Koshelev
Try to set meta [1] `ordering` setting [1]: http://docs.djangoproject.com/en/dev/ref/models/options/ On Thu, Nov 6, 2008 at 14:51, MikeKJ <[EMAIL PROTECTED]> wrote: > > Got something like this > > class A(models.Model): >x >class Admin: >x > > class B(models.Model): >

syncdb problem with standalone applications

2008-11-06 Thread cnole
Hi everybody, i'm new to django framework and i found a problem during learning django. I wrote a standalone application for my project and registered it as installed applications in the project settings. But everytime i made a change to models of the standalone application and run the syncdb com

Re: Help regarding renaming the uploaded file name in Django.

2008-11-06 Thread Alex Koshelev
Django uploading mechanism allow you to add date-bases values to path. See `upload_to` section in [1] [1]: http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield On Thu, Nov 6, 2008 at 15:45, sadeesh Arumugam <[EMAIL PROTECTED]>wrote: > Hi Friends, > > I need a help from you. How to

Help regarding Decimal Field in models.py in Django

2008-11-06 Thread sadeesh Arumugam
Hi Friends, I'm a newbie to Django, i'm doing a registration form to be displayed in Admin section. In my form i'm giving two fields namely latitude and longitude and setting them as a DecimalField. My question how to set the Decimal field into an Optional field (its not a Mandatory field) like

Re: setting value of a ModelForm field through Javascript

2008-11-06 Thread bruno desthuilliers
On 6 nov, 13:38, limas <[EMAIL PROTECTED]> wrote: > hello > > please help me... > can i set the value of a ModelForm field ,ie a text box, using > javascript. This is totally unrelated to Django and ModelForms. javascript runs on the browser, *after* the whole page containing the form has be

Re: Getting a relationship using double underscores

2008-11-06 Thread Daniel Roseman
On Nov 6, 12:10 pm, gv <[EMAIL PROTECTED]> wrote: > On 6 Nov, 11:56, Daniel Roseman <[EMAIL PROTECTED]> wrote: > > > On Nov 6, 10:25 am, gv <[EMAIL PROTECTED]> wrote: > > > Well, you don't appear to have any foreign keys linking Backup and > > Server. You'd need something like this in your Backup

Re: syncdb problem with standalone applications

2008-11-06 Thread Ramiro Morales
On Thu, Nov 6, 2008 at 10:26 AM, cnole <[EMAIL PROTECTED]> wrote: > > Hi everybody, > > i'm new to django framework and i found a problem during learning > django. I wrote a standalone application for my project and registered > it as installed applications in the project settings. But everytime i

syncdb problem with standalone applications

2008-11-06 Thread cnole
Hi everybody, i'm new to django framework and i found a problem during learning django. I wrote a standalone application for my project and registered it as installed applications in the project settings. But everytime i made a change to models of the standalone application and run the syncdb com

Help regarding renaming the uploaded file name in Django.

2008-11-06 Thread sadeesh Arumugam
Hi Friends, I need a help from you. How to rename the uploaded file name in django. Example if we upload a file named "a.jpg" at first time, and at next upload it is uploaded as "a_.jpg", and at the third time "a__.jpg", likewise the Underscore after the filename is increasing one time for each u

Re: setting value of a ModelForm field through Javascript

2008-11-06 Thread Donn
On Thursday, 06 November 2008 14:38:41 limas wrote: > can i set the value of a ModelForm field ,ie a text box, using > javascript. Try JQuery. If your input box has an id "blah" then: $('#blah').val("some new value") would set it for you. jQuery is very cool for this kind of thing. hth, \d --~

Re: Help regarding Sqlite3

2008-11-06 Thread sergioh
Also you can use the python shell, you can import your models and create objects, the you can save them and also make queries to your model. is simple as: # manage.py shell >>> from django.contrib.auth.models import User >>>User.objects.all() .. Also the structure of the tables created

post data and @login_required

2008-11-06 Thread coan
I tried to use the @login_required decorator on a view that takes post data. Why isn't there an option to have the request object passed to the login form? Then it would be possible to have the loginform pass the post data to the view that depends on it. Does anyone have any clever workarounds f

Re: multi foreign keys and ordering in admin

2008-11-06 Thread MikeKJ
Rephrased a little On Nov 6, 11:51 am, MikeKJ <[EMAIL PROTECTED]> wrote: > Got something like this > > class A(models.Model): >     x >     class Admin: >         x > > class B(models.Model): >     a =models.ForeignKey(A, edit_inline=models.TABULAR) >     xxx > > class C(models.Model)

Re: post data and @login_required

2008-11-06 Thread James Bennett
On Thu, Nov 6, 2008 at 5:12 AM, coan <[EMAIL PROTECTED]> wrote: > Why isn't there an option to have the request object passed to the > login form? The login view in the Django admin actually used to do this; see our most recent security-oriented release for the reasons why it doesn't do that anym

Re: Installation of django in user account

2008-11-06 Thread [EMAIL PROTECTED]
No one? On Nov 5, 6:18 pm, "Tim O'Toole" <[EMAIL PROTECTED]> wrote: > Hi all, > > I was wondering how feasile it is it to install Django in a user > account without root access. I followed the instruction at: > > http://docs.djangoproject.com/en/dev/topics/install/#installing-devel... > > But I o

Re: Getting a relationship using double underscores

2008-11-06 Thread gv
On 6 Nov, 12:33, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > If you have `serverid` field in database so you can add reference with > custom column name [1]. For example: > > server = models.ForeignKey(Server, db-column="serverid") > > [1]:http://docs.djangoproject.com/en/dev/ref/models/fields/#d

Re: model inheritance - getting data from child objects

2008-11-06 Thread Thomas Guettler
I have never used model inheritance, but I read the documentation If all worker classes (cook, waiter, ...) are subclassed from Worker, something like this should work: Worker.objects.filter(workplace=...) (Given that workers only work for one workplace) HTH, Thomas Alistair Marshall sch

Re: Is it possible to output JSON like this?

2008-11-06 Thread Dj Gilcrease
If you dont mind using the template system I think this should produce the results you are looking for [{% for event in events %} {% ifchanged event.date %}{ 'date' : '{{ event.date }}', 'dayEvents' : [{% endif %} { 'title' : '{{ event.title }}', 'location' : '{{ event.location

Re: Mysqldb adapter

2008-11-06 Thread achab61
Thanks, it works now! I found out the installation location of MySQLdb was wrong (my mistake...) On Nov 6, 1:55 pm, gv <[EMAIL PROTECTED]> wrote: > On 6 Nov, 12:30, achab61 <[EMAIL PROTECTED]> wrote: > > > I've got the same package but I'm getting the same error. > > Is there anything do once you

Re: Installation of django in user account

2008-11-06 Thread James Bennett
On Wed, Nov 5, 2008 at 12:18 PM, Tim O'Toole <[EMAIL PROTECTED]> wrote: > But I obviously cant do the following without root access > > ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django > > Whilst I can set the PYTHONPATH, I can't then write to PythonPath in > the Apache configuration file

Re: Mysqldb adapter

2008-11-06 Thread achab61
I've got the same package but I'm getting the same error. Is there anything do once you run the exe ? Did you make any special configuration in your Windows (I'm on XP SP2) i.e. PATH etc... Thanks On 6 Nov, 12:15, gv <[EMAIL PROTECTED]> wrote: > On 6 Nov, 10:39, achab61 <[EMAIL PROTECTED]> wrote:

multi foreign keys and ordering in admin

2008-11-06 Thread MikeKJ
Got something like this class A(models.Model): x class Admin: x class B(models.Model): a =models.ForeignKey(A) xxx class C(models.Model): a = models.ForeignKey(A) x classD(models.Model): a=models.ForeignKey(A) xx how do I control th

Re: Best practice

2008-11-06 Thread TiNo
> > class Profile(models.Model): >name = models.CharField() >foo = models.PositiveIntegerField(blank=True, default=0) > > class RegistrationForm(forms.Form): >name = forms.CharField() >foo = forms.IntegerField(min_value=0, max_value=55, > required=False) > > a) If your form is the

setting value of a ModelForm field through Javascript

2008-11-06 Thread limas
hello please help me... can i set the value of a ModelForm field ,ie a text box, using javascript. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

Re: Using Django

2008-11-06 Thread Blu3ness
Hey there, I am running Django testing server on Dreamhost as well, and I can tell you it works fine. So I am sure you are probably just misconfiguring something. Like AndyB said, .htaccess needs to pass the URL to your dispatch.fcgi on the dreamhost server, all of your django projects and folde

sql error (1054, "Unknown column 'scripts_script.id' in 'on clause'")

2008-11-06 Thread sergo
I'm using django-tagging and django-multilingual applications in my project. I don't know if the problem is in these packages or it is more general. Google gives this http://bugs.mysql.com/bug.php?id=16190 , so I thought it is more general problem. Error page says: Environment: Request Method:

Re: Installation of django in user account

2008-11-06 Thread Daniel Hepper
> On Wed, Nov 5, 2008 at 12:18 PM, Tim O'Toole <[EMAIL PROTECTED]> wrote: > > But I obviously cant do the following without root access > > > > ln -s `pwd`/django-trunk/django SITE-PACKAGES-DIR/django > > > > Whilst I can set the PYTHONPATH, I can't then write to PythonPath in > > the Apache conf

Having trouble with django-multilingual

2008-11-06 Thread Brandon Taylor
Hi Everyone, I'm having a hard time getting django-multilingual to work the way I expect. #settings.py LANGUAGES = ( ('en', 'English'), ('es', 'Spanish'), ) TEMPLATE_CONTEXT_PROCESSORS = ( ... 'multilingual.context_processors.multilingual', ) MIDDLEWARE_CLASSES = ( ..

Apache Segmentation Fault on succesful authentication

2008-11-06 Thread huw_at1
Hi all. I am having some real problems with this. I have an LDAP authentication backend that I have hooked up to my app. Standalone it appears to run fine. However when running it through my apache server I am seeing alot of segmentation faults in my error log coupled with the redirection page not

Confused about unittests and fixtures

2008-11-06 Thread AndyH
Hello, I have the following simple test which demonstrates the confusing behaviour I'm seeing: class AvailabilityTestCase(django.test.TestCase): fixtures = FIXTURE_LIST def setUp(self): response = self.client.login(username='testuser', password='password') self.assertTrue

Re: model inheritance - getting data from child objects

2008-11-06 Thread Alistair Marshall
On Nov 6, 2:22 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > If all worker classes (cook, waiter, ...) are subclassed from Worker, > something like this should work: Worker.objects.filter(workplace=...) > Unfortunately the function that each child will run is a bit more complicated than just l

Re: Having trouble with django-multilingual

2008-11-06 Thread Alex Koshelev
Django-multilingual has its own discussion group: http://groups.google.com/group/django-multilingual. Try to ask there. On Thu, Nov 6, 2008 at 18:44, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi Everyone, > > I'm having a hard time getting django-multilingual to work the way I > expect. > >

Re: sql error (1054, "Unknown column 'scripts_script.id' in 'on clause'")

2008-11-06 Thread sergo
I've tried to JOIN instead of ", " in sql query and it works but only in sql frontend. I don't know where to fix this statement in Django. On Nov 6, 5:52 pm, sergo <[EMAIL PROTECTED]> wrote: > I'm using django-tagging and django-multilingual applications in my > project. I don't know if the prob

Re: Oracle Clob Field type

2008-11-06 Thread Ian
On Nov 5, 3:54 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Noob here... > > I have an existing table with two Clob fields.  While defining the > model I use TextField as the filed type. > > running gives me back the error: > > cx_Oracle.DatabaseError: ORA-01754: a table may contain only

don't escape html tags

2008-11-06 Thread gontran
hello, I just started to learn django, so my question may be stupid: In my template, I would like to display a html string (stored in my database). My problem is that it displays the string but it automatically escapes the html tags. for example, if my string is: my text instade of showing: my

Logout- Back Button

2008-11-06 Thread jai_python
Hi, i have created a project named as Asset and application named as Management. The problem i am facing is after i logout form the project, if i hit the back button it fails to show the login window. I knew that some browsers don't actually hit the server on a "back". So can u tel me how to impl

Re: Newbie question: HTML formatting not applied to pages

2008-11-06 Thread Jeff Beckham
Sure. Here's /blog/models.py http://dpaste.com/89108/ /blog/urls.py http://dpaste.com/89109/ I've got nothing in /blog/views.py right now. As far as templates, this is /templates/base.html (it's got the autoescape tags included) http://dpaste.com/89112/ /templates/blog/list.html has only one

Re: don't escape html tags

2008-11-06 Thread Håkan Waara
The documentation for the template system will give you the answer: http://docs.djangoproject.com/en/dev/topics/templates/ /Håkan 6 nov 2008 kl. 17.16 skrev gontran: > > hello, > > I just started to learn django, so my question may be stupid: > > In my template, I would like to display a html

Re: don't escape html tags

2008-11-06 Thread Ramiro Morales
On Thu, Nov 6, 2008 at 2:16 PM, gontran <[EMAIL PROTECTED]> wrote: > > hello, > > I just started to learn django, so my question may be stupid: > > In my template, I would like to display a html string (stored in my > database). My problem is that it displays the string but it > automatically esca

including javascript in templates

2008-11-06 Thread David Sáez
Hi, I'm a newbie to django and I'm dealing with some configuration stuff that is making me going crazy. My problem is very simple and I have a temporal solution, but I guess there might be a better way to do it. So... there goes the question... ¿ How do I include javascript in a basic template ?

Re: Template inheritance

2008-11-06 Thread Alaric Haag
Belated thanks for that; the "specialization" tip helps. It feels a little like I haven't flopped over to the correct way of thinking about it. Custom tags and inclusion tags are helping me sort it out a bit though. --~--~-~--~~~---~--~~ You received this messa

Re: including javascript in templates

2008-11-06 Thread Håkan Waara
6 nov 2008 kl. 17.35 skrev David Sáez: > > Hi, I'm a newbie to django and I'm dealing with some configuration > stuff that is making me going crazy. My problem is very simple and I > have a temporal solution, but I guess there might be a better way to > do it. So... there goes the question... > >

Re: date formats in settings.py

2008-11-06 Thread Karen Tracey
On Thu, Nov 6, 2008 at 11:30 AM, Benedict Verheyen < [EMAIL PROTECTED]> wrote: > > Hi, > > i have a question on the different date/time settings one can specify in > the settings.py. > I currently have these: > TIME_ZONE = 'Europe/Brussels' > DATE_FORMAT = 'd/m/Y' > DATETIME_FORMAT = 'd/m/Y H:i'

Re: don't escape html tags

2008-11-06 Thread gontran
Sorry but I was working with an old documentation! I fixed it with th e filter 'safe' thank you for the quick answer On 6 nov, 17:48, "Ramiro Morales" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 6, 2008 at 2:16 PM, gontran <[EMAIL PROTECTED]> wrote: > > > hello, > > > I just started to learn django

Re: including javascript in templates

2008-11-06 Thread David Sáez
Hi Håkan, yes, I missed the reading of that link. Now that I have set up correctly it works fine. But it has a BIG disclaimer, and the reccommendation is to let the webserver to serve these files (that is what I really want) http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#servin

date formats in settings.py

2008-11-06 Thread Benedict Verheyen
Hi, i have a question on the different date/time settings one can specify in the settings.py. I currently have these: TIME_ZONE = 'Europe/Brussels' DATE_FORMAT = 'd/m/Y' DATETIME_FORMAT = 'd/m/Y H:i' TIME_FORMAT = 'H:i' YEAR_MONTH_FORMAT = 'm Y' MONTH_DAY_FORMAT = 'd m' However, any date i ente

Filtering the modelform in Admin on request.user

2008-11-06 Thread shabda
I have an Admin site which I want to filter based on request.user. My ModelAdmin class is something like this, class FilterOnUser(admin.ModelAdmin): def queryset(self, request): return self.model._default_manager.filter(user = request.user) def get_form(self, request, obj=None,

Re: Logout- Back Button

2008-11-06 Thread jai_python
Please help me out --~--~-~--~~~---~--~~ 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

Re: Using Django

2008-11-06 Thread [EMAIL PROTECTED]
I used the Gordon Tillman setup: http://www.gordontillman.info/Development/DjangoDreamhost here are the dispatch.fcgi and .htaccess files: // dispatch.fcgi #!/usr/bin/env python2.4 import sys, os # Add a custom Python path. sys.path.insert(0, "/home/USERNAME/projects/django/trunk") sys.path.in

Re: date formats in settings.py

2008-11-06 Thread Benedict Verheyen
Karen Tracey wrote: > On Thu, Nov 6, 2008 at 11:30 AM, Benedict Verheyen > <[EMAIL PROTECTED] > wrote: > > > Hi, > > i have a question on the different date/time settings one can specify in > the settings.py. > I currently have these: > TIME_ZONE =

Re: Newbie question: HTML formatting not applied to pages

2008-11-06 Thread Peter Rowell
You're being tripped up by auto-escaping of variable contents. This is a security feature that was first introduced in November of last year. (http://code.djangoproject.com/changeset/6671) See http://docs.djangoproject.com/en/dev/ref/templates/builtins/#autoescape --~--~-~--~~

Re: Design question : best way to show 1 .. N different categoried items

2008-11-06 Thread John M
Bruno, Thanks for pointing me in the right direction, the only thing I needed to as was an order_by("category") to make sure all the bullet points were grouped by category. Again, thank you so much for getting me past this. John On Nov 5, 1:02 am, bruno desthuilliers <[EMAIL PROTECTED]> wrote:

Re: including javascript in templates

2008-11-06 Thread Steve Holden
You don't need to serve them from Apache for development - then it's OK to use Django. It's only in production you want to use some other server for media and static content. I have this at the end of my settings.py just to keep my test sites looking reasonable: # Serve static content so test si

Re: Logout- Back Button

2008-11-06 Thread Alex Koshelev
The is no way to do "redirect to login page, if i hit back button after logout". But what is wrong that user can see non-actual old data? I think it has no matter. On Nov 6, 8:27 pm, jai_python <[EMAIL PROTECTED]> wrote: > Please help me out --~--~-~--~~~--

Re: Logout- Back Button

2008-11-06 Thread Scott Moonen
Hi, This is why many secure web application (e.g., your bank or credit card company) ask that you close your browser after you logout -- so that no one else can get to any of your data that may be stored in the browser cache. If your users are using your application from https:, then this is all

Re: Model ForeignKeys to other Models

2008-11-06 Thread joshuajenkins
That cleared it up, thanks! Great information which will definitely help me in the future. On Nov 6, 3:52 am, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Nov 6, 10:27 am, Håkan Waara <[EMAIL PROTECTED]> wrote: > > > 6 nov 2008 kl. 10.05 skrev Daniel Roseman: > > > > The problem is not with the

Re: Newb help request about fields and and subfields

2008-11-06 Thread mondonauta
thank you so much the code u linked me help me a lot... i still used multivaluefield and multiwidget, i overrided the render method as u suggested an then i modified it copying a bit from the render method i found in the code u linked me :-) and well at list till i find any bug, it's working t

Sort querysets by their data attribute values

2008-11-06 Thread dexter
I have a queryset which I have looped thru and added a (temporary) data attribute to each instance. Now I would like to order the queryset by the value of the data attributes. If I do it like this: sorted(queryset, key=lambda x: x.data_attr) the queryset turns into a list and I can't use it like

Re: Sort querysets by their data attribute values

2008-11-06 Thread Alex Koshelev
There is no other way to do this in python/django layer. But you can try to add your temp data in database layer and sort where. On Thu, Nov 6, 2008 at 22:58, dexter <[EMAIL PROTECTED]> wrote: > > I have a queryset which I have looped thru and added a (temporary) > data attribute to each instanc

Re: Filtering the modelform in Admin on request.user

2008-11-06 Thread Rajesh Dhawan
Hi, > I have an Admin site which I want to filter based on request.user. > > My ModelAdmin class is something like this, > > class FilterOnUser(admin.ModelAdmin): > def queryset(self, request): > return self.model._default_manager.filter(user = request.user) > > def get_form(self,

Re: Apache Segmentation Fault on succesful authentication

2008-11-06 Thread huw_at1
I tried running a strace on apache for this but I am still no wiser? Anyone? On Nov 6, 3:38 pm, huw_at1 <[EMAIL PROTECTED]> wrote: > Hi all. I am having some real problems with this. I have an LDAP > authentication backend that I have hooked up to my app. Standalone it > appears to run fine. Howe

Re: Using Django

2008-11-06 Thread [EMAIL PROTECTED]
I think I had the .htaccess and dispatch.fcgi files in the wrong place. I had them in the django generated mysite directory rather the than the domain, but now when I go to mysite.com I get the 500 internal server error. This happened when I tried the Jeff Croft setup: http://jeffcroft.com/blog/2

Re: Best practice

2008-11-06 Thread Rajesh Dhawan
meppum wrote: > I've run into a funny case and I'm not sure how to best deal with it. > Basically, I have the following classes. > > class Profile(models.Model): > name = models.CharField() > foo = models.PositiveIntegerField(blank=True, default=0) > > class RegistrationForm(forms.Form): >

Re: how to get the id in an admin template

2008-11-06 Thread webcomm
I don't understand the documentation. I am able to get the "view on site" link to show, but the URL is wrong. The correct URL for the instance is... http://www.mysite.com/billing/321 ...so I tried this... def get_absolute_url(self): return "/billing/%i" % self.id ...but when I cl

Re: how to get the id in an admin template

2008-11-06 Thread Steve Holden
It's in the only row in your sites table. regards Steve webcomm wrote: > I don't understand the documentation. I am able to get the "view on > site" link to show, but the URL is wrong. The correct URL for the > instance is... > > http://www.mysite.com/billing/321 > > ...so I tried this... > >

Re: how to get the id in an admin template

2008-11-06 Thread Alex Koshelev
`example.com` is default Site added by the project setup into sites contrib application [1] [1]: http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites On Fri, Nov 7, 2008 at 00:12, webcomm <[EMAIL PROTECTED]> wrote: > > I don't understand the documentation. I am able to get

Re: model inheritance - getting data from child objects

2008-11-06 Thread Pawel Pilitowski
On 07/11/2008, at 3:01 AM, Alistair Marshall wrote: On Nov 6, 2:22 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > If all worker classes (cook, waiter, ...) are subclassed from Worker, > something like this should work: Worker.objects.filter(workplace=...) > Unfortunately the function that ea

Re: Sort querysets by their data attribute values

2008-11-06 Thread John M
I had a similar need based on a calculated column, you'll have to turn it into a list (i.e. mylist = list(queryset) ) and then sort from there. You can still pass the list to a template a loop through it just like a regular queryset, since the objects in the list are just python objects. J On N

Re: Apache Segmentation Fault on succesful authentication

2008-11-06 Thread Graham Dumpleton
On Nov 7, 2:38 am, huw_at1 <[EMAIL PROTECTED]> wrote: > Hi all. I am having some real problems with this. I have an LDAP > authentication backend that I have hooked up to my app. Standalone it > appears to run fine. However when running it through my apache server > I am seeing alot of segmentat

Getting non-related records

2008-11-06 Thread John M
i have a model at http://dpaste.com/88760/ for a particular Report (r), I'd like to get all categories that aren't in it's bulletpoints. For example, If there are four categories: one, two, three, four. there is a report with bullet points for one and two, how can I get a list of three and four.

Re: Getting non-related records

2008-11-06 Thread Alex Koshelev
Hi, John Try this: Category.objects.exclude(bulletpoint__report=r) On Fri, Nov 7, 2008 at 01:54, John M <[EMAIL PROTECTED]> wrote: > > i have a model at http://dpaste.com/88760/ > > for a particular Report (r), I'd like to get all categories that > aren't in it's bulletpoints. > > For example,

Re: Confused about unittests and fixtures

2008-11-06 Thread Russell Keith-Magee
On Fri, Nov 7, 2008 at 1:00 AM, AndyH <[EMAIL PROTECTED]> wrote: > > Hello, > > I have the following simple test which demonstrates the confusing > behaviour I'm seeing: > > class AvailabilityTestCase(django.test.TestCase): >fixtures = FIXTURE_LIST >def setUp(self): >response = sel

Re: Confused about unittests and fixtures

2008-11-06 Thread Alex Koshelev
GenericForeignKey and content type application itself look very doubtful for me. If you have a ForeignKey to the ContentType model then you depends on order with ContentType objects creates on syncdb. Because ContentType that references to some model can have different primary key any time you flus

Re: Confused about unittests and fixtures

2008-11-06 Thread Russell Keith-Magee
On Fri, Nov 7, 2008 at 8:17 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > GenericForeignKey and content type application itself look very doubtful for > me. If you have a ForeignKey to the ContentType model then you depends on > order with ContentType objects creates on syncdb. Because ContentTyp

Re: Getting non-related records

2008-11-06 Thread John M
WOW, I knew it would be easy, but that is ridiculous. Thanks Alex! John On Nov 6, 3:00 pm, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > Hi, John > > Try this: > > Category.objects.exclude(bulletpoint__report=r) > > On Fri, Nov 7, 2008 at 01:54, John M <[EMAIL PROTECTED]> wrote: > > > i have a m

App initialized twice? plus, debugging tips.

2008-11-06 Thread project2501
Hi, I'm new to django and have a couple questions. I have a __init__.py in my app and try to declare a simple module wide variable. I noticed __init__.py is called twice when I run "python manage.py runserver". Is this normal? Also, I tried to run "manage.py runserver" through my Wing IDE in d

  1   2   >