Re: Foreign key being set to null when not null in form

2008-02-04 Thread [EMAIL PROTECTED]
On Feb 4, 11:56 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Feb 4, 8:13 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > > On Feb 4, 2008 6:43 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > as you can see, I hide the primary and foreign key fields (yes, I am > > > aware of

Questions related to testing Django application using Sqlite

2008-02-04 Thread Manoj Govindan
Recently I tried using Sqlite instead of Postgres as the database engine for testing one of my django applications. My observations follow: 1) Tests ran significantly faster[1]. 2) Some tests failed in Windows while some of them failed in both Windows and Linux. All tests succeeded in both

Alternate URL styles for RSS feeds?

2008-02-04 Thread Dave Dash
I have a legacy app with feeds: /restaurant/{slug}/feed so I defined in my urls.py: feeds = { 'restaurant': MenuItems, } urlpatterns = patterns('', # restaurant feed ( r'^(?Prestaurant)/(.*)/feed', 'django.contrib.syndication.views.feed', {'feed_dict':

Views based permission question.

2008-02-04 Thread tar
Hi all, I'm about to restrict the user(user belong to groups(django.contrib.auth.models.Group) which we created for that user.) to seeing only some pages in my django webapp. I know that django supports only model based permission. But not for views based. The solution I can think now is,

Re: Object Documentation?

2008-02-04 Thread Karen Tracey
On Feb 4, 2008 8:05 PM, SeanFromIT <[EMAIL PROTECTED]> wrote: > > Does anyone know where the documentation is for "django sql"? For > example, in the tutorial: > > def index(request): >latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] > > Where's the documentation for all of the

Re: Markup Filters (restructuredtext)

2008-02-04 Thread Craig Ogg
On Feb 4, 2008 4:41 PM, Christian W. Koch <[EMAIL PROTECTED]> wrote: > I've been looking for this like crazy, I started using the markup > filters with great succes (love at first sight) but there's a little > problem. I use special carachters, like and things like that > to support different

simple django notifications app questions

2008-02-04 Thread Prairie Dogg
I'm writing a very simple django app for use on a learning project that I would love to get some informed commentary on. The app basically helps users mark content objects that they would like to watch, and sends out email updates to users whenever objects related to the "watched objects" have

Re: Help filter with Admin

2008-02-04 Thread sanrioyt
Thanks a lot. I'll try it. sanrio On Feb 4, 1:18 am, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote: > On Feb 3, 7:56 pm, [EMAIL PROTECTED] wrote: > > > Is there a way to select both 'A' and 'B' under affiliation and get > > both Tom and Diane? > > You can use non-standard filters in the Admin

Re: django.contrib.auth login method incorrectly documented?

2008-02-04 Thread Mojave
Thanks for your help. I'm importing from django.contrib.auth, not from .views from django.contrib.auth import authenticate, login I'll have to dig a little more. On Feb 4, 2:12 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Feb 4, 2008 2:50 PM, Mojave <[EMAIL PROTECTED]> wrote: > > >

Re: templatetags and import path

2008-02-04 Thread Julien
Hi Brian, I'm facing a similar issue, which is being discussed here: http://groups.google.com/group/django-users/browse_thread/thread/0ce299d4922461f0/3cf7427097e67153#3cf7427097e67153 I am as surprised as you are by this behaviour... On Feb 5, 11:52 am, Brian Luft <[EMAIL PROTECTED]> wrote: >

Re: Template tags and python paths

