Re: Anything like RoR's render :partial?

2009-11-15 Thread Михаил Лукин
There is also "with" tag, it may be useful for such thing 2009/11/15 apramanik > Awesome! Thanks for the clarification. > > Abhik > > On Nov 15, 10:48 am, Dennis Kaarsemaker > wrote: > > On zo, 2009-11-15 at 10:08 -0800, apramanik wrote: > > > > > Sure in most cases, but is there a way to fake

Re: Triggen after insert on auth_user, crash the add new user with this error: InternalError at /operators/ current transaction is aborted, commands ignored until end of transaction block

2009-11-11 Thread Михаил Лукин
Why don't you use Django signals [1] for this? [1] http://docs.djangoproject.com/en/dev/topics/signals/ 2009/11/11 NMarcu > > Hello all, > > I have a section for adding new user, on auth_user table (default > django auth method), and work just fine. I added a trigger on that > event, to add s

Re: annotation with filter issue (left join needed)

2009-11-10 Thread Михаил Лукин
It seems that you're right :( raw SQL takes away most of benefits of ORM 2009/11/10 akaariai > > > > On Nov 10, 8:29 am, Михаил Лукин wrote: > > Well, I didn't find solution yet. Except that filter condition must be > > placed in LEFT OUTER JOIN ...

Re: annotation with filter issue (left join needed)

2009-11-09 Thread Михаил Лукин
use it for such purpose. Any suggestions? 2009/11/6 Михаил Лукин > Hi Djangoers > > There is two models: task and report on this task. > > class Task(models.Model): > # some task fields here > > class Report(models.Model): > task = models.ForeignKey(Task) > tim

Re: render_to_response taking 50 seconds!

2009-11-03 Thread Михаил Лукин
I strongly suggest you to use pagination here. 2009/11/3 Low Kian Seong > > I have about 3k plus record in my db table and am trying to do a > simple render_to_response of a template sending it the results of a > query. I debugged this and found that the total time taken for an > operation like

Re: Apache2+mod_wsgi autoreload?

2009-10-21 Thread Михаил Лукин
Thanks a lot, it works perfect :) 2009/10/21 Graham Dumpleton > > > > On Oct 21, 5:07 pm, Graham Dumpleton > wrote: > > On Oct 21, 4:00 pm, Михаил Лукин wrote: > > > > > ./manage runserver is OK for debugging purposes... unless you use > > >

Apache2+mod_wsgi autoreload?

2009-10-20 Thread Михаил Лукин
./manage runserver is OK for debugging purposes... unless you use server-specific features, in my case - NTLM authentication. When deploying Django project with Apache2+mod_wsgi, I need to `rcapache2 reload` to apply changes in Python modules (while `manage runserver` does this automaticaly). This

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
Actually, I told about server-side form processing, not client-side. When client posts data, I always check permissions in a VIEW that receives it. 2009/10/20 Mike Ramirez > On Tuesday 20 October 2009 11:47:51 Михаил Лукин wrote: > > > Next, we don't want 'edit' a

Re: DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
Good idea, thanks Javier. 2009/10/20 Javier Guerra > > On Tue, Oct 20, 2009 at 1:47 PM, Михаил Лукин > wrote: > > What is your best practice in such situations? > > write a custom tag > > -- > Javier > > > > -- regards, Mihail --~--~-

DRY (or how can I stop repeating myself)

