Re: javascript and form fields

2007-02-02 Thread Kenneth Gonsalves
On 02-Feb-07, at 7:11 PM, michelts wrote: > Can someone show an example of django+javascript integration? http://www.b-list.org/weblog/2006/08/05/django-tips-simple-ajax- example-part-2 -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~---

full content feeds

2007-02-02 Thread James Tauber
I've implemented a very quick "announcement" feed as coded below. This meets my current need of adding news items in the admin and having an Atom feed for them (there are also HTML views but that's irrelevant to my question). However, I'd like my feed to be full content. Given what I have

Re: textarea - autoamtic line break

2007-02-02 Thread [EMAIL PROTECTED]
ok thanks! i looked on the textwrapper api, but i didn't find a function to replace the line breaks which are set by browser... there are difference in line breaks between the browser? if there are - there will be never a solution given to solve this problem by setting \n for line breaks which set

messages, filters and templates o my!

2007-02-02 Thread Milan Andric
Hello, I have a small problem, I'm submitting a review form (form x) on a page that has many of these forms in a list, so you can view other reviews, add new ones or edit your own. When a review is edited a view processes it and redirects the person back to the review using an anchor like /url

Re: create a model instance from dictionnary

2007-02-02 Thread Leo Soto M.
On 2/2/07, Sebastien Armand [Pink] <[EMAIL PROTECTED]> wrote: > Is it possible to instantiate a model class from a dictionnary? > > I mean instead of using: > > MyModel(arg1=1,arg2=2,...) > > I'd like to use: > > data= {'arg1':1,'arg2':2,...} > MyModel(data) Just use standard python syntax: MyMo

Re: Where to put function to instantiate and save a model object?

2007-02-02 Thread Russell Keith-Magee
On 2/3/07, Rob Hudson <[EMAIL PROTECTED]> wrote: > > Log(user=request.user, session=request.session.session_key, > varname='somename').save() > But I'm finding that I'm writing the above line in a number of > places. I'd like to create a method to do this for me. But where? Why not take th

Re: '001' -> '1' in Sqlite!!

2007-02-02 Thread Russell Keith-Magee
On 2/2/07, mamcxyz <[EMAIL PROTECTED]> wrote: > INSERT INTO Vendedor (Codigo) VALUES ('006') > > And blindly believe in the database. > > Then today I discover Sqlite "transform" it to '6'. That is I call a > shock! Specially when Sqlite declare that all the data is internally > stored as text. Y

Re: javascript and form fields

2007-02-02 Thread Robert Coup
[EMAIL PROTECTED] wrote: > Not necessarily... You don't have to get them by ID. You can get them > by tagname or, with a simple helper, class name. > Or group them, then cycle through... something like > var controls = > document.getElementById("controls").getElementsByTagName("a") > for(var i=0;i

create a model instance from dictionnary

2007-02-02 Thread Sebastien Armand [Pink]
Is it possible to instantiate a model class from a dictionnary? I mean instead of using: MyModel(arg1=1,arg2=2,...) I'd like to use: data= {'arg1':1,'arg2':2,...} MyModel(data) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Goo

Re: Django as Single Sign-On?

2007-02-02 Thread Rob Hudson
On Fri Feb 02, 2007 at 02:11:22PM -0800, Reinhard Knobelspies wrote: > > Kim Camerons "Laws of Identity" should be your starting point for > research on SSO and identity-related matters: > http://www.identityblog.com/?page_id=354 > > Django and OpenID > http://simonwillison.net/2006/Dec/22/scree

Re: Django as Single Sign-On?

2007-02-02 Thread Rob Hudson
On Fri Feb 02, 2007 at 09:51:33PM -, Brian Beck wrote: > Hi Rob, > > I implemented CAS in Django, which is one form of single sign-on. > You're welcome to check out the code to see what needs to be done for > such a task; it's mostly middleware stuff. Details are here: http:// > blog.case.edu

Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"

2007-02-02 Thread Graham Dumpleton
On Feb 3, 12:12 am, "HenrikG" <[EMAIL PROTECTED]> wrote: > My biggest problem was to get the Location directive right in the > httpd.conf. It now looks like this: > > > SetHandlermod_python > PythonHandler django.core.handlers.modpython > PythonPath "sys.path + ['/usr/local/apache2/django

