Re: field mapping to multiple columns?

2009-10-07 Thread J. Hall of Carlisle MA
You bring up a very interesting question It seems to make little sense to put this kind of data into a table of it's own. The ORM usually maps a class to a table. in this case you want to map the class to a group of columns in a single table. How do you use a class based compound data type and s

Re: Sites module, URLs and templates

2009-10-07 Thread Joseph Wakeling
On Oct 4, 2:39 pm, Kristaps Kūlis wrote: > Hi! >  You can make settings for each site easily > first_settings.py > from settings import * > SITE_ID = 1 > TEMPLATE_DIRECTORIES = ( [ ] ) > [ other settings, which needs to be overrided ] > > you can also override urls, etc with revelant settings.

Re: Lighttpd Vs Apache

2009-10-07 Thread Indu
> And mod_wsgi has less performance/memory overheads than mod_python. > One can't really compare mod_python andfastcgimemory usage as they > have different ways of working. Performance comparisons are also > difficult as which server is used and how it is configured can > influence it. > > FWIW, i

Re: Is django comment's honeypot really useful?

2009-10-07 Thread Kenneth Gonsalves
On Thursday 08 Oct 2009 9:32:23 am Joshua Partogi wrote: > I want to ask for your advice here regarding the honeypot field in > django comments. Is it really useful to prevent spam? Or should we add > another method for spam prevention and shouldn't really rely on this > honeypot. I currently been

Re: One to Many on Template UI

2009-10-07 Thread robinne
Wow, that worked, thank you! I thought I had tried everything. I was able to loop child items on the UI template with {% for item in mymembers.products_set.all %} ... On Oct 6, 9:54 pm, hcarvalhoalves wrote: > On 7 out, 01:23, robinne wrote: > > > I have my model setup with foreign key relation

Is django comment's honeypot really useful?

2009-10-07 Thread Joshua Partogi
Hi all, I want to ask for your advice here regarding the honeypot field in django comments. Is it really useful to prevent spam? Or should we add another method for spam prevention and shouldn't really rely on this honeypot. I currently been getting several spams on my site but I'm not sure wheth

Re: is this an i18n bug or a feature?

2009-10-07 Thread Kenneth Gonsalves
On Thursday 08 Oct 2009 7:05:27 am Karen Tracey wrote: > On Wed, Oct 7, 2009 at 8:15 PM, Kenneth Gonsalves wrote: > > hi, > > > > I recently added malayalam to an app I run - unfortunately Malayalam does > > not > > load. (Tamil and english work fine). I then found that django itself does > > not

Re: is this an i18n bug or a feature?

2009-10-07 Thread Karen Tracey
On Wed, Oct 7, 2009 at 8:15 PM, Kenneth Gonsalves wrote: > > hi, > > I recently added malayalam to an app I run - unfortunately Malayalam does > not > load. (Tamil and english work fine). I then found that django itself does > not > have malayalam. That deficiency is being rectified, but in the me

Re: Why doesn't Django display template line number of errors?

2009-10-07 Thread Karen Tracey
On Wed, Oct 7, 2009 at 5:38 PM, NealWalters wrote: > > Any ideas on this question from about a month ago? > It was answered. Django does display the line number, along with the line in error and surrounding lines, in the Django debug page. If Google App Engine doesn't do that (don't you get Dja

field mapping to multiple columns?

2009-10-07 Thread akonsu
hello, i need a datetime field with an associated precision value. the precision shows which parts of the datatime field are used. in other words, my datatime field can contain just a year, or a year and a month, etc. similar to postgres' DATE_TRUNC function. i know i can just throw in two fields

Re: QuerySets with annonate, count() and multiple fields

2009-10-07 Thread Russell Keith-Magee
On Thu, Oct 8, 2009 at 1:43 AM, Emily Rodgers wrote: > > Hello, > > I am a bit stuck on something that I think ought to be really easy (so > I am probably being really stupid!). > > I am trying to write a view for a model such that I can pass the view > (via post data) a (or an unknown) number of

Re: questions about model attribute permissions set in django admin

