Re: i18n model - tri-lingual data

2008-07-02 Thread Nebojša Đorđević
On 26 Jun 2008, at 15:22, pihentagy wrote: > Is there a way I can tell the model about the request's language? Or, > well, I know it is a violation of MVC, but how to solve this problem? from django.utils.translation import get_language lang = get_language() -- Nebojša Đorđ

Re: Django : generic view object_list

2007-08-06 Thread Nebojša Đorđević
> endif %} > > > > {% for User in info_dict %} {% for User in object_list %} http://www.djangoproject.com/documentation/generic_views/#django- views-generic-list-detail-object-list `object_detail` puts all of the found objects in *object_list*. -- Nebojša Đorđević - nesh,

Re: Serving static media, again...

2007-06-02 Thread Nebojša Đorđević
with FastCGI. OTOH, lighty can be useful if you want to control access to the static files with mod_secdownload. -- Nebojša Đorđević - nesh, ICQ#43799892, http://www.linkedin.com/in/ neshdj Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://code.google.com/p/django-utils/ Re

Re: Newforms / Validation / Uniqueness

2007-06-01 Thread Nebojša Đorđević
ls.googlecode.com/svn/branches/0.1/forms/ -- look at the `create_object` for the example. Code is little old but should work. (sadly, I currently do not have any spare time to work on this :( ) -- Nebojša Đorđević - nesh, ICQ#43799892, http://www.linkedin.com/in/ neshdj Studio Quattro - Niš - Ser

Re: Business Application

2007-05-21 Thread Nebojša Đorđević
st apache instance (just mod_rewrite and some other mods) in front of lot's of applications (PHP, Django, ...) handled via FastCGI. Added bonus is that every app is running as a different user. -- Nebojša Đorđević - nesh, ICQ#43799892, http://www.linkedin.com/in/ neshdj Studio Quattr

Re: Intializing newforms Form objects

2007-03-12 Thread Nebojša Đorđević
n object with any signifigant number of m2m fields there's just > a lot of cruft in your view. http://django-utils.googlecode.com/svn/branches/0.1/forms/ Take a look, it comes with generic views also. Unfortunately no docs (yet). -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Qu

Re: Weird session

2007-03-02 Thread Nebojša Đorđević
quot;] + [order_item.id] this way SessionWrapper.__setitem__ will be called and session will be marked as modified. Hope that helps. IIRC Quixote had a set of the special list/tuple/dict/whatever classes which interact with the "set dirty" machinery and set "dirty" flag

Re: Change class name in Admin interface

2007-02-16 Thread Nebojša Đorđević
l definition: > > class Category(models.Model): > name = models.CharField('Nombre',maxlength=40) > description = models.CharField('Descripción',maxlength=250) > def __str__(self): > return self.name > class Admin: > pass class Meta: ve

Re: Image upload - self.image not defined in save method

2007-02-15 Thread Nebojša Đorđević
def _save(self, instance=None): super(ScreenshotImageField, self)._save(instance) # do the renaming stuff setattr(instance, 'filesize', getsize(getattr(instance, 'get_%s_filename' % self.attname)()) This way you can avoid need for over

Re: newb question: Kind of confused MEDIA_URL, MEDIA_ROOT, SITE_MEDIA and so on.

2007-02-15 Thread Nebojša Đorđević
7;t like to stuff things into the context which are not related to the current view. This way template namespace is a little cleaner. -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User

Re: 500 Server Error i modPython

2007-02-12 Thread Nebojša Đorđević
t screen Internal Server Error, but I > want to change this for my own site-info. > Any help or tip? > Thanks Gregor Copy django/contrib/admin/templates/500.html into your main template folder and then you can customize it. -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Q

Re: When to restart Apache?

2007-02-12 Thread Nebojša Đorđević
for me to use mod_fastcgi instead of mod_python. With FastCGI it's enough to touch .fcgi script to trigger full code reload. -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registere

Re: newb question: Kind of confused MEDIA_URL, MEDIA_ROOT, SITE_MEDIA and so on.

2007-02-12 Thread Nebojša Đorđević
ing your media files (usually point to the same physical path as MEDIA_ROOT). i.e. -- [other site setup] Alias /media/ /my/projec/media settings.py --- MEDIA_URL = '/media/' MEDIA_ROOT = '/my/projec/media' Hope that helps. -- Nebojša Đo

Re: custom validator or other way to avoid double bed bookings (almost solved)

2007-02-12 Thread Nebojša Đorđević
or patient in Patient.objects.filter(room__isnull=False)])) [...] class Patient(models.Model): [...] limit_choices_to = get_rooms # no () -- Nebojša Đorđević - nesh, ICQ#43799892 Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 28215

Re: custom validator or other way to avoid double bed bookings

