Re: avoid pre filled registration form

2010-02-24 Thread Andrius A
Hi, Use autocomplete="off" attribute in your input fields. On 24 Feb 2010 07:58, "andreas schmid" wrote: hi, im using django registration to allow people to register to my site. the ugly thing is that the registration form is pre filled by the browser in a wrong way. the form has the usual 4

Optimize large table view

2010-02-24 Thread Timothy Kinney
I have models which describe a game. There are 61 provinces with 9 rooms in each province, for a total of 549 locations. There are several hundred samurai, each assigned to a particular room id. Province(name, id, exits) Room(id, name, foreignkey('Province')) Samurai(id, name, foreignkey('Room'))

Re: Looking for a wiki or cms created with django

2010-02-24 Thread Massimiliano della Rovere
no it is just at pre alpha status. if you are searching for something in python, head towards OpenErp else vtiger + media wiki us a solution or as soon as we will resolve our problems here with migration from sugar to vtiger, I will start writing a crm in django (or grok+zope3) tailored for

Re: Looking for a wiki or cms created with django

2010-02-24 Thread Adrian Maier
Hello, Thanks for trying to help, but I am aware of the django-cms project. I have already tried to use it, but it proved to be a nightmare to install on my hosting solution. I could probably make it work, but the main problem is that I am seeking for something that works like a wiki : to have

Re: Looking for a wiki or cms created with django

2010-02-24 Thread Lakshman Prasad
You can try django-wakawaka: http://github.com/bartTC/django-wakawaka by bartTC, that is used in Pinax. On Wed, Feb 24, 2010 at 1:42 PM, Adrian Maier wrote: > Hello, > > Thanks for trying to help, but I am aware of the django-cms project. I > have > already tried to use it, but it proved to be a

Re: Need help in serialization of objects.

2010-02-24 Thread chiranjeevi muttoju
Thanks for your reply Oliver, Your reply really helpful to me. On Wed, Feb 24, 2010 at 1:14 PM, Oliver Beattie wrote: > I'm not entirely sure why you'd want to do this, but I'm sure you have > your reasons. Probably the best way would be to write your own > serializer, which subclasses Django's

Re: avoid pre filled registration form

2010-02-24 Thread andreas schmid
thx i put the autocomplete definition directly in the tag and its inherited by all input fields Andrius A wrote: > > Hi, > > Use autocomplete="off" attribute in your input fields. > >> On 24 Feb 2010 07:58, "andreas schmid" > > wrote: >> >> hi, >> >> im using django r

Re: custom method in view/models

2010-02-24 Thread soFh
Sure Tim its this function in my Ast Model: def minz(self): y = self.billsec/60.0 for i in Rates.objects.all(): l = len(i.prefix) if i.prefix == self.dst[:l]: rated = i.rate

Re: Adding a new language to Django?