Re: Django as Single Sign-On?

2007-02-02 Thread Reinhard Knobelspies
Kim Camerons "Laws of Identity" should be your starting point for research on SSO and identity-related matters: http://www.identityblog.com/?page_id=354 Django and OpenID http://simonwillison.net/2006/Dec/22/screencast/ http://feh.holsman.net/articles/2006/07/14/zyons-openid-what-a-match http://s

Re: Django as Single Sign-On?

2007-02-02 Thread Brian Beck
On Feb 2, 4:06 pm, "Rob Hudson" <[EMAIL PROTECTED]> wrote: > I confess I haven't done my research on what actually constitutes SSO > and what underlying functionality has to exist, but I think we're > looking at a possible need for something like this so I thought I'd > open up a discussion... > >

Re: '001' -> '1' in Sqlite!!

2007-02-02 Thread Todd O'Bryan
Is the database field set up as a textual or numeric field? If it's textual, then this seems like a bug. If it's numeric, it seems perfectly reasonable and I would suggest changing any fields where you want leading zeroes to something that holds character data rather than numbers. Todd On Fri, 2

Re: '001' -> '1' in Sqlite!!

2007-02-02 Thread mamcxyz
Thanks, but I don't use the model. Is a direct insert. --~--~-~--~~~---~--~~ 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 thi

Django as Single Sign-On?

2007-02-02 Thread Rob Hudson
I confess I haven't done my research on what actually constitutes SSO and what underlying functionality has to exist, but I think we're looking at a possible need for something like this so I thought I'd open up a discussion... Could Django be used to implement Single Sign-On? I plan to read thi

Re: Error with Meta: unique_together

2007-02-02 Thread Todd O'Bryan
Thanks a lot. That is, indeed, the problem. On Fri, 2007-02-02 at 16:31 -0300, Ramiro Morales wrote: > Todd, > > On 2/2/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > > > I'm getting the following error when I put > > class Meta: > > unique_together = (('number', 'test'),) > > in an

Transaction middleware + Filesystem

2007-02-02 Thread Paul Collier
Hello! Is there any way to tie file-system operations (or other non-database operations) to the transaction code? If the operation is found right in the view function it's simply a matter of moving the file operation to the end of the function and doing a rollback if it fails. However, if it happ

use date_hierarchy from admin app in my own views

2007-02-02 Thread frank h.
hello, can I use the _very cool_ 'date_hierarchy' tag from the admin application in my own views? I have asked this before and received some answer http://groups.google.com/group/django-users/browse_frm/thread/30dc2ccb12f72059/185c211d00ed85ef?lnk=gst&q=date_hierarchy&rnum=4#185c211d00ed85ef ..t

Re: Forms inheritance

2007-02-02 Thread aaloy
2007/2/2, Honza Král <[EMAIL PROTECTED]>: > On 2/2/07, aaloy <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > I'm trying use form inheritance to render the form, but it seems > > Django just renders the child fields and not the parent ones. Is this > > a feature or a bug? > > > > > > class Pare(f

Re: Error with Meta: unique_together

2007-02-02 Thread Ramiro Morales
Todd, On 2/2/07, Todd O'Bryan <[EMAIL PROTECTED]> wrote: > > I'm getting the following error when I put > class Meta: > unique_together = (('number', 'test'),) > in an Answer model that refers to a Test model as a ForeignKey. > > Commenting out the Meta class clears up the problem, bu

Where to put function to instantiate and save a model object?

2007-02-02 Thread Rob Hudson
I have a model called "Log" which logs access to certain pages or sets variables that we're tracking. The way I'm inserting new records into the log table is like this: Log(user=request.user, session=request.session.session_key, varname='somename').save() But I'm finding that I'm writing th

Error with Meta: unique_together

2007-02-02 Thread Todd O'Bryan
I'm getting the following error when I put class Meta: unique_together = (('number', 'test'),) in an Answer model that refers to a Test model as a ForeignKey. Commenting out the Meta class clears up the problem, but it's a complete mystery to me. Any ideas? Todd AttributeError at /a

See changes in save trigger

2007-02-02 Thread Dagur
Is it possible to see if a field (in my case an Imagefield) has changed in the save() method? I want to have a Textfield automatically changed if a new Image is uploaded, otherwise leave it alone. class SomeClass: sometextfield someimagefield def save() if someimagefield has changed