2009-10-07 Thread Allen
Is there a way to implement this in the django admin app? I don't want to create a custom form or view, I want to use the default form and view that djang admin provide. Thanks! On Oct 8, 2:12 am, Scott wrote: > I'm looking for the same kind of thing, I think you will have to > create a custom

is this an i18n bug or a feature?

2009-10-07 Thread Kenneth Gonsalves
hi, I recently added malayalam to an app I run - unfortunately Malayalam does not load. (Tamil and english work fine). I then found that django itself does not have malayalam. That deficiency is being rectified, but in the meantime why should malayalam not load? I tried to create ~/locale/ml/L

Re: ORM Cache in a standalone script

2009-10-07 Thread Karen Tracey
On Wed, Oct 7, 2009 at 7:39 PM, laligatz wrote: > > Hi everybody. > > I'm stuck on a problem with the Django ORM. > After a basic query like select * from table where id = 1, the result > is still the same although i've update the row in the DB. > > Example: > > >>> Tag.objects.all() > [] > > >>>

ORM Cache in a standalone script

2009-10-07 Thread laligatz
Hi everybody. I'm stuck on a problem with the Django ORM. After a basic query like select * from table where id = 1, the result is still the same although i've update the row in the DB. Example: >>> Tag.objects.all() [] >>> tag = Tag.objects.all().get() >>> tag >>> tag.name = 'tag11' >>> t

Re: Django with Cherokee web server

2009-10-07 Thread Oli Warner
> > People quite happily run Django on memory starved VPS systems using > Apache/mod_wsgi *with optional nginx front end* for static files. > Apache is woefully slow and inefficient at static serving. A static reverse proxy is not optional for sane people. And I'd rather just admin one server. -

Re: Django with Cherokee web server

2009-10-07 Thread Graham Dumpleton
On Oct 8, 9:38 am, Oli Warner wrote: > On Wed, Oct 7, 2009 at 5:34 AM, hcarvalhoalves > wrote: > > > I wanted to know if someone here on the list is using or used Cherokee > > with Django, if there's any performance improvements over Apache + > > mod_wsgi/mod_python (specially for concurrent r

Re: Django with Cherokee web server

2009-10-07 Thread Oli Warner
On Wed, Oct 7, 2009 at 5:34 AM, hcarvalhoalves wrote: > I wanted to know if someone here on the list is using or used Cherokee > with Django, if there's any performance improvements over Apache + > mod_wsgi/mod_python (specially for concurrent requests), and if there > are any gotchas with Django

Re: Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
I found a solution off of stack overflow. I had to bind an instance to the form when editing. So I changed the following line: form = ProjectForm(request.POST, instance=project) It seems to work and is in testing. On Oct 7, 5:40 pm, Streamweaver wrote: > Some more information. The view method

Re: Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
Some more information. The view method to save the item is as follows: def update_project(request, slug): '''Method for editing already existing projects.''' project = get_object_or_404(Project, slug=slug) if request.method == 'POST': # If form was submitted run it through. f

Re: Why doesn't Django display template line number of errors?

2009-10-07 Thread NealWalters
Any ideas on this question from about a month ago? Thanks, Neal --~--~-~--~~~---~--~~ 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

Unique Fields and form submission validation

2009-10-07 Thread Streamweaver
The title field in my model is set to unique and when I use a form to edit this I get an error that an item with this value already exists. As I understand it this is because ModelForm throws an error when I call form.is_valid() and all information I can find tells me to override the clean method

Re: Admin why deleting related(null=True) objects?

2009-10-07 Thread Peter Sagerson
Yes, Django always cascades deletes. There's talk about providing more options in a future release, but for now it's kind of a problem. I generally find this behavior potentially catastrophic, so I wrote an intermediate model base class that clears all nullable foreign keys before deleting

Re: Models for a hockey database

2009-10-07 Thread Curt
Instead of including every player in the Game model, I would add a field to the Player model to assign which team a player belongs to: class Team(models.Model): name = models.CharField(max_length=60) class Player(models.Model): surname = models.CharField(max_length=60) lastname = mod

Re: Models mixins/inheritance