2010-02-24 Thread andreas schmid
and what if im using a third party app like django-registration and i want to get a better translation without the need to copy the app my repository and customize it? could i override the default django-registration .mo files? derek wrote: > Thanks Daniel - I missed that part {sound of head slap

Re: two different models, order by date

2010-02-24 Thread Matt Schinckel
On Feb 24, 6:59 am, Nick wrote: > In the view set up something like > > all = [Books.objects.all() & Movies.objects.all()].orderby('date') > I thought: "super, I have been looking for this", but: "Cannot combine queries on two different base models." Matt. > On Feb 23, 2:22 pm, ds wrote: > >

Re: Adding a new language to Django?

2010-02-24 Thread Daniel Roseman
On Feb 24, 7:25 am, derek wrote: > Thanks Daniel - I missed that part {sound of head slap}. > > Assuming I manage to do a translation, would there be any interest > from the dev team to include this new language version? Can't speak for them, but usually, yes - as long as you commit to maintainin

Lighttpd and Django

2010-02-24 Thread tsuraan
I'm trying to run django with lighttpd 1.4 and fastcgi. I'm using the normal recipe that has a rewrite rule to convert all requests but a few into requests for /foo.fcgi$1, and then I have the fastcgi server tied to that base. The problem that I have is that in django, all my request.path variabl

Re: django and ldap

2010-02-24 Thread andreas schmid
Peter Herndon wrote: > On Feb 22, 2010, at 3:13 PM, andreas schmid wrote: > > >> Peter Herndon wrote: >> >>> On Mon, Feb 22, 2010 at 9:40 AM, andreas schmid >>> wrote: >>> >>> >>> im experiencing strange problems now. the user is able to authenticate against ldap only if

Passing RequestContext as dict vs. context_instance=RequestContext

2010-02-24 Thread Jesaja Everling
Hi all! Is there any difference between these two ways of using RequestContext? I'm asking because I usually use the first approach, but I want to make sure that there are no subtle differences. 1) def index(request): return render_to_response('index.html', Reque

Re: two different models, order by date

2010-02-24 Thread Damian
yep, im getting the same error. i believe what im asking is not possible , but i really really hope im wrong :) On Wed, Feb 24, 2010 at 7:02 AM, Matt Schinckel wrote: > On Feb 24, 6:59 am, Nick wrote: >> In the view set up something like >> >> all = [Books.objects.all() & Movies.objects.all()

schema migration

2010-02-24 Thread dj_vishal
Hi to all Am new to django...plz suggest me which is the better one for the schema migration for django apps Thanks in advance vishal 2009vis...@gmail.com -- View this message in context: http://old.nabble.com/schema-migration-tp27714179p27714179.html Sent from the django-users mai

Re: schema migration

2010-02-24 Thread Gonzalo Delgado
El 24/02/10 09:16, dj_vishal escribió: > plz suggest me which is the better one for the schema > migration for django apps > http://south.aeracode.org/ -- Gonzalo Delgado -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: two different models, order by date

2010-02-24 Thread Jirka Vejrazka
Hi, > i have a simple question here, i've been trying to found the answer > but somehow i got confused if this is wheter possible or not: it's always possible, just a matter of time and effort (and cost) ;-) > I have two django models, movies and books , i want to get all the > objects from bo

Re: schema migration

2010-02-24 Thread Shawn Milochik
+1 on South Shawn On Feb 24, 2010, at 7:20 AM, Gonzalo Delgado wrote: > El 24/02/10 09:16, dj_vishal escribió: >> plz suggest me which is the better one for the schema >> migration for django apps >> > > http://south.aeracode.org/ > > -- > Gonzalo Delgado > > -- > You received this messag

Django in the enterprise?

2010-02-24 Thread Steven Elliott Jr
Dear friends, I apologize for writing this type of question to the community but I would appreciate any information you could pass on considering the breadth of knowledge within this group. I know that the word “enterprise” gives some people the creeps, but I am curious to know if anyone has ex

Re: Django in the enterprise?

2010-02-24 Thread Shawn Milochik
What do you mean by '...a good replacement for Java EE..."? Python is a language. Django is a framework written in Python. You can make any kind of site at all with them. My company's Web applications do things like fund debit cards, communicate with bank APIs, calculate driving reimbursement a

Re: Django in the enterprise?

2010-02-24 Thread Dougal Matthews
You may find this thread of django-developers interesting; "What The Enterprise wants from Django" http://groups.google.com/group/django-developers/browse_frm/thread/c89e028a536514d3 It's a discussion about some of the things that Django is missing that the enterprise wants/needs - the good news

How to handle media for custom tags?

2010-02-24 Thread zinckiwi
Hi all, I have a custom inclusion tag that renders a template filled with topical data for use in a sidebar. This is used on many pages, but not all, and has some supporting javascript and CSS. Currently all that lives in the tag's template, (incorrectly) inline with the html: ... ... I

Authentication issue

2010-02-24 Thread CrabbyPete
I have code that allows an anonymous user to look at some elses page, but I want to limit what they can do so I have the following code def show(request): u = request.GET['friend'] user = User.objects.get(pk=u) visit = user.is_authenticated() visit should be false, but it keeps com

Set language on per page basis

2010-02-24 Thread Tor Nordam
I'm currently developing a project for making course webpages at my university. Essentially, each course would be an instance of the model Course, and each course would then get it's own webpage. However, as some courses are taught in Norwegian, and some in English, I want to use django's internati