Re: textarea - autoamtic line break

2007-02-02 Thread Waylan Limberg
On 2/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > The reason for my question is following: > > i would like to use a textarea which size is fix (rows/cols). > The text who everybody write into, should not be longer as the given > size of area. > So...if the line ends, the text should bre

Re: javascript and form fields

2007-02-02 Thread [EMAIL PROTECTED]
Not necessarily... You don't have to get them by ID. You can get them by tagname or, with a simple helper, class name. Or group them, then cycle through... something like var controls = document.getElementById("controls").getElementsByTagName("a") for(var i=0;i wrote: > Hello. > ahh weekend :) > >

Re: order_by not working with foreign keys:

2007-02-02 Thread Ramiro Morales
Hi Michael, On 2/2/07, Michael Radziej <[EMAIL PROTECTED]> wrote: > > Hi Ramiro, > > are you the Mr. Anonymous who left comment #18? Just for > clarification that I understand who is who ;-) > No I'm not :), it seems to me Mr Anonymous is Bram Dejong. I attached the updated patch to ticket #2076

How to access the query string in a template?

2007-02-02 Thread [EMAIL PROTECTED]
Is it possible to access the url query string info in a django template? --~--~-~--~~~---~--~~ 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 un

Re: Get domain name

2007-02-02 Thread Don Arbow
On Feb 1, 2007, at 4:05 PM, evenrik wrote: > > I have 2 domain names pointing to the same ip. I need to customize > some of the content depending on which domain is used. How do I know > in a view which one the user connected with? request.META['HTTP_HOST'] should tell you the domain name that

Re: order_by not working with foreign keys:

2007-02-02 Thread Michael Radziej
Hi Ramiro, are you the Mr. Anonymous who left comment #18? Just for clarification that I understand who is who ;-) Michael -- noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg - Tel +49-911-9352-0 - Fax +49-911-9352-100 http://www.noris.de - The IT-Outsourcing Company --~--~---

Re: javascript and form fields

2007-02-02 Thread [EMAIL PROTECTED]
Hello. ahh weekend :) On Feb 2, 3:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Why does that hurt? Sure is better than having onclick handlers > littering your html all over the place. Well the hurting thing is that You have to be aware of control id. Besides controlling of many

Re: '001' -> '1' in Sqlite!!

2007-02-02 Thread Joseph Heck
change your model so that it's storing a CharField or TextField if you want that level of control over representation. -joe On 2/2/07, mamcxyz <[EMAIL PROTECTED]> wrote: > > > Hi, > > I found that in Sqlite when I do: > > INSERT INTO Sample (Code) VALUES ('001') > > Get converted to '1' > >

Re: "dynamic" model, where to put what

2007-02-02 Thread Joseph Heck
Determine some layer of your application that will be the interface. The "default assumption" in a framework like Django is that all requests will be coming in through an HTTP service - so one option is to simply communicate through that HTTP interface. If you're concerned about having multiple th

Re: Get domain name