2009-10-07 Thread Eugene Mirotin
OK, I've tried the proxy models and they solved part of my problems. But not all. Consider I have an auto-generated model called COmpany which I have manually (and can then make it automatically) renamed to CompanyAuto. I have created the Company proxy model for the CompanyAuto model and added th

Re: Two cache-related questions

2009-10-07 Thread kmike
> appropriate cache_prefix function oops, key_prefix, not cache_prefix :) On 8 окт, 01:35, kmike wrote: > 1. Maybe you can use django's Vary support > (http://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers > ). This > will work if you have language preferences in http headers.

Re: inline queryset dependant on runtime data

2009-10-07 Thread sico
Also, any change in the Link from_hub or to_hub will result in the form being reloaded so no need to change the dropdown lists after being loaded On Oct 8, 9:22 am, sico wrote: > by the way, I'm using django 1.0.2  but am not against upgrading > if it helps me solve this problem! > > On

Re: inline queryset dependant on runtime data

2009-10-07 Thread sico
by the way, I'm using django 1.0.2 but am not against upgrading if it helps me solve this problem! On Oct 7, 3:36 pm, sico wrote: > Suppose I have 4 models as below: > > class Hub(models.Model): >     name = models.CharField("Name", ) >     something-else = models.CharField("Something", )

Re: Two cache-related questions

2009-10-07 Thread kmike
1. Maybe you can use django's Vary support ( http://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers ). This will work if you have language preferences in http headers. If you only set language cookie (or store language preferences in sessions) then you can use http://bitbucket.org/k

Re: Two cache-related questions

2009-10-07 Thread kmike
1. Maybe you can use django's Vary support (http:// docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers). This will work if you have language preferences in http headers. If you only set language cookie (or store language preferences in sessions) then you can use http://bitbucket.org/km

Re: Django comments

2009-10-07 Thread cirip
Mike, I find it very limiting that by default comments can be made on database objects only. Another limitation that I hit is that I can't comment on comment. It is failing at least for me. I will probably implement whole comments myself. Thanks again, Tomas On Oct 6, 5:43 pm, kmike wrote: >

Re: Getting former value of altered field when saving model