preventing template from converting html entities

2010-02-24 Thread Federico Capoano
Hello to all, simple question: I have the following HTML in a template: But it gets rendered this way: That is, the " entity is converted to the respective character, ". Very nice, but i'd need " Is there a filter or something i can use to tell the Django Template System to render " ? Thank

Re: Optimize large table view

2010-02-24 Thread Alex Robbins
One tool that can be really helpful for helping with understanding database activity is http://github.com/robhudson/django-debug-toolbar It has an SQL panel that shows all the queries that happened, and how long they took. You'll at least know what is happening now. Should help you figure out how

Re: Django in the enterprise?

2010-02-24 Thread Steven Elliott Jr
@Shawn Sorry if I was not clear with my question. It seems like a lot of sites that I have seen on djangosites are news sites, or content-driven sites like blogs, personal web pages, social networking-type sites like fluther.com, etc. I was just curious if anyone has every sat down and wrote a

Re: Authentication issue

2010-02-24 Thread Daniel Roseman
On Feb 24, 2:36 pm, CrabbyPete wrote: > I have code that allows an anonymous user to look at some elses page, > but I want to limit what they can do so I have the following code > > def show(request): >      u = request.GET['friend'] >      user = User.objects.get(pk=u) >      visit = user.is_auth

Re: Django in the enterprise?

2010-02-24 Thread Tom Evans
On Wed, Feb 24, 2010 at 2:40 PM, Steven Elliott Jr wrote: > @Shawn > > Sorry if I was not clear with my question. It seems like a lot of sites that > I have seen on djangosites are news sites, or content-driven sites like > blogs, personal web pages, social networking-type sites like fluther.com

Re: Optimize large table view