2007-02-10 Thread Nebojša Đorđević
select a bed that is > already in use. Have you tried `limit_choices_to` (http://www.djangoproject.com/ documentation/model_api/#many-to-one-relationships) to filter out all of the used beds from the select list. Do you use Django admin interface or the custom form? -- Nebojša Đorđević - ne

Re: haw access to values from field with choices

2007-02-03 Thread Nebojša Đorđević
On Feb 2, 2007, at 14:51 , kamil wrote: > Surely it's solved but I can't find any info about it. I'm sure that > everybody met this problem. > What is the best way to get rendered the value from the field with > choices. > Generic views spits key not value. .get__d

Re: Compress images on upload?

2006-08-13 Thread Nebojša Đorđević
utils/wiki/ Thumbnail. --- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] What is the sound of one backpack EMP weapon discharging? -- Joe Thompson "Clickety-cl

Re: Work with FileField directly

2006-08-09 Thread Nebojša Đorđević
ame & move file to new name if needed self.file_field = newname super(Class, self).save() -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] What is the sound o

Re: Using form manipulator for data in multiple models

2006-08-03 Thread Nebojša Đorđević
thods in the manipulator could help considerably :) I posted at http://trac.studioquattro.biz/djangoutils/wiki/ ManipulatorsMultipleModels my view and template tags witch I'm used to get the same thing. Hope that helps. -- Nebojša Đorđević - nesh Studio Quattro - Niš - S

Re: Django source editing offtopic

2006-08-02 Thread Nebojša Đorđević
m or JEdit. -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] What is the sound of one backpack EMP weapon discharging? -- Joe Thompson "Clickety-click" -- Charles

Re: Protecting files

2006-08-01 Thread Nebojša Đorđević
lace which is *not* accessible thru apache and make dedicated view for downloading where you can check permissions and send file to the user. Naturally, it's a lot slower than serving files through apache. -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://s

Re: Rev 3507 breaks admin site

2006-08-01 Thread Nebojša Đorđević
) -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] What is the sound of one backpack EMP weapon discharging? -- Joe Thompson "Clickety-click" -- Charl

Re: Question about tags

2006-08-01 Thread Nebojša Đorđević
ntext['print_results'] = resolve_variable(self.num, context) return "" -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ | http://trac.studioquattro.biz/djangoutils/ Registered Linux User 282159 [http://counter.li.org] What is the sound of one

Re: Media and Admin Media URL Issues

2006-07-27 Thread Nebojša Đorđević
have to add something like this in apache conf: Alias /media/ /home/ohgoditb/django_projects/fallingbullets/media/ -- Nebojša Đorđević - nesh Studio Quattro - Niš - Serbia http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://trac.studioquattro.bi

Re: numeric formatting

2006-03-27 Thread Nebojša Đorđević
27;t already a simple filter that will do this, what do > I need to learn about in order to create my own filter? > > Rock http://djangoutils.python-hosting.com/file/utils/trunk/templatetags/utils.py (shameless self promotion ;) ) This still needs work for various locales. --

Re: Djangoproject site and documentation

2006-03-23 Thread Nebojša Đorđević
[EMAIL PROTECTED] wrote: > Right now I cant get access to djangoproject.com. > > And, as I know, its global problem. > > Is there any other place, where i get django documentation right now? > Basic docs are in /docs/ -- Nebojša Đorđević - nesh Studio Quattr

Re: Date format in admin interface

2006-03-15 Thread Nebojša Đorđević
for your language (and if not look at http://code.djangoproject.com/wiki/Localization to contribute one). -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.python-hosting.com/ Re

Re: kicking off a scheduler

2006-03-06 Thread Nebojša Đorđević
he sched lib. Any ideas? You can take a look at https://simon.bofh.ms/cgi-bin/trac-django-projects.cgi/wiki/JobControl -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.p

Re: weird learning thingie

2006-03-05 Thread Nebojša Đorđević
efinitely browser (or maybe css/html) problem. Update: After first refresh FF shows large image without intervention. -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.pytho

Re: limiting foreign key choices in a selection field

2006-03-02 Thread Nebojša Đorđević
can be of some help for you. And if you find solution please post here because I will soon need to use something like this in my current project. -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.c

Re: limiting foreign key choices in a selection field

2006-02-28 Thread Nebojša Đorđević
_choices.append((dct['id'], dct['name'])) self.fields = ( formfields.SelectField(field_name="maker", choices=maker_choices), ) So you can decide which category to show when creating a form in your view function, and use this instead of Add

Re: limiting foreign key choices in a selection field

2006-02-28 Thread Nebojša Đorđević
if I only want to show a sub-list of makers that belong to > a specific "category". I suppose I should use custom manipulators, but > don't know exactly how to do. Pls help! How about: maker = meta.ForeignKey(Maker, limit_choices_to={'category__exact':

Re: Variable number of parameters in urlconf

2006-02-07 Thread Nebojša Đorđević
s_dispatch(path): return css(*path.split("/")) Wow that's quick :) Well, I'm posted this in hope that I can use urlconf to accomplish this, so I'll resort to path=path.split('/') stuff. Thanks for quick reply. --- Nebojša Đorđević

Re: upload to user directory

2006-02-07 Thread Nebojša Đorđević
ource: http://djangoutils.python-hosting.com/file/ image_store/trunk/models/image_store.py) for complete example. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/ http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ | http://djangoutils.python-ho

Variable number of parameters in urlconf

2006-02-07 Thread Nebojša Đorđević
supposed to call css function with 'foo', 'css', 'layout.css' as arguments. I know that I can put multiple '([\w\.-]+/?)+' in pattern but I want more general solution, and I don't want to resort to parsing request.path myself. Help :) --- N

Re: Managing static media urls

2006-01-20 Thread Nebojša Đorđević
, but because I have control of my DNS, I use sub domains for stuff like that. So http://boringsite/newcoolthing/ becomes http://newcoolthing.boringsite/. -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/forum/ http://djnesh.blogspot.com/ | http://djnesh-djan

Re: Managing static media urls

2006-01-19 Thread Nebojša Đorđević
EBUG=LOCAL_DEV=False). With this setting I have a local server, a staging server and a production server setup which only differs in SITE_ROOT (sometimes, because I tend to replicate directory structure from my production server), LOCAL_DEV and DEBUG variables. -- Nebojša Đorđević - nesh Studio

