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đ
> 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,
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
)
--
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
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
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
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.
--
[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
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
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
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
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
_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
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':
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ć
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
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
, 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
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
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
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
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]
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š
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
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
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
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]
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
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
.
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]
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?
49 matches
Mail list logo