2009-10-20 Thread Михаил Лукин
There is a couple of models in auth application to check user permissions in Django. But sometimes we need to grant permissions per instance, not per model. Example: *class Employee(django.contrib.auth.models.User): pass class Task(models.Model): summary = models.CharField(max_length=50) des

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
As I said in my first post, I understand that all three ways are correct. I just wanted to know "the best", which means that it should always give the same results and should not be deprecated in the future. If I understand you correctly, "=None" is most recent implementation of "is null" and (for

Re: "...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
For some reason, __exact and __isnull are described in documentation [1], while =None is not. So which of them are historical? [1] http://docs.djangoproject.com/en/dev/topics/db/queries/#topics-db-queries 2009/10/20 Russell Keith-Magee > > These three queries are all exactly the same, and if yo

Re: ManyToMany lookups

2009-10-20 Thread Михаил Лукин
As I know, each category has attribute product_set 2009/10/20 ausi1972 > > I am trying to work out how to construct a queryset that contains > multiple records for a ManyToMany field. > > The models are like this: > class products(models.Model) >name = models.CharField() >categories = mo

"...where field is NULL" in Django ORM

2009-10-20 Thread Михаил Лукин
There is three ways to select NULL records from table with Django ORM: 1. Model.objects.filter(field=None) 2. Model.objects.filter(field__exact=None) 3. Model.objects.filter(field__isnull=True) They all seem to work. Which is the best way and why? -- regards, Mihail --~--~-~--~~---

Re: Join .Net Community

2009-10-20 Thread Михаил Лукин
burn in hell 2009/10/20 Shawon_ > > Join .Net Community > > This group represents the Microsoft .Net community. All .net > programmers all around the world are welcome here. In this group > you'll find the latest releases of .Net related products, frameworks, > Upgradation, technologies, IDEs et

Re: Best way to generate a local file from a models + views ?

2009-10-19 Thread Михаил Лукин
For purpose of generating apache config files I would recommend to use management commands [1], so that you could generate config like this: ./manage genconf --server apache2 > /etc/apache2/vhosts.d/myapp.conf where genconf is your custom management command. [1] http://docs.djangoproject.com/en/de

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-19 Thread Михаил Лукин
e :) 2009/10/19 tezro > > Surely I could use the list_detail.object_list, but the use of date > based generics though )) > > > On Oct 18, 11:45 pm, Михаил Лукин wrote: > > Sorry, didn't look at condition well...:( > > > > So, you see the source and you

Re: "django-pagination" and generic.views.date_based.archive_index()

2009-10-18 Thread Михаил Лукин
Sorry, didn't look at condition well...:( So, you see the source and you see that there's no way to get all the records with this view. Why don't you use list_detail.object_list view? If you need just to order list by date, you can use ordering on the model level: http://docs.djangoproject.com/en/

Re: Django production set up woes [Please Help]

2009-10-18 Thread Михаил Лукин
http://docs.djangoproject.com/en/dev/howto/deployment/ Choose your deployment method and you'll find the answer 2009/10/18 DjangoRocks > > hi, how do i put the project's path in my server pyhton path ? > > On Oct 19, 2:36 am, Михаил Лукин wrote: > > Seems that y

Re: Django production set up woes [Please Help]

2009-10-18 Thread Михаил Лукин
Seems that you didn't put your project's path in your server python path. 2009/10/18 DjangoRocks > > Hi yes, i restarted apache after uploading my files. > > Just in case, here is the error message i received: > ViewDoesNotExist at /user/eugene/ > > Could not import crud.views. Error was: No mod

Re: How to enforce uniqueness based on two model fields

2009-10-18 Thread Михаил Лукин
http://docs.djangoproject.com/en/dev/ref/models/options/#unique-together why don't you like to read docs first. Django docs are amazing! 2009/10/18 Guillermo > > Ok I've done the following: > > def save(self): >r = TargetMessage.objects.filter(src_fk=self.src_fk, >

Re: Linking items from the same model

2009-10-18 Thread Михаил Лукин
Look at how list of permissions is filtered in admin interface when adding/editind user. You may use such javascript in your form for dynamic filtering. 2009/10/17 Oleg Oltar > I would really want to add some sort of filtering to that > http://img.skitch.com/20091017-mfs2mbhbuudk2rgquium1bu61d.p

Unable to serialize database: User matching query does not exist.

2009-10-18 Thread Михаил Лукин
In application `tasks` there is model `Employee` which is subclass of django.contrib.auth.models.User. I can `dumpdata tasks`, but when I try to dump whole project or `auth` application, I get this: django.contrib.auth.models.DoesNotExist: User matching query does not exist. > I checked twice if

Re: Help to choose web-template

2009-10-16 Thread Михаил Лукин
e following sites: > > > http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/ > http://www.alistapart.com/articles/holygrail/ > http://www.webmonkey.com/codelibrary/tag/html > > Cheers > > _Mario > > On Oct 16, 1:20 pm, Михаил Лукин wrot

Re: Good News !! A mate found for your dog ...