Re: Apache2 mod_python VirtualHost configuration

2006-01-19 Thread Nebojša Đorđević
t configuration: Alias /media/ "" Alias /admin-media/ "/django/contrib/admin/media/" And you don't have to copy anything from django src. -- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://studioquattro.biz/forum/ http://djnesh-django.blogspot.com/ | http://djangoutils

Re: Question about Media root

2005-12-29 Thread Nebojša Đorđević - nesh
athNormal = 'C:\\Django\\TEMPLATES\\Static\\Uploaded\\Normal\\' For image fields use something like this: foo = meta.ImageField(upload_to=os.path.join(MEDIA_ROOT, 'Uploaded')) also, you can look at http://djangoutils.python-hosting.com/ (thumbnails) for ImageWithTh

Re: Django on Textdrive?

2005-12-02 Thread Nebojša Đorđević - nesh
d is the only option on TextDrive. OTOH I'm using a mod_fcgi on my local server for site testing. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: django breaks not null in postgresql?

2005-12-01 Thread Nebojša Đorđević - nesh
d(default=True) always use python native types when working with models - it will be converted to database specific automatically. Also, if you don't use any of i18n stuff you don't need to specify verbose_name if is same as a field name. --- Nebojša Đorđević - nesh Studio Quattro - Niš

Re: django breaks not null in postgresql?

2005-11-30 Thread Nebojša Đorđević - nesh
have something like this: name = meta.CharField(maxlength=200, blank=True) If you want to check for empty data you can just use: name = meta.CharField(maxlength=200) and django itself will check that name field is not *blank* or *NULL*. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG

Re: Django on Textdrive?

2005-11-30 Thread Nebojša Đorđević - nesh
On 25-11-2005, at 19:42, David Ascher wrote: What setup did you use? Apache/Lighttpd, fcgi/scgi/other? apache/lighttpd with FastCGI Apache is serving media files and doing proxy to lighttpd. I have replicated this setup also on my devel server for testing. --- Nebojša Đorđević - nesh

Re: Django on Textdrive?

2005-11-25 Thread Nebojša Đorđević - nesh
On 25-11-2005, at 7:35, David Ascher wrote: Has anyone had any success w/ Django on TxD? up-and-runnig quattro.textdriven.com ;) --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http

Re: Django/lighttpd weirdness

2005-11-17 Thread Nebojša Đorđević - nesh
sers/home/djnesh/tmp/ django.socket". IMHO /tmp/ is not writable or something similar. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: File Upload Issue

2005-10-16 Thread Nebojša Đorđević - nesh
ry to move rename logic into _post_save(). IIRC when you hit _post_save object is already in db so self.id will have a value. After renaming file and updating image field you must again save() object. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | htt

Re: File Upload Issue

2005-10-16 Thread Nebojša Đorđević - nesh
x27;) new_name = _HEX_SUB.sub(r'[\1]', new_name) + ext dest_path = os.path.join(path, new_name) if new_name != old_name: return rename(file_path, dest_path) else: return file_path # # --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG htt

Re: problem with ImageField

2005-09-19 Thread Nebojša Đorđević - nesh
. Same problem, after some trying I found out that this error only appears when I have a DateTimeField in my model. --- Nebojša Đorđević - nesh Studio Quattro - Niš - SCG http://djnesh.blogspot.com/ | http://djnesh-django.blogspot.com/ Registered Linux User 282159 [http://counter.li.org]

Re: how about i18n ?

2005-08-01 Thread Nebojša Đorđević
On 29-08-2005, at 20:19, Nebojša Đorđević wrote: I'll will have this running on current version until the end of next week. First version is out. I'm attached patch to http:// code.djangoproject.com/ticket/65. btw. Is this thread is more appropriate for django-devel?