Re: how to cut and paste image into django app

2009-10-23 Thread kmike
y to figure out what that can do for me and try > using it. > > Kmike - the gears thing seems promising but I am frankly still having > trouble figuring out what it does.  Does your code actually upload > files via drag and drop?  I will try downloading your code and see if > I can f

Re: how to cut and paste image into django app

2009-10-23 Thread kmike
Google Gears can also be used in order to implement drag-n-drop image uploading. I beleive it is the easiest way because it only involves some javascript programming. You can also do other nice things with Google Gears (resize images client-side, for example; check http://bitbucket.org/kmike

Re: Interesting code abstraction Challenge

2009-10-23 Thread kmike
Maybe you don't have enough information to make an abstraction right now. If so I suggest to actually implement several API's in a dumb way. After that it'll be clear what are the differences and what are the common parts so making a good abstraction will be easier. On 23 окт, 11:06, Jason

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 <kmik...@googlemail.com> wrote: > 1. Maybe you can use django's Vary support > (http://docs.djangoproject.com/en/dev/topics/cache/#using-vary-headers > ). This > will work

Re: Two cache-related questions

2009-10-07 Thread kmike
/kmike/django-view-cache-utils/ for that (writing appropriate cache_prefix function). 2. Functions (from the same django-view-cache-utils app) that removes page from cache based on page's url (and possibly key_prefix): http://bitbucket.org/kmike/django-view-cache-utils/src/tip/view_cache_utils

Re: Two cache-related questions

2009-10-07 Thread kmike
/kmike/django-view-cache-utils/ for that (writing appropriate cache_prefix function). 2. Function that removes page from cache based on page's url (and possibly key_prefix): http://bitbucket.org/kmike/django-view-cache-utils/src/tip/view_cache_utils/__init__.py On 8 окт, 00:11, Christophe Pettus &l

Re: Django comments

2009-10-06 Thread kmike
that I could use to query comments for that > particular paragraph. > > Thanks again, > > Tomas > > On Oct 3, 11:28 am, kmike <kmik...@googlemail.com> wrote: > > > > > If you want additional field (paragraph_id) in Comment model you can > > create your o

Re: How to customize the default comments form from contrib.comments

2009-10-03 Thread kmike
Define custom form: class NoEmailCommentForm(CommentForm): def __init__(self, *args, **kwargs): super(NoEmailCommentForm, self).__init__(*args, **kwargs) self.fields['email'].required = False Then put def get_form(): return NoEmailCommentForm in your comment

Re: Django comments

2009-10-03 Thread kmike
If you want additional field (paragraph_id) in Comment model you can create your own model as decribed here: http://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/#ref-contrib-comments-custom On 3 окт, 01:46, cirip wrote: > Hi, > > I am just reading about django

Re: Populating an ImageField

2009-10-03 Thread kmike
If you have one default logo then maybe the 'right' way is to use 'default' parameter of ImageField? On 3 окт, 22:07, Nan wrote: > Nope, but I finally found what seems to be the "right" way to do this > (copies the file to the appropriate upload_to location, etc): > > from

Re: How do I require login before accessing FormWizard forms?

2009-10-02 Thread kmike
My solution was urlpatterns += patterns('', url(r'^my_wizard/$', login_required(MyWizard().__call__), name='my_wizard'), ) On 2 окт, 18:11, JimR wrote: > After much searching, I found the answer that I was looking for - > using the login_required decorator directly in the

Re: Custom linking of models in many-to-one relationship

2009-09-27 Thread kmike
'id__in' queries (example: http://bitbucket.org/kmike/django-generic-images/src/tip/generic_utils/managers.py#cl-122). On 28 сен, 09:17, triman <john.ple...@gmail.com> wrote: > I have a model that can be attached to a variety of different models, > based on the value of a column.  Is t

Re: remove fields from django.contrib.comments

2009-09-21 Thread kmike
You can remove fields from templates (from html). They indeed should be removed if you don't want them :) Then we face a problem: some of CommentForm fields are marked as required. The solution is to subclass CommentForm and set this flag to False: class NoEmailForm(CommentForm): def

Re: capacity planning (server sizing) for Apache+Django+PostgreSQL

2009-09-21 Thread kmike
Try using smth. like siege (http://freshmeat.net/projects/siege/ , home page seems to be broken) to check how many requests per second can your app handle. Then add more django processes/threads in your mod_wsgi config (or more fastcgi processes, or smth. else) and test again. Measure memory and

Re: carrying value from ForeignKey

2009-08-16 Thread kmike
I mean smth. like lambda: self.content.text On 16 авг, 20:41, Ali Rıza Keleş wrote: > Hello, > > I want to carry value as default from one model to another. > > For example: > > class Text(models.Model): >     text = models.TextField(blank = True) >     name =

Re: carrying value from ForeignKey

2009-08-16 Thread kmike
You can override `save` method or maybe provide callable ***, smth. like default=lambda: self.text but i haven't test it. On 16 авг, 20:41, Ali Rıza Keleş wrote: > Hello, > > I want to carry value as default from one model to another. > > For example: > > class

Re: Application decoupling - project architecture question

2009-08-08 Thread kmike
I wrote a simple app that may be useful for avatar management: http://bitbucket.org/kmike/django-generic-images/wiki/Home It's similar to django-tagging in aspect that images can be attached to any model using generic relations and then fetched in a few sql queries. Avatar-uploading view example

Re: Application decoupling - project architecture question

2009-08-08 Thread kmike
I wrote a simple app that may be useful for avatar management: http://bitbucket.org/kmike/django-generic-images/wiki/Home It's similar to django-tagging in aspect that images can be attached to any model using generic relations and then fetched in a few sql queries. Avatar-uploading view

Re: checking if db schema and model match

2009-08-05 Thread kmike
That's a question about database migration. Django doesn't have built- in solution for that. Try using South (http://bitbucket.org/andrewgodwin/south/overview/), it is a very good db migration app. I suggest using development version because (based on my experience) it is more robust than last

Re: cache and multple languages

2009-08-05 Thread kmike
Hi, I've recently create an app for advanced view caching. It allow pages to be cached based on anything in request, specific cookies for example. Please check http://bitbucket.org/kmike/django-view-cache-utils/wiki/Home If you have any questions about it feel free to ask. On 5 авг, 20:11