2010-02-24 Thread Daniel Roseman
On Feb 24, 8:08 am, Timothy Kinney wrote: > I have models which describe a game. There are 61 provinces with 9 > rooms in each province, for a total of 549 locations. There are > several hundred samurai, each assigned to a particular room id. > > Province(name, id, exits) > Room(id, name, foreignk

Re: preventing template from converting html entities

2010-02-24 Thread Daniel Roseman
On Feb 24, 2:36 pm, Federico Capoano wrote: > Hello to all, > > simple question: > > I have the following HTML in a template: > > > But it gets rendered this way: > > > That is, the " entity is converted to the respective character, > ". Very nice, but i'd need " > > Is there a filter or somethi

Re: Passing RequestContext as dict vs. context_instance=RequestContext

2010-02-24 Thread bruno desthuilliers
In Feb 24, 1:00 pm, Jesaja Everling wrote: > Hi all! > > Is there any difference between these two ways of using > RequestContext? > I'm asking because I usually use the first approach, but I want to > make sure that there are no subtle differences. > > 1) > def index(request): >     return render

Re: Django in the enterprise?

2010-02-24 Thread bruno desthuilliers
On Feb 24, 3:23 pm, Steven Elliott Jr wrote: > Dear friends, > I apologize for writing this type of question to the community but I would > appreciate any information you could pass on considering the breadth of > knowledge within this group. > I know that the word “enterprise” gives some people

AdminSplitDateTime ValidationError when using 2 or more forms in a wizard

2010-02-24 Thread stereoit
Hi, I am struggling with using AdminSplitDateTime widget on my form for form.DateTimeField. I've modified custom template so it loads correct admin.js and admin.css files. When I have only one Form, I can click and fill and use submit button and everything is cool. When I have 2+ forms in my wizar

Re: Django in the enterprise?

2010-02-24 Thread Ovnicraft
2010/2/24 Steven Elliott Jr > Dear friends, > I apologize for writing this type of question to the community but I would > appreciate any information you could pass on considering the breadth of > knowledge within this group. > I know that the word “enterprise” gives some people the creeps, but

Re: Optimize large table view

2010-02-24 Thread bruno desthuilliers
On Feb 24, 9:08 am, Timothy Kinney wrote: > I have models which describe a game. There are 61 provinces with 9 > rooms in each province, for a total of 549 locations. There are > several hundred samurai, each assigned to a particular room id. > > Province(name, id, exits) > Room(id, name, foreignk

Re: two different models, order by date

2010-02-24 Thread Pablo Ilardi
I'd say that the effort of doing it depends on the db structure, if both models share tables or are under the same table hierarchy then, you can create a single query based on the common parent (though you'll only retrieve objects of the parent model and you'll have to determine somehow later what

newbie doubt about editing an objects field

2010-02-24 Thread jimgardener
hi, I am new to this framework and was trying out some code..I created a MySubject model with name and description fields.I am using name as a unique field and description can be an empty string.I provided add and edit views as well as a ModelForm.I wanted to deal with the following usecases. In

non stop media player on site - similar to facebook chat

2010-02-24 Thread grimmus
Hi, I'm making a site with about 6 sections, each with a different URL. The client would like a small Flash media player of song previews alongside the navigation on every page. He wants the music to play continuously even when the user navigates to another page. I'm having trouble thinking how

Re: newbie doubt about editing an objects field

2010-02-24 Thread Shawn Milochik
There's no need to pass 'instance' if you're instantiating your ModelForm with request.POST. You only need to pass the instance if you already have a specific model instance programmatically and want to get a ModelForm for it. You can replace if request.method=='POST': with if request.POST: Add

Re: Django in the enterprise?

2010-02-24 Thread Andy McKay
On 2010-02-24, at 6:40 AM, Steven Elliott Jr wrote: > Right now we have Java and ASP.NET doing most of the work for us but the > systems are old and need updating. Not to mention budgetary constraints are > big thing now. I used Django to write an intranet application and it was very > nice and

Re: Django in the enterprise?

2010-02-24 Thread Steven Elliott Jr
Thank you to all for your comments. It has been most helpful. On Feb 24, 2010, at 11:05 AM, Andy McKay wrote: > > On 2010-02-24, at 6:40 AM, Steven Elliott Jr wrote: >> Right now we have Java and ASP.NET doing most of the work for us but the >> systems are old and need updating. Not to mention

Re: Optimize large table view

2010-02-24 Thread Timothy Kinney
Bruno, *samurai *is a Japanese word that has been brought into English. The only accepted spelling in English is *samurai* (according to the Oxford English Dictionary), and this covers both singular and plural. It's interesting to note that in Japanese the plural is *samurai*. They do not have a wa

Re: newbie doubt about editing an objects field

2010-02-24 Thread Timothy Kinney
As far as requiring a unique value you can set this in your model. Just add the option *unique=True* when you define the field in the model and the database will not allow two entries with the same value for that field. On the other hand, if you have something like first names and last names you mi

Re: non stop media player on site - similar to facebook chat

2010-02-24 Thread Timothy Kinney
I'm not an expert on this, but will give it a stab. If you use a template system then the deeper web pages for a particular site will be extending the index pages. I think you could set up your different site names to all inherit from a single media_player.html template that has the flash player e

Re: two different models, order by date

2010-02-24 Thread Timothy Kinney
I agree with Pablo. Don't start designing queries until you've designed your database relations, because the queries are meaningless if you change relationships. Sit down with a piece of paper and list or draw bubbles or whatever so that you can establish what your models are, what the fields are

Re: newbie doubt about editing an objects field

2010-02-24 Thread jimgardener
On Feb 24, 9:55 pm, Timothy Kinney wrote: >Just add > the option *unique=True* when you define the field in the model and the > database will not allow two entries with the same value for that field. I have defined the name field to be unique in the model. name=models.CharField(unique=True

Re: newbie doubt about editing an objects field

2010-02-24 Thread Timothy Kinney
You can define a variable called error_message which is None when you pass it into the template initially. Then you can fill it with the desired message and do something like this: {% if error_message %} # display some information -Tim On Wed, Feb 24, 2010 at 11:16 AM, jimgardener wrote: > >

Re: Set language on per page basis

2010-02-24 Thread Timothy Kinney
I believe you want to use the {% *trans* %} template method. http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/ -Tim On Wed, Feb 24, 2010 at 7:18 AM, Tor Nordam wrote: > I'm currently developing a project for making course webpages at my > university. Essentially, each cou

Re: to_field connected to field in UserProfile

2010-02-24 Thread Timothy Kinney
When you include the to_field, it tells Django that you want the foreignkey to be the to_field on the CustomerProfile. It then looks for a field called payment_id (following the foreignKey relationship). This is normal. If you remove the to_field, it will choose the primary key of CustomerProfile

Re: newbie doubt about editing an objects field

2010-02-24 Thread jimgardener
On Feb 24, 10:51 pm, Timothy Kinney wrote: > You can define a variable called error_message which is None when you pass > it into the template initially. Then you can fill it with the desired > message and do something like this: > {% if error_message %} >    # display some information Well,ac

Re: newbie doubt about editing an objects field

2010-02-24 Thread Timothy Kinney
If you are cleaning the input data (to remove the spaces) then you have this functionality. Why do you need a further description? Sorry if I'm being obtuse. -Tim On Wed, Feb 24, 2010 at 12:11 PM, jimgardener wrote: > > > On Feb 24, 10:51 pm, Timothy Kinney wrote: > > You can define a variable

need help in multy db.

2010-02-24 Thread chiranjeevi muttoju
Hi all, I'm using the multidb concept in django1.1. i studied some documentation and i tried and its working fine. but i have some doubts in that. class MyModel1(models.Model): class Meta: managed = False db_table = 'table1' objects = ExtDBManager(altconnection1) ... class

Include tag returning a hard return

2010-02-24 Thread newspaper-django-lackey
Occasionally when I use the include tag, I'm seeing a tokenized hard return appear before the include. The return shows in both the source html and in the resulting display. The only way to get rid of this "hard space" is to remove the include and place the code from the include directly into the p

Re: need help in multy db.

2010-02-24 Thread Shawn Milochik
Multi-DB support doesn't exist in 1.1 -- only 1.2 (still in beta). The "managed" attribute in the Meta tells Django whether it should handle the model with its ORM. The default is True. If it's True, Django will make a database table for that model. If not, Django's ORM won't do anything to the

Re: need help in multy db.

2010-02-24 Thread chiranjeevi muttoju
Thank you Shawn. On Wed, Feb 24, 2010 at 11:58 PM, Shawn Milochik wrote: > Multi-DB support doesn't exist in 1.1 -- only 1.2 (still in beta). > > The "managed" attribute in the Meta tells Django whether it should handle > the model with its ORM. The default is True. If it's True, Django will mak

Re: Django in the enterprise?

2010-02-24 Thread Phlip
Steven Elliott Jr wrote: > Right now we have Java and ASP.NET doing most of the work for us but the > systems are old and need updating. Not to mention budgetary constraints are > big thing now. I used Django to write an intranet application and it was very > nice and I think I can probably han

Re: Django in the enterprise?

2010-02-24 Thread Phlip
> Err... What's an "enterprise application", actually ??? An app written for a company large enough to run an in-house programming team. Their job consists of figuring out how to connect diverse systems that never expected to be connected! -- You received this message because you are subscribed

Re: Lighttpd and Django

2010-02-24 Thread Eric Chamberlain
On Feb 23, 2010, at 8:56 PM, tsuraan wrote: > I'm trying to run django with lighttpd 1.4 and fastcgi. I'm using the > normal recipe that has a rewrite rule to convert all requests but a > few into requests for /foo.fcgi$1, and then I have the fastcgi server > tied to that base. The problem that

Re: Django in the enterprise?

2010-02-24 Thread Eric Chamberlain
On Feb 24, 2010, at 6:23 AM, Steven Elliott Jr wrote: > Dear friends, > I apologize for writing this type of question to the community but I would > appreciate any information you could pass on considering the breadth of > knowledge within this group. > I know that the word “enterprise” gives

Re: Django in the enterprise?

2010-02-24 Thread Steven Elliott Jr
@Philip Thanks for information -- very good advice. I appreciate all the input from everyone else as well. I intend to start using Django for almost everything going forward. Thanks, Steve On Feb 24, 2010, at 2:06 PM, Phlip wrote: > Steven Elliott Jr wrote: > >> Right now we have Java and AS

Re: Django in the enterprise?

2010-02-24 Thread Steven Elliott Jr
@Eric Chapman I know the term "enterprise" is pretty crappy but I didn't know how else to describe and I was hesitant to even throw it out there. I agree there are some seriously crappy "enterprise apps" out there, hell when i started working I inherited a ton! Anyway, thanks for the insight; I

how to capture the exception

2010-02-24 Thread harryos
hi In my models save() method I want to check if an Article with same name already exists. class Article(Model): name=models.CharField(max_length = 1024, unique = True) def save(self): self.name=self.name.strip() if Article.objects.filter(name__iexact=self.name).count()!=0:

Passing directory structure to template extending change_form

2010-02-24 Thread Timothy Kinney
I have a template which extends change_form.html and I want to display the same directory links that change_form.html displays. However, I'm not sure which dictionary values to pass in to accomplish this. The breadcrumbs section is: {% trans "Home" %} › {{ app_label|capfirst|escape }} ›

Re: how to capture the exception

2010-02-24 Thread Shawn Milochik
Note: As written, your code will never let you edit an existing Article. You should add an if statement to check whether 'self.pk' is true also. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to djang

Get id attribute in a form

2010-02-24 Thread leoz01
Hello, i have a simple question, how can i get the id attribute (which correspond to html id) from a form's field ? example : class MyModel(...): test = CharField(...) class MyForm(ModelForm): class Meta: model = MyModel I search for something like : f=MyForm() f.fields['test'].id

Re: Lighttpd and Django

2010-02-24 Thread tsuraan
> It's in the documentation at: > . Ok, I did see that, but I didn't understand it. I took the recomended setting, and put FORCE_SCRIPT_NAME='' into my settings.py, and it worked, but I do

Re: how to capture the exception

2010-02-24 Thread harryos
sorry, missed while copying def save(self): self.name=self.name.strip() if (not self.pk): if Article.objects.filter(name__iexact=self.name).count()! =0: raise Exception('article exists..') this causes 500 error,and causes the traceback displayed on browser..h

Lazy model load problem (0.96 -> 1.1 difference)

2010-02-24 Thread Eric Floehr
I am moving an application (finally) from 0.96 to 1.1.1 and I'm running into an issue I haven't been able to resolve. To make things simple, here are the two relevant models: class Station(models.Model): station_index = models.AutoField(primary_key=True) name = models.CharField() ...

Re: what is the name of your super class?

2010-02-24 Thread Chris Hunter
Using 2.6, what I saw was that I had to ask for __bases__ from the __class__ attribute of my object. So given your example, I'd check: c.__class__.__bases__[0].__name__ And for the immediate superclass, this also seems to work: c.__class__.__base__ Chris Hunter chun...@wondertwinpowers.net On

Re: Authentication issue

2010-02-24 Thread Les Smithson
request.user.is_anonymous() and django.contrib.auth.logout() respectively. On Feb 24, 2:36 pm, CrabbyPete wrote: > I have code that allows an anonymous user to look at some elses page, > but I want to limit what they can do so I have the following code > > def show(request): >      u = request.

Hierarchical data containing different models

2010-02-24 Thread Peter Reimer
Hi folks, I'm looking for a solution/tip for the following problem: I need to store hierarchical data, but, with two different kinds of objects (groups and items). I googled around and found the often suggested mptt package. It looks really great, but I'm not sure about the best way to save object

related objects

2010-02-24 Thread duplabe
Hi I have 2 models (plus django's built-in User model). class Profile(models.Model): user= models.OneToOneField(User,related_name='profile') friends = models.ManyToManyField(User,related_name='friends') class Image(models.Model): description = models.CharField(max_length=500, bla

Django comments moderation.py not rendering context

2010-02-24 Thread Igor Ganapolsky
I am utilizing django.contrib.comments to create an email message for each comment posted on my site. In moderation.py there is a method - def email(self, comment, content_object, request): """ Send email notification of a new comment to site staff when email notifications

transaction in django app desktop

2010-02-24 Thread ktemo
hi i working in a desktop app with django mysql, and wxpython, and i need to make transaction i read the doc online, but i dont know if is possible work with a desktop app -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Set language on per page basis

2010-02-24 Thread Tor Nordam
Thank you for your reply, Using the {% trans %} method is indeed what I intend to do. But the problem is how to set the language on a page basis, rather than as an installation-wide setting, or a user-selectable setting. On Feb 24, 6:55 pm, Timothy Kinney wrote: > I believe you want to use the {

Re: related objects

2010-02-24 Thread bruno desthuilliers
On 24 fév, 18:40, duplabe wrote: > Hi > > I have 2 models (plus django's built-in User model). > > class Profile(models.Model): >     user    = models.OneToOneField(User,related_name='profile') >     friends = models.ManyToManyField(User,related_name='friends') > > class Image(models.Model): >  

Re: Hierarchical data containing different models

2010-02-24 Thread bruno desthuilliers
On 24 fév, 18:08, Peter Reimer wrote: > Hi folks, > > I'm looking for a solution/tip for the following problem: I need to > store hierarchical data, but, with two different kinds of objects > (groups and items). That's something the relational model (at least in it's SQL implementation) is not

How can I add the Openid session data to the Django test client Client.post() ?

2010-02-24 Thread br...@instantdirectmarketing.com
I'm trying to test that a UserProfile model is created as a new User is registered in django_authopenid. I don't understand how to add the Openid session data to the POST. class UserTestCase(TestCase): def test_register_should_create_UserProfile(self): from django.test.client imp

Re: how to capture the exception

2010-02-24 Thread bruno desthuilliers
On 24 fév, 21:11, harryos wrote: > sorry, > missed while copying > > def save(self): >       self.name=self.name.strip() >       if (not self.pk): >           if Article.objects.filter(name__iexact=self.name).count()! > =0: >               raise Exception('article exists..') Now this will only

Re: Optimize large table view

2010-02-24 Thread bruno desthuilliers
On 24 fév, 17:43, Timothy Kinney wrote: > Bruno, *samurai *is a Japanese word that has been brought into English. The > only accepted spelling in English is *samurai* (according to the Oxford > English Dictionary), and this covers both singular and plural. At least I'll have learned something -

Question about methods

2010-02-24 Thread piz...@gmail.com
Hello, I'm trying to show the result of a model method in the admin view. My problem is that the dev server crashes with this error: Exception Value: 'PersonaAdmin.fieldsets[3][1]['fields']' refers to field 'age' that is missing from the form. I have the method 'age' inside a class named

custom validation for an inline formset, howto?

2010-02-24 Thread dan levine
I am trying to perform custom validation on an inline formset. The docs indicate that custom formset validation should go through a custom clean method: http://docs.djangoproject.com/en/1.1/topics/forms/formsets/#custom-formset-validation but the clean method doesn't get called for my instance o

Template Form Field Styles

2010-02-24 Thread Pugglewuggle
Hi, I'm making a form and would like to use CSS classes to give fields different styles based on validation events, i.e. error or not. I'm using the following code as of now. {% for field in form %} {% if field.errors %} {{ field.l

Re: Question about methods

2010-02-24 Thread Daniel Roseman
On Feb 24, 10:48 pm, "piz...@gmail.com" wrote: > Hello, > > I'm trying to show the result of a model method in the admin view. My   > problem is that the dev server crashes with this error: > > Exception Value:        'PersonaAdmin.fieldsets[3][1]['fields']' refers to   > field 'age' that is missi

Re: Question about methods

2010-02-24 Thread piz...@gmail.com
El 25/02/2010, a las 0:14, Daniel Roseman escribió: You can't use a method there. The form is for editing fields - it doesn't make sense to edit the result of a method call. -- DR. I've just missed that. If fact in the tutorial is in the list_display, not in the fieldsets. I've changed it a

Re: Set language on per page basis

2010-02-24 Thread Tor Nordam
After doing some further research, I have found the following: By writing a small piece of custom middleware, I can change the value of HTTP_ACCEPT_LANGUAGE. If I add this line to a process_request() request.META['HTTP_ACCEPT_LANGUAGE'] = 'no' then the webpage will be displayed with Norwegian tr

Re: Template Form Field Styles

2010-02-24 Thread jbergantine
One option is to use the field.errors logic to decide whether to wrap an error class around the input and then use descendent selectors to target the input element with CSS. (.error input { ... }). On Feb 24, 4:10 pm, Pugglewuggle wrote: > Hi, > > I'm making a form and would like to use CSS class

Redirecting to a different view after posting a form

2010-02-24 Thread Timothy Kinney
I have two views: samurai_detail add_item_to_samurai There is a button in samurai_detail that links to add_item_to_samurai. The templates are the same except that add_item_to_samurai includes a form to add an item. After posting the form, I want to redirect back to samurai_detail (the page withou

Re: Redirecting to a different view after posting a form

2010-02-24 Thread Timothy Kinney
I should have mentioned explicitly that these are admin views, not standard user views. I catch the url patterns for them in myproject/ urls.py. Maybe this changes how reverse must be used? -Tim On Feb 24, 6:15 pm, Timothy Kinney wrote: > I have two views: > samurai_detail > add_item_to_samurai

Re: non stop media player on site - similar to facebook chat

2010-02-24 Thread pjrhar...@gmail.com
If you watch the URL as you navigate facebook with the chat open you'll notice it doesn't actually change, just the fragment bit after the '#' does. I believe that the whole page minus the chat is just loaded asynchronously, and the url fragment is changed to match so that if you reload it it will

Model Inheritance - best practice for templates?

2010-02-24 Thread fgasperino
All, Currently I'm working with the following 2 models: class A (models.Model): ... class B (A): somefield = ... I have a generic views with querysets defined as: url(r"A/view/(?P\d+)/$", "django.views.generic.list_detail.object_detail", dict(queryset = A.objects.all(), template_name =

Re: Model Inheritance - best practice for templates?

2010-02-24 Thread fgasperino
mis-clicked, continuing: @register.filter def A_get_B(instance):     if isinstance(instance, B):         return instance.b     try:         return instance.b     except B.DoesNotExist:         return None and lastly, the template: {% with a|A_get_B as b %} {% if b %} .. work with b {% endif

Re: Django in the enterprise?

2010-02-24 Thread Kenneth Gonsalves
On Wednesday 24 Feb 2010 7:53:03 pm Steven Elliott Jr wrote: > I apologize for writing this type of question to the community but I would > appreciate any information you could pass on considering the breadth of > knowledge within this group. I know that the word “enterprise” gives some > peopl

Can I use request.user, in the limit_choices_to filter in Model class?

2010-02-24 Thread Luis Gonzalez
I need to filter a field by a UserProfile function, i.e. how can I do something like this? class Paquet(models.Model): ... profiles = models.ManyToManyField(UserProfile, limit_choices_to = {'country': request.user.userprofile.country}) Thanks in advance. -- _

PicklingError with Queryset Refactor

2010-02-24 Thread Tim Valenta
There was a topic on this a couple of years ago, and it seems to still be around. (Original: http://groups.google.com/group/django-users/browse_thread/thread/32143d024b17dd00?pli=1) An exception is raised when trying to use the low-level caching API on a QuerySet. I read from the mentioned thre

Re: Template Form Field Styles

2010-02-24 Thread Pugglewuggle
Can you please provide an example? I don't quite get what you mean. I appreciate the quick response btw! On Feb 24, 5:44 pm, jbergantine wrote: > One option is to use the field.errors logic to decide whether to wrap > an error class around the input and then use descendent selectors to > target

Re: PicklingError with Queryset Refactor

2010-02-24 Thread Tim Valenta
H... I need to redact my statement about pickling working on the filesystem cache back-end. On one particular Windows development machine it works, but not on a linux box with identical code on Apache. Which leaves me in an even more strange situation... why does the development server's pick

Re: Template Form Field Styles

2010-02-24 Thread kkerbel
@jbergantine I'm curious about this too...could you elaborate? On Feb 24, 5:44 pm, jbergantine wrote: > One option is to use the field.errors logic to decide whether to wrap > an error class around the input and then use descendent selectors to > target the input element with CSS. (.error input

  1   2   >