2009-10-16 Thread Михаил Лукин
It's the dog. The dog is the one who uses Django. All the time. On Fri, Oct 16, 2009 at 9:18 PM, jc wrote: > > Finally. I wonder if their site uses django? > > On Fri, Oct 16, 2009 at 7:36 AM, turk970 wrote: > > > > You love your dog and your dog love’s you! > > > > > > Give your dog the oppor

Help to choose web-template

2009-10-16 Thread Михаил Лукин
Not really Django question, so i'm sorry :) I'm Python programmer, not a web-designer. I wasted a whole day by reinventing the wheel. First, I made base template myself. Then I dumped HTML and CSS from some favorite sites and tried to apply them to my app. Then I googled for free web-templates and

Re: Django default date formatting changes

2009-10-16 Thread Михаил Лукин
Try this http://docs.djangoproject.com/en/dev/ref/settings/#date-format On Fri, Oct 16, 2009 at 2:21 PM, vishak wrote: > > Hi Django users, > > I have one question in django for which details are given below > > 1] The default date format in django is '`2009-10-10' when entered > through front

Re: displaying tree data in admin

2009-10-14 Thread Михаил Лукин
There is no sucj feature in admin interface On Wed, Oct 14, 2009 at 9:18 PM, ev wrote: > > I've created model Structure referenced to itself and filled it with > my data. > > class Structure(models.Model): >parent=models.ForeignKey('self', blank=True, null=True, > related_name='child_set

Re: How to confirm a successfull/failed database insert call to the user

2009-10-13 Thread Михаил Лукин
First of all, you don't need to check request.method == 'POST' twice; you don't need to check action here. Finally, you can use user messages to add and display confirmations: in view: http://docs.djangoproject.com/en/dev/topics/auth/#messages Put messages in base template and you can see them eve

Re: Apply decorator to view functions in third-party apps?

2009-10-13 Thread Михаил Лукин
e: > > > As an aside, it seems curious to me that in a generally flexible > framework like Django a problem like this should have only a dirty > solution. I've encountered a few instances where it would be useful > to have access to request variables, but there's no way to

Re: Apply decorator to view functions in third-party apps?

2009-10-13 Thread Михаил Лукин
Seems that any solution would be dirty, so why don't you set threadlocal variable with request and monkey-patch template loader? On Tue, Oct 13, 2009 at 11:03 PM, Nan wrote: > > > The trouble is that I've got third-party apps that have their own > views that don't include the template logic. > >

Re: How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Михаил Лукин
./manage.py help test Does changing verbosity help? On Tue, Oct 13, 2009 at 10:59 PM, Phlip wrote: > > Djangoids: > > Unit tests should run as silent as possible, so we don't get too > familiar with their spew. Ideally, any spew should raise your index of > suspicion, and a test batch that alway

Re: new permission

2009-10-13 Thread Михаил Лукин
Try ./manage reset auth On Tue, Oct 13, 2009 at 1:08 PM, elminio wrote: > > hi, > > It didnt help :/ > > On Oct 9, 10:33 am, "Bogdan I. Bursuc" > wrote: > > Try to delete the auth_permissions table the sync db > > see if it helps > > > > On Fri, 2009-10-09 at 01:29 -0700,elminiowrote: > > > Up

Re: directory name with space

2009-10-13 Thread Михаил Лукин
You're definitely right, that's why I mentioned additional tests in view function. I'm not sure about win and NTFS, but on *nix os.path.exists() will likely return False on such weird things as '\x01\x02', while whitelisting characters may lead to problems with internationalization (or we'll get a

Re: directory name with space

2009-10-13 Thread Михаил Лукин
Well, I don't know what is under scarico/(\d+)/ - single file or a directory tree. In case of directory tree ".+" seems to be the best way, which is also documented at http://docs.djangoproject.com/en/dev/howto/static-files/ In case of single file "[^/]+" instead of ".+" can be used. I think ther

Re: directory name with space

2009-10-13 Thread Михаил Лукин
Maybe you should try smth like this: (r'^scarico/(\d+)/(.+)/$', 'sitonorme.gestnorme.views.scarico'), On Tue, Oct 13, 2009 at 7:59 PM, luca72 wrote: > > Hello i have a small application where in the urls i have this : > > (r'^scarico/(\d+)/(\w+)/$', 'sitonorme.gestnorme.views.scarico'), > > the