Re: save sometime cause duplicate data

2008-01-03 Thread Eratothene
This can happen of you multiple times price submit button on the page. That is why it is recommended to issue HttpRedirect after POST. Read carefully: http://www.djangoproject.com/documentation/tutorial04/ On Dec 21 2007, 10:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I start only

Re: Check constraint in models

2007-12-27 Thread Eratothene
consider using django add-on django-check-constraints http://code.google.com/p/django-check-constraints/wiki/Features On Dec 26, 12:34 am, [EMAIL PROTECTED] wrote: > Hello, > > Having the following (Postgre)SQL statement: > > CREATE TABLE Games ( >   minPlayer integer NOT NULL DEFAULT 1, >  

Re: Check constraint in models

2007-12-27 Thread Eratothene
django-check-constraints On Dec 26, 12:34 am, [EMAIL PROTECTED] wrote: > Hello, > > Having the following (Postgre)SQL statement: > > CREATE TABLE Games ( >   minPlayer integer NOT NULL DEFAULT 1, >   maxPlayer integer NOT NULL DEFAULT 1, >   CHECK (min_player <= max_player) > ) > > the

Re: Templates, filesystem, caching?

2007-12-23 Thread Eratothene
Hi forgems! Your snippet requires to restart django each time the templates have changed. Did you try to add checking of template file modification date in order automatically invalidate cache? What it is performance of such implementation? Adding this kind of mechanism will increase performace

Re: How to make such query with django ORM?

2007-11-29 Thread Eratothene
> Here's a solution that should give you a list (not a QuerySet) of all > the blogs. Don't know if this is best practice though. You can get all > blogs of a user with: > user.blog_set.all() > From this QuerySet you want only these without articles: > blogs = [] > for blog in user.blog_set.all():

How to make such query with django ORM?

2007-11-27 Thread Eratothene
Hi django users! I have two simple models: Blog and Article. class Blog(models.Model): title = models.CharField() content = models.TextField() user = models.ForeignKey(User) class Article(models.Model): title = models.CharField() content = models.TextField() blog =

Re: Django, CherryPy and threading

2007-08-30 Thread Eratothene
I am running CherryPy 3.0.1 with django + nginx for static content on my production server for several months without any issues. It also shows very well perfomance, even better than apache/mod_python and very small memory usage. Ideal solution! On Aug 28, 6:39 pm, Justin Johnson <[EMAIL

Re: Using SQL aggregates

2007-08-30 Thread Eratothene
I know two options for you: 1. First use django-simpleaggregation plugin, you canfind it on googlecode.com 2. Or use raw sql to do it. This is example how I count entries in each blogs blogs = Blog.objects.all().extra(select={'article_count': "SELECT COUNT(*) FROM blog_article a WHERE

Re: Cache middleware causing unit tests to fail

2007-08-18 Thread Eratothene
I think you better not disable cache middleware in tests. If tests fail, so will be in production. I had similar problem, I thought it was something wrong with tests, but really it was problem in the code. My site was running well on django built-in server, but not on apache mod_python. The

Re: Tagcloud for *all* TaggedItems

2007-08-16 Thread Eratothene
Era! > > On 8/15/07, Eratothene <[EMAIL PROTECTED]> wrote: > > > [Code] > > I think I will create a ticket. Maybe Jonathan can integrate > such a function directly into django-tagging. --~--~-~--~~~---~--~~ You received this message because you a

Re: CacheMiddleware and middleware orders matters

2007-08-16 Thread Eratothene
/5176 On 16 авг, 02:46, "Kai Kuehne" <[EMAIL PROTECTED]> wrote: > Hi Erarothene, > > On 8/16/07, Eratothene <[EMAIL PROTECTED]> wrote: > > > > > I am totally confused with CacheMiddleware docs and middleware docs. > > > I want to use su

CacheMiddleware and middleware orders matters

2007-08-15 Thread Eratothene
I am totally confused with CacheMiddleware docs and middleware docs. I want to use such middlewares in project: ConditionalGetMiddleware GZipMiddleware - addes Vary on Accept-Encoding SessionMiddleware - addes Vary on Cookie CacheMiddleware - I am trying to find correct order for this

Re: Tagcloud for *all* TaggedItems

2007-08-15 Thread Eratothene
For that I have written by own function, put it where is usage_for_model is located def usage_for_models(self, Models=[], counts=False, min_count=None): """ @param Model: the list of models to count. Empty list means all models. Inspired by usage_for_model, I

domain name based URL dispatch

2007-07-25 Thread Eratothene
I really enjoy django regex-based urlpatterns, but I ran onto the trouble how to realize such functionality, site uses a lot of domain name URL dispatch. Some thing like this: blogs.mysite.com/PATH wikis.mysite.com/PATH tags.mysite.com/PATH And so on. How to make such in django, need something

Host-based url dispatch

2007-07-24 Thread Eratothene
I ran into the problem of Host-based url dispatch. I need to make something like this: urls.py: if request.META["HTTP_HOST"] = 'blogs.example.com' urlpatterns += (Some patterns) if request.META["HTTP_HOST"] = 'wikis.example.com' urlpatterns += (Abosolute different patterns) I have no

Re: Blog engine

2007-07-17 Thread Eratothene
There a lot of other features missing in such solution: comments, spam protection, rss feeds and a lot more. I am searching for full featured blog engine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

Blog engine

2007-07-17 Thread Eratothene
Please, recommend me some full featured blog engines developed in django. Though, I have found some posts in this user group about available blog engines, I still want to ask this question, as all posts are dated summer 2006. --~--~-~--~~~---~--~~ You received

Re: How to make dictionary out of model instance

2007-07-16 Thread Eratothene
Really dirty way! But IT DOES WORK, and it is so simple. Thanks a lot Ben van Staveren --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

How to make dictionary out of model instance

2007-07-16 Thread Eratothene
I need to make dictionary out of django.auth.model.User instance in such format: {'username':'val1', 'password':'val2', 'email':'', 'first_name':'val3', 'last_name':'val4' ...} In order to populate this data in to the custom form. I have read all documentation available in order to resolve this

Re: Two huge forms delema

2007-07-16 Thread Eratothene
It did worked! class A(forms.Form) a = field b = field class B(A) c = field def __init__(self): super(B, self).__init__() del self.fields[a] On Jul 15, 7:49 pm, Nathaniel Whiteinge <[EMAIL PROTECTED]> wrote: > I don't have much experience with sub-classing forms, but I suspect

Re: Two huge forms delema

2007-07-15 Thread Eratothene
Fixed examples mistakes: class A(forms.Form) a = field b = field class B(A) del a # Is there working equivalent for this? c = field Hence, class B inherited only a field b, but not a. --~--~-~--~~~---~--~~ You received this message because you are

Two huge forms delema

2007-07-15 Thread Eratothene
A have two newform classes, each with more than 80 fields. Two forms has a lot of common fields, but not all. In order not to maitain two sets of fields instead of one I have created third form, which is base for inheritance to this two, but then the order of fields in the form is determined by