2009-10-07 Thread Nan
It should work in pre_save, but by the time you reach post_save, the database ID will be associated with the new values. On Oct 7, 1:32 pm, Aaron wrote: > On Oct 7, 2:14 pm, Nan wrote: > > > class Foo(models.Model): > > bar = models.IntegerField() > > > def save(self, force_insert=Fals

Nullable GenericForeignKey?

2009-10-07 Thread ringemup
When I try to set null=True on a GenericForeignKey field, I get a TypeError: __init__() got an unexpected keyword argument 'null'. Does this mean that GenericForeignKeys can't be null, or does it mean that their nullability is automatically determined by the nullability of their content_type and

Re: filter to wrap content in html tags

2009-10-07 Thread kelley....@gmail.com
The answer is at http://groups.google.com/group/django-users/browse_thread/thread/5d5a6c5b511ca96 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-user

Re: questions about model attribute permissions set in django admin

2009-10-07 Thread Scott
I'm looking for the same kind of thing, I think you will have to create a custom form or view and do something like if request.user.has_perm('some_custom_perm') show field --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gr

Two cache-related questions

2009-10-07 Thread Christophe Pettus
Chatting with a client last night, two Django cache-related questions came up... 1. Is there any convenient way of using the @cache_page decorator while caching separate versions by language using the Localization facilities? It seems that it will cache the first access, and return it re

filter to wrap content in html tags

2009-10-07 Thread kelley....@gmail.com
INTRODUCTION. I wrote a filter to wrap content in tags, with different classes for different types of content. (It's to code command/response dialogues in the R language.) I've got the filter working fine, but the results are being altered to change the "<" into "<" and so forth. I guess that

QuerySets with annonate, count() and multiple fields

2009-10-07 Thread Emily Rodgers
Hello, I am a bit stuck on something that I think ought to be really easy (so I am probably being really stupid!). I am trying to write a view for a model such that I can pass the view (via post data) a (or an unknown) number of fields of that model, and receive back a list of dictionaries of di

Year/month archive help

2009-10-07 Thread icrismariu
Hello, i'm new to Django and started an application, i did the models, views, templates, but i want to add some kind of archive to the bottom of the page, something like this http://www.flickr.com/photos/ionutgabriel/3990015411/. My model looks like this: class Post(models.Model): titlu

Re: Getting former value of altered field when saving model

2009-10-07 Thread Aaron
On Oct 7, 2:14 pm, Nan wrote: > class Foo(models.Model): >     bar = models.IntegerField() > >     def save(self, force_insert=False, force_update=False): >         if self.id: >             # this is an update rather than a new instance >             old = Foo.objects.get(pk=self.id) >          

Re: where can I find email alert functionality

2009-10-07 Thread Fred Chevitarese
I'm looking for this too, but had no success... I'll have to made your own ... http://chevitarese.wordpress.com Fred Chevitarese - GNU/Linux 2009/10/6 Norman > > hello, > > I look for email alert functionality, where readers sign up to get > notifications when news happens. But I can't find a

Re: Getting former value of altered field when saving model

2009-10-07 Thread Nan
class Foo(models.Model): bar = models.IntegerField() def save(self, force_insert=False, force_update=False): if self.id: # this is an update rather than a new instance old = Foo.objects.get(pk=self.id) # DO STUFF super(Foo, self).save(fo

Re: Django and ZSI

2009-10-07 Thread Fred Chevitarese
Hello all!! I've been looking for a while in this group, then i find this message... Anyone has an example of python/Django with ZSI, suds, Soappy or another that exists ? I'm looking for anything but the documentation is not good... If anyone has a piece of code to take a look it would be appreci

Re: ORM

2009-10-07 Thread Christophe Pettus
On Oct 7, 2009, at 2:30 AM, Geobase Isoscale wrote: > I intend to write ORM code that will create views and triggers in > the database? Which parts of the source code should I alter? Django can work just fine with views and triggers, but the Django ORM layer will not create them for you. V

Getting former value of altered field when saving model

2009-10-07 Thread Aaron
I have a model with a particular field I'm interested in. If that field is altered, I want to be able to access the former value of that field (as well as the new value). I've looked at pre_save() signals, models, and fields, and it seems that I am only able to access the current (new) value of t

Re: Django with Cherokee web server

2009-10-07 Thread Leonel Nunez
> Thanks for the advice, but I already know how to optimize django apps > (documentation covers this well), so I'm not seeking advice on this. > Neither I'm willing to use Cherokee so I get a magic performance boost > for my app alone (while it is indeed faster than Apache for serving > static con

Re: Django with Cherokee web server

2009-10-07 Thread hcarvalhoalves
Thanks for the advice, but I already know how to optimize django apps (documentation covers this well), so I'm not seeking advice on this. Neither I'm willing to use Cherokee so I get a magic performance boost for my app alone (while it is indeed faster than Apache for serving static content). In

questions about model attribute permissions set in django admin

2009-10-07 Thread Allen
Hi, all: I am working on a project with django, I have encounter a problem and searched it in google, but didn't find any solution: I have two users can login django admin, and I have a model with some attributes. one of the users is site admin and the other is a normal users, both of the

Re: Django and ZSI

2009-10-07 Thread Janusz
HI, I have an additional question to this topic: how exactly do you deploy ZSI-generated web services from within Django? BR/Janusz On Sep 2, 2:37 am, Julián C. Pérez wrote: > Thanks > > On Aug 31, 3:22 pm, Antoni Aloy wrote: > > > > > 2009/8/31 Julián C. Pérez : > > > > Anyone has experience w

Re: Models mixins/inheritance

2009-10-07 Thread Eugene Mirotin
I have tried it earlier and (as far as I remember) with the same (void) result. I have read more docs and proxy models seem to be the solution to my problem. I will give them a try later today. On Oct 7, 2:54 pm, greatlemer wrote: > What sort of errors are you getting when you try this with the

Redirects and nested URLs

2009-10-07 Thread Aaron
Is the redirects app able to handle nested URLs? For example, if I have /foo/, and I also have /foo/bar/, would adding a redirect from / foo/ to /baz/ also create a redirect from /foo/bar/ to /baz/bar/? --~--~-~--~~~---~--~~ You received this message because you are

Admin why deleting related(null=True) objects?

2009-10-07 Thread x_O
Hi My question that I'm getting right that situation. I've two models: class First(db.models): second_item = models.ForeignKey('Second',null=True) ... class Second(db.models): ... I've both models registered in admin.py as AdminModels. Why when I'm trying to delete some object cre

Re: Add some fields on form.save()

2009-10-07 Thread Bogdan I. Bursuc
If you want to set the status field on the model after you save the form, you can do something like this: msg_instance = form.save(commit=False) msg_instance.status = 'F' msg_instance.save() # don't forget the save, because the form didn't # save the model On Wed, 2009-10-

Add some fields on form.save()

2009-10-07 Thread valler
Hello. I can't understand how I can add some extra fields on form saving. Here is a simple example: class Msg(models.Model): title = models.CharField(max_length=30) message = models.CharField(max_length=100) status = models.CharrField(max_length=1,null=True,blank=True) class MsgForm(Mode

Re: ORM

2009-10-07 Thread Jani Tiainen
Geobase Isoscale kirjoitti: > I have to live with this reality, maybe in future we might develop a > code to extend Django to support views and triiggers. I don't get the use case here. What is this need for adding views and triggers? What purpose they serve for ORM? For database they're pre

Re: Getting model's ID in save() method

2009-10-07 Thread Aaron
On Oct 6, 4:48 pm, Karen Tracey wrote: > I showed it from the shell because that's easiest to demonstrate.  But it > also works for the model you have included here even from admin.  If it's > not working for the model you actually have then it is due to some > difference between what you have po

Re: ORM

2009-10-07 Thread Geobase Isoscale
I have to live with this reality, maybe in future we might develop a code to extend Django to support views and triiggers. Many Thanks Isoscale --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group.

Re: Models mixins/inheritance

2009-10-07 Thread greatlemer
What sort of errors are you getting when you try this with the django model? Have you tried just assigning the function over the top of the __unicode__ function already on Company? i.e. import Company def CompanyUnicode(self): return '%s [%s]' % (self.nick, self.legal_name) Company.__unic

Re: Models mixins/inheritance

2009-10-07 Thread Eugene Mirotin
Let me provide more details. When I make simple python project with the same idea, everything works fine. # file test2.py class A: b = 2 # file test1.py from test2 import * class A(A): a = 1 # file test.py from test1 import * a = A() print a.b, a.a print A.__module__ The output

Re: ORM

2009-10-07 Thread Russell Keith-Magee
On Wed, Oct 7, 2009 at 5:30 PM, Geobase Isoscale wrote: > Hi Everyone, >  I intend to write ORM code that will create views and triggers in the > database? Which parts of the source code should I alter? This is the third time you've asked the same question in less than a week. I answered the fir

Re: ORM

2009-10-07 Thread Jani Tiainen
Geobase Isoscale kirjoitti: > Hi Everyone, > > I intend to write ORM code that will create views and triggers in the > database? Which parts of the source code should I alter? None... There already exists mechanism to run arbitary SQL after syncdb... Or did you meant something else since I'

ORM

2009-10-07 Thread Geobase Isoscale
Hi Everyone, I intend to write ORM code that will create views and triggers in the database? Which parts of the source code should I alter? Many Thanks Isoscale --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Djan

Re: Unhandled IntegrityError caused by setting unique_together over DateField and SlugField

2009-10-07 Thread Michiel
Hi, Yes, I am adding instances via the admin. I suspected the field not being on the form was the cause of there being no nice error message. Thanks for confirming this. I guess to best (and only?) way to deal with this now is to add my own validation to the form clean() method and inform the u

Re: Getting django working on jython/modjy/jetty

2009-10-07 Thread Arto Vuori
Solved. Passing the webapps directory of Jetty to the python.path via modjy servlet parameters in WEB-INF/web.xml helped. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, se