2008-02-04 Thread Jon Wilson
Julien wrote: > Yes indeed, I have a problem when distributing my project. I develop > it locally, then commit the changes to an SVN repository. The > production site is a check-out of that repository. > > The problem is that the dev and production project roots have > different names (one is

Re: Template tags and python paths

2008-02-04 Thread Julien
Yes indeed, I have a problem when distributing my project. I develop it locally, then commit the changes to an SVN repository. The production site is a check-out of that repository. The problem is that the dev and production project roots have different names (one is "myproject", the other one

Re: Template tags and python paths

2008-02-04 Thread Jon Wilson
Julien wrote: > Yes, my production environment also runs with apache. > > But every other apps work using relative references, starting with the > app names. So all the apps are clearly reachable via the pythonpath. > > That template tag library file is the only place where I have to > include

Re: Template tags and python paths

2008-02-04 Thread Julien
Yes, my production environment also runs with apache. But every other apps work using relative references, starting with the app names. So all the apps are clearly reachable via the pythonpath. That template tag library file is the only place where I have to include the project name in the

Re: Template tags and python paths

2008-02-04 Thread Jon Wilson
Julien wrote: > Hi there, > > I'm having a strange problem. Everything works fine with my project > when I test it on my local machine, but it does not when running on my > online server. All because of one little thing, which I suspect has > something to do with the pythonpath. > > Here's the

Re: template: how to make use of forloop.counter0

2008-02-04 Thread Michael Hipp
Thank you. Using the counter0 as an index into a list seemed like an obvious use case to me. So I give your 'get' filter idea a +1. Thanks for the CSS idea. I found an alternate solution using the tag to set the alignment on a whole column so I only have to loop thru the align list once. More

Template tags and python paths

2008-02-04 Thread Julien
Hi there, I'm having a strange problem. Everything works fine with my project when I test it on my local machine, but it does not when running on my online server. All because of one little thing, which I suspect has something to do with the pythonpath. Here's the structure of the project:

Object Documentation?

2008-02-04 Thread SeanFromIT
Does anyone know where the documentation is for "django sql"? For example, in the tutorial: def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] Where's the documentation for all of the object.* methods you can call, etc? Is there an easy way to translate a

Re: newforms validator_list

2008-02-04 Thread Jonas Pfeil
> First of all, it assumes you're generating the form manually. What if > you're using form_for_model, or more critically, using the admin > interface? Is there a way to specify custom form Field instances for > a corresponding model Field in the admin? Not sure about trunk but in

templatetags and import path

2008-02-04 Thread Brian Luft
Hello, I'm setting up James Bennett's Coltrane app (yes I'm aware that it is released as is, with no guarantees). I wrote a templatetag that intends to pull all the Links instances and make them available to the render context. However, in the tag file, something funny seems to happen with the

Markup Filters (restructuredtext)

2008-02-04 Thread Christian W. Koch
Hey everybody, I've been looking for this like crazy, I started using the markup filters with great succes (love at first sight) but there's a little problem. I use special carachters, like and things like that to support different languages. So, if I store it just like that in the DB then the

Re: template: how to make use of forloop.counter0

2008-02-04 Thread Ned Batchelder
The more I think about your questions, the more I think Django could use a |get filter that would be similar in spirit to the |slice filter. |get would be used to get an attribute or index of an object. Then you could use: This |get filter is something I just made up, so it is not

Re: Optimistic Locking

2008-02-04 Thread Michael Hipp
Tim Sawyer wrote: > On Sunday 03 Feb 2008, code_berzerker wrote: >> How about rewriting save method complately and make additional >> condition in WHERE clausule like this: >> UPDATE ... WHERE id=666 AND mtime=object_mtime >> Checking number of updated rows would give you information about >>

Re: Model Blues - A Newbie's question

2008-02-04 Thread r_f_d
Sure, you can do it, with two (at least) ways, one is to put this into your model so it automatically happens, search the documentation or users group for threadlocals middleware. The other way is to simply put it into your view as all views get the request, request.user will provide you with

Override admin filters

2008-02-04 Thread Aaron Fay
Hi list, I'm wondering if there is a way to override the filters and and list_display on the built-in users view/model in the django admin. I would like to be able to filter/sort by group if possible. Thanks in advance, Aaron --~--~-~--~~~---~--~~ You

Re: Changing expat library...is it easy?

2008-02-04 Thread Graham Dumpleton
The only other option is to upgrade to Python 2.5. In Python 2.5 it correctly namespaces the copy of expat it contains thereby avoiding the problem. Graham On Feb 5, 8:51 am, Giovanni Giorgi <[EMAIL PROTECTED]> wrote: > Hi all, > I have a problem. > I have discovered my dear python 2.4 has a

Re: django.contrib.auth login method incorrectly documented?

2008-02-04 Thread James Bennett
On Feb 4, 2008 2:50 PM, Mojave <[EMAIL PROTECTED]> wrote: > Docs say I pass both the request object and the authenticated user > object to the login method, but that fails - login expects only one > argument. Odds are that you are trying to call the *view* function

Changing expat library...is it easy?

2008-02-04 Thread Giovanni Giorgi
Hi all, I have a problem. I have discovered my dear python 2.4 has a libexpat incompatibility when I use mod_python. As seen in http://www.dscpl.com.au/wiki/ModPython/Articles/ExpatCausingApacheCrash I have expat_1.95.7 library inside /usr/lib/libexpat.so.0 Python 2.4 do not like it very much:

Re: Optimistic Locking

2008-02-04 Thread Tim Sawyer
On Sunday 03 Feb 2008, code_berzerker wrote: > How about rewriting save method complately and make additional > condition in WHERE clausule like this: > UPDATE ... WHERE id=666 AND mtime=object_mtime > Checking number of updated rows would give you information about > success and would

Re: URL naming for multiple-word object's names

2008-02-04 Thread Lucas Di Pentima
Tim Chase wrote: >> http://example.com/reports/Real%20Availability/... > > It sounds like you're reaching for a SlugField, prepopulated from > the actual names. This allows you to make prettier URLs. > > http://www.djangoproject.com/documentation/model-api/#slugfield > > This allows you to

Re: Django CSS

2008-02-04 Thread deniz
Hi, I am using SVN trunk version now. css file is located as /Users/Shared/web/mysite/media/somestyle.css would someone guide me throughly please? base.html: urls.py: (r'^media/(?P.*)', 'django.views.static.serve', {'document_root': 'media'}), settings.py: MEDIA_ROOT =

Re: Template tag arguments

2008-02-04 Thread Aaron Fay
Thanks for the replies fellas... I got around it for the time being by using context['object_id'] in my node class and it worked, but I'll rewrite it to use the resolver method... Thanks for the tip, Aaron Steven Armstrong wrote: Aaron Fay wrote on 02/04/08 21:21: Hi list, I

Re: URL naming for multiple-word object's names

2008-02-04 Thread Tim Chase
> http://example.com/reports/// > > I don't want to use category and subcategory IDs because that's not "the > Django way", but when using names as URL parts I also get "ugly" URLs like: > > http://example.com/reports/Real%20Availability/... It sounds like you're reaching for a SlugField,

URL naming for multiple-word object's names

2008-02-04 Thread Lucas Di Pentima
Hi all, I'm designing the URL structure for an application that will display some reports. This reports will be selected by the user in a wizard-like fashion, first selecting the main category, then the sub-category, and lastly the available report. The categories and subcategories are part

Unresolved pending references (django.core.management.sql)

2008-02-04 Thread Diogo
When I run ./manage sql for the application below the references aren't resolved and the constraint between Issue and Category isn't created. {{{ #!python from django.db import models class Solution(models.Model): description = models.TextField() class Category(models.Model): name =

django.contrib.auth login method incorrectly documented?

2008-02-04 Thread Mojave
I'm using authentication and login/logout from django.contrib.auth (version .96 of Django), but the documentation does not match the source apparently. Docs say I pass both the request object and the authenticated user object to the login method, but that fails - login expects only one argument.

Model Blues - A Newbie's question

2008-02-04 Thread nikosk
I need the default value of a field in a model to be the id of the user creating the new instance of the object the model is modeling ( am I making sense at all?) i.e. : class Article(models.Model): category = models.ForeignKey(Category) title = models.CharField(max_length=200)

Are there any graphical tools for MDA with Django ?

2008-02-04 Thread Jean-Christophe Kermagoret
Hi, are there any tools, like a graphical modeler, to design then generate Django application, from storage (through generation and configuration of Django model) to presentation layer (through generation and configuration of templates) ? I see the one from http://andikoerner.blogspot.com/. Is

Re: Tool recommendations

2008-02-04 Thread Michael Hipp
Peter Rowell wrote: >> I have some ideas for AJAXy web sites, and I'm thinking of >> implementing them in my spare time, but I don't know what tools >> to learn and use. > Another suggestion is jQuery as a JS framework (light and very > featureful) and the excellent taconite plugin. Those two,

Re: Template tag arguments

2008-02-04 Thread Steven Armstrong
Aaron Fay wrote on 02/04/08 21:21: > Hi list, > > I have a custom template tag that is supposed to take an argument from > the template kinda like this: {% profile_user_id object_id %}, problem > is 'object_id' is literally showing up as 'object_id' and not 5 or > whatever it's supposed to

Grouping problem

2008-02-04 Thread Jason K
Hi, just getting to grips with django basics, and stumbling over this little problem.. I have a list of categories, some of which are sub categories, the model looks something like this: name = models.CharField(max_length=30) slug = models.SlugField(prepopulate_from=("name",)) parent =

Re: Template tag arguments

2008-02-04 Thread Rajesh Dhawan
Hi Aaron, > I have a custom template tag that is supposed to take an argument from > the template kinda like this: {% profile_user_id object_id %}, problem > is 'object_id' is literally showing up as 'object_id' and not 5 or > whatever it's supposed to be. I think the issue is I'm working

Template tag arguments

2008-02-04 Thread Aaron Fay
Hi list, I have a custom template tag that is supposed to take an argument from the template kinda like this: {% profile_user_id object_id %}, problem is 'object_id' is literally showing up as 'object_id' and not 5 or whatever it's supposed to be. I think the issue is I'm working within the

Re: reason to limit choices actual-value length?

2008-02-04 Thread Rajesh Dhawan
>     ) >     gender = models.CharField(max_length=1, choices=GENDER_CHOICES) > > Is there a reason to not mirror the actual value stored with the human > readable one? Are you buying much by having a single character rather > than around 20 or 30? Right..you should see no performance effects

Re: Accessing the Admin class

2008-02-04 Thread Jacob Kaplan-Moss
On 2/4/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Anyone know what I'm doing wrong? It's really not you: Django does some magic with the inner Admin class and stuffs it away elsewhere. You can get at it via ``Model._meta.admin``. However, before you do, I'd recommend at least looking at

Re: Accessing the Admin class

2008-02-04 Thread James Bennett
On Feb 4, 2008 1:35 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm confused. Normally, you can access an inner class simply: ...snip... > but this dosen't work with Admin: That's because django.db.models.Model is not a "normal" class, and hence no Django model class is; it has a

Accessing the Admin class

2008-02-04 Thread [EMAIL PROTECTED]
I'm confused. Normally, you can access an inner class simply: class A: class B: pass object = A.B() but this dosen't work with Admin: object = User.Admin Assuming i have a User object with the Admin class defined. I'm trying to make a app that is similar to the built-in Admin

reason to limit choices actual-value length?

2008-02-04 Thread [EMAIL PROTECTED]
I'm talking about this kind of choices field http://www.djangoproject.com/documentation/model-api/#choices e.g. class Foo(models.Model): GENDER_CHOICES = ( ('M', 'Male'), ('F', 'Female'), ) gender = models.CharField(max_length=1, choices=GENDER_CHOICES) Is there a

Re: In need of a more flexible URL routing scheme...

2008-02-04 Thread Kyle Fox
Okay, I think I did something like that. The problem is that the @permalink and named urls doesn't seem to work because the named URL has two different entries in the URLconf... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Tool recommendations

2008-02-04 Thread Peter Rowell
> I have some ideas for AJAXy web sites, and I'm thinking of > implementing them in my spare time, but I don't know what tools > to learn and use. One tool I strongly recommend is Firebug, a Firefox plugin. Amongst its many good features is that it makes debugging AJAX transactions almost

Re: how to speed up objects saving

2008-02-04 Thread johan de taeye
Alex, For this kind of "bulky transfer" the overhead created by the ORM will always be a performance bottleneck: you continuously create and destroy complex python objects. Where/if possible, resort to raw SQL: you could eg use an execute_many statement. Expect a performance improvement of x5 -

Re: Tool recommendations

2008-02-04 Thread [EMAIL PROTECTED]
On Feb 4, 2:03 am, adam <[EMAIL PROTECTED]> wrote: > > Whatever the framework, I would prefer not to learn the intricacies > > of SQL, worry about injection attacks, or browser incompatibilities. > > There is no web framework that would abstract you from browser > incompatibilities, sorry. If

Accessing user variable in edit user form

2008-02-04 Thread Aaron Fay
Hi list, Stuck again :P  I have a couple questions: I'm trying to create a link in the {% block form_top %} of an admin template to link to the profile of the current user I'm editing but {{ user.id }} always gives me the id of the user logged in (me).  Does this form use a request object

Re: Foreign key being set to null when not null in form

2008-02-04 Thread [EMAIL PROTECTED]
On Feb 4, 8:13 am, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Feb 4, 2008 6:43 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > as you can see, I hide the primary and foreign key fields (yes, I am > > aware of the security implications: can we fix the real problem > > please ;-) > >

Re: how to speed up objects saving

2008-02-04 Thread Matt
I believe I'm experiencing a similar problem. One thing that puzzles me is that the CPU usage remains very low while this slow (read: intensive) operation is carried out. On my development machine, neither the Python process or MySQL exceed 5% utilization. Does anyone have any idea why that may

Re: Django CSS

2008-02-04 Thread Christian W. Koch
Todd, assuming that you're using mod_python in your production environment, go to http://www.djangoproject.com/documentation/modpython/#serving-media-files for answers Good luck! =) On Feb 4, 2:41 am, todd <[EMAIL PROTECTED]> wrote: > Sorry, I didn't see the reply from Thomas. > > I do have a

Re: template: how to make use of forloop.counter0

2008-02-04 Thread Eric Abrahamsen
> {% for item in items %} > http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---

Re: template: how to make use of forloop.counter0

2008-02-04 Thread Michael Hipp
David Reynolds wrote: > > On 3 Feb 2008, at 3:32 pm, Michael Hipp wrote: > >> Malcolm Tredinnick wrote: Or is there some other way to get at my 'align' list? >>> Look at the {% cycle %} template tag. It's designed for precisely >>> this >>> purpose. >> Thank you. But can someone show me

Re: Foreign key being set to null when not null in form

2008-02-04 Thread James Bennett
On Feb 4, 2008 6:43 AM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > as you can see, I hide the primary and foreign key fields (yes, I am > aware of the security implications: can we fix the real problem > please ;-) This is a real problem. You need to fix it, or someone will hack you. > >

Foreign key being set to null when not null in form

2008-02-04 Thread [EMAIL PROTECTED]
I have a Question and an Answer table with a relationship between them, defined as follows in models.py: class Question(models.Model): queid = models.IntegerField(primary_key=True, db_column="queid") quedomid = models.ForeignKey(Domain, db_column="quedomid") quedqno =

Re: Problem creating a model instance with data captured from an URL in a View

2008-02-04 Thread jack
I thought that should work and I tried that too and got an error of a data mismatch when I uses p.save() In checking what data was being brought into play I discovered that the summary argument was being dropped. I am now suspecting a bug in the implementation...

Re: Mysterious Django queries

2008-02-04 Thread Sebastian
I think I may have found why this happening: I use Django's session frame work to remember certain filter status. In my template context, i use the following: {'status' :request.session.get('filter_status', None)} I use the session.get() method to see if there is a session variable of that

very important for your life...

2008-02-04 Thread ابو فهد
Hi there ... Thank you for reading this message . Did you here about Islam? I mean the real Islam... Do you have some questions in your religion and you don't have the answers for them? Do you know that you have to condemns in Islam? Ok... just visit these sites, read and download any thing

Re: Mysterious Django queries

2008-02-04 Thread Jarek Zgoda
Sebastian napisał(a): > I am currently undertaking measures to improve performance of an > application that we use very frequently. I am using Django-0.96 and > PostgreSQL 8.1 database. In order to see exactly what is happening on > a database level, I have been examining my PostgreSQL logs and

Mysterious Django queries

2008-02-04 Thread Sebastian
Hi everyone, I am currently undertaking measures to improve performance of an application that we use very frequently. I am using Django-0.96 and PostgreSQL 8.1 database. In order to see exactly what is happening on a database level, I have been examining my PostgreSQL logs and found the

Re: Tool recommendations

2008-02-04 Thread adam
> Whatever the framework, I would prefer not to learn the intricacies > of SQL, worry about injection attacks, or browser incompatibilities. There is no web framework that would abstract you from browser incompatibilities, sorry. If one claims it is, it just doesn't work and provides spaghetti.

Re: Flash and Django

2008-02-04 Thread adam
Ronaldo, > I'm new in Django and Web development and I just want to know if it's > possible to have a flash script showing elements that was retrieve from > a data base by django? use AMF. It's kind of native ActionScript serialized binary RPC. Works well. To transport your objects between

Re: In need of a more flexible URL routing scheme...

2008-02-04 Thread prz
Kyle Fox wrote: > I've been having a hard time figuring out how to solve this problem: > > We're building *another* django blogging app, but we want the app to > support multiple blogs on the same site, ideally by having each Blog > "mounted" on it's own URL, ie: "/politics/" is a Blog,

Re: Read-only connection to database. How to?

2008-02-04 Thread David Reynolds
On 4 Feb 2008, at 1:59 am, Julien wrote: > I totally understand what you suggest, having a RO user at the > database (in this case MySQL) level. > But I am fairly new to Django and Python, and I am unsure how to > implement that dual-setting option. In the devlopment server you can do

Re: template: how to make use of forloop.counter0

2008-02-04 Thread David Reynolds
On 3 Feb 2008, at 3:32 pm, Michael Hipp wrote: > > Malcolm Tredinnick wrote: >>> Or is there some other way to get at my 'align' list? >> >> Look at the {% cycle %} template tag. It's designed for precisely >> this >> purpose. > > Thank you. But can someone show me how to make 'cycle' work? >