2007-02-02 Thread [EMAIL PROTECTED]
Are you using the sites framework to distinguish the domain names as separate sites? (I don't want to give you a long-winded answer until I understand what you are trying to accomplish) On Feb 1, 7:05 pm, "evenrik" <[EMAIL PROTECTED]> wrote: > I have 2domainnames pointing to the same ip. I need t

Re: Middleware sessions

2007-02-02 Thread Joseph Heck
As of the "magic removal" (the bits just prior to the 0.95 release), sessions was moved into contrib. -joe On 2/2/07, kbochert <[EMAIL PROTECTED]> wrote: > > > After a long absence, I tried my installation of the tutorial and got: > > Error importing middleware django.middleware.sessions > > My s

Re: Need advice for model relationship (onetoone inside?)

2007-02-02 Thread Joseph Heck
The relationship you've set up - one template can have many associated documents, do I understand correctly? So every document will have a reference to the Template that it's associated with. If that's the case, you've only set it up for one template per Document. A default doesn't make sense in th

'001' -> '1' in Sqlite!!

2007-02-02 Thread mamcxyz
Hi, I found that in Sqlite when I do: INSERT INTO Sample (Code) VALUES ('001') Get converted to '1' Exist a way to solve it (I don't like the idea of put ' 001' because that break the integration process with another database) --~--~-~--~~~---~--~~ You re

Get domain name

2007-02-02 Thread evenrik
I have 2 domain names pointing to the same ip. I need to customize some of the content depending on which domain is used. How do I know in a view which one the user connected with? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

haw access to values from field with choices

2007-02-02 Thread kamil
Surely it's solved but I can't find any info about it. I'm sure that everybody met this problem. What is the best way to get rendered the value from the field with choices. Generic views spits key not value. --~--~-~--~~~---~--~~ You received this message because

"dynamic" model, where to put what

2007-02-02 Thread Dill0r
Hi, Though there is a section in the FAQ converning diangos MVC philosphy im still confused. My model is manipulated while my application runs. So how do i manipulate the model from external? Ive written a stop/ wait protocol in python which communicates with the microcontroller that manipulate

'001' -> '1' in Sqlite!!

2007-02-02 Thread mamcxyz
Hi, I'm doing direct inserts, like: INSERT INTO Vendedor (Codigo) VALUES ('006') And blindly believe in the database. Then today I discover Sqlite "transform" it to '6'. That is I call a shock! Specially when Sqlite declare that all the data is internally stored as text. Now, I have a real is

Re: Uploading large files via http FORM

2007-02-02 Thread Jay Parlar
On 1/12/07, Pythoni <[EMAIL PROTECTED]> wrote: > > Hi, > does anyone have an experience with uploading large files in Django > application? > I use mod_python with Django and when I try to upload a file about 100 > MB I received an error. > Thank you for any suggestion. > L. > Even if you reconfi

Re: order_by not working with foreign keys:

2007-02-02 Thread Ramiro Morales
On 2/1/07, Russell Keith-Magee <[EMAIL PROTECTED]> wrote: > > On 2/1/07, Michael Radziej <[EMAIL PROTECTED]> wrote: > > > is there a > > > HOWTO somewhere on how to write a test which does the whole model, > > > database sync, etc etc cycle? > > [...] > > [...] > > Django's internal tests are in t

newforms custom field errors?

2007-02-02 Thread Ceph
Would it be possible to allow custom error messages per field in newforms? E.g., class MyForm(forms.Form): username = forms.CharField(label="User Name", error="Please enter your user name.") "This field is required." doesn't work well if you are displaying your errors on top of your form or

Re: textarea - autoamtic line break

2007-02-02 Thread [EMAIL PROTECTED]
The reason for my question is following: i would like to use a textarea which size is fix (rows/cols). The text who everybody write into, should not be longer as the given size of area. So...if the line ends, the text should break automaticly in the next line. And this line break should allready

Middleware sessions

2007-02-02 Thread kbochert
After a long absence, I tried my installation of the tutorial and got: Error importing middleware django.middleware.sessions My settings.py has: MIDDLEWARE _CLASSES = { "django.middleware.sessions.SessionMiddleware", ... I change this to : MIDDLEWARE _CLASSES = { "django.cont

Middleware sessions

2007-02-02 Thread kbochert
After a long absence, I tried my installation of the tutorial and got: Error importing middleware django.middleware.sessions My settings.py has: MIDDLEWARE _CLASSES = { --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

Re: javascript and form fields

2007-02-02 Thread [EMAIL PROTECTED]
Look at: http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 and http://www.b-list.org/weblog/2006/08/05/django-tips-simple-ajax-example-part-2 Django has quite a bit of things built in that will help you, regardless of which JS library you want to use. On Feb 2, 7:41

Re: use forloop.counter0 as index?

2007-02-02 Thread Aidas Bendoraitis
I think, it's impossible to use forloop.counter0 as an index, because array.forloop already searches for array['forloop'], array[forloop], array.forloop, and similar combinations which don't exist. But maybe you could zip(items, array) in the view or merge items and array in some other way and to

Re: possible bug when editing an object: foreign key "_id" part gone

2007-02-02 Thread Benedict Verheyen
Benedict Verheyen schreef: > Hi, > > i think i might have encountered a possible bug but i'm not sure though. > Editing an object and leaving a mandatory field empty results in the > form "forgetting" the foreign keys. It doesn't actually forget but it ommits > the > "_id" part and thus the valu

Re: javascript and form fields

2007-02-02 Thread michelts
Hi! How do you recomend work with javascript and django? There is documentation for all tasks on django but there is nothing about using ajax/json/javascript with it. I like to use MochiKit and I like to made use of ajax at all, to be able to do this, I made a helper function called json_to_resp

Re: django and tramline integration

2007-02-02 Thread [EMAIL PROTECTED]
Maybe you'll find this useful. http://codespeak.net/pipermail/tramline-dev/2006-December/41.html I haven't checked it yet, but will during the weekend, so maybe I can share more information on Monday. Probably it would be useful to check integration with Zope, but I haven't had enough time ei

Re: noobie first project

2007-02-02 Thread [EMAIL PROTECTED]
Sounds like you need to extend the auth_user. If I were you I'd look at Jeff Croft's Lost Theories source, as that does what you need to do. Also, I think James Bennett wrote an article on it over on b- list.com On Feb 2, 3:29 am, "ashwoods" <[EMAIL PROTECTED]> wrote: > first place to look is h

Re: javascript and form fields

2007-02-02 Thread [EMAIL PROTECTED]
Why does that hurt? Sure is better than having onclick handlers littering your html all over the place. On Feb 2, 6:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi. Is there any clean way to add javascript handler to form field > (subclas of django.forms.FormField)? > > The result sh

Re: ImproperlyConfigured: Error importing middleware django.contrib.sessions.middleware: "No module named mysite"

2007-02-02 Thread HenrikG
Hi John! I also started my Django-work on WinXP, but I used the built-in Django webbserver and I never had any "no module"-errors. I'm now using Ubuntu-Apache-modpython-PostgreSQL and when I started in Ubuntu, I had some of those errors. My solution was (except for recreating a corrupt database)

Re: subversion and staying up to date

2007-02-02 Thread [EMAIL PROTECTED]
On Feb 1, 7:46 pm, "mtnpaul" <[EMAIL PROTECTED]> wrote: > It seems that if I do this every day, that maybe the least painful in > the long run, as there should be just a few changes, but perhaps it > would be easier to do this just once a month or week. I svn update at least once a week... been

javascript and form fields

2007-02-02 Thread [EMAIL PROTECTED]
Hi. Is there any clean way to add javascript handler to form field (subclas of django.forms.FormField)? The result should look like: Right now im using 'ugly' document.getElementById('id_some_name') . from template level. But it hurts and is ugly IMHO ;) Regards Michal --~--~-~

Database templates, views, and template tags

2007-02-02 Thread plungerman
greetings, i have created a template loader to grab templates from the database: from django.template import TemplateDoesNotExist try: from myproject.editor.models import Layout except: Layout = None def load_template_source(name, template_dirs=None): """ Loads templates from t

Re: textarea - autoamtic line break

2007-02-02 Thread Kenneth Gonsalves
On 02-Feb-07, at 4:26 PM, Simon Brunning wrote: >> field's value on the server side, post-submittal. I do that with one >> of my own forms (in order to fit the text in a box in a pdf). > > Why write your own? > > hey cool - just what i wanted at

Re: textarea - autoamtic line break

2007-02-02 Thread Simon Brunning
On 2/1/07, Sarcastic Zombie <[EMAIL PROTECTED]> wrote: > > It would be pretty simple to write a python function to dice up the > field's value on the server side, post-submittal. I do that with one > of my own forms (in order to fit the text in a box in a pdf). Why write your own?

Need advice for model relationship (onetoone inside?)

2007-02-02 Thread django-user
Hi community, For a smallish app, I want to manage document templates (model: Template) for documents (model: Document). Template has a foreign key on Document (many to one relationship). Now, I want a default Template per Document. How would I do that? I thought of various implementations: - h

Re: help with queryset and ManytoMany

2007-02-02 Thread sandro.dentella
> > class Project > > ... > > staff = models.ManyToMany(User) > > > My concern is the fact that I should loop over all my projects and get > > the staff for each ot them. > > If Project has a ManyToMany field, then Users will have a field called > project_set. > > frank = User.objects.get

Re: noobie first project

2007-02-02 Thread ashwoods
first place to look is here: http://www.djangoproject.com/ documentation/ :) and for your special case: http://www.djangoproject.com/documentation/ authentication/ you can use the admin site for users, of course its not a full blown cms, (it's not supposed to either). but you can add functional