Re: ManyToMany and save method

2008-11-17 Thread Alex Koshelev
Related objects save after `host`. So insertion into M2M table happens after save method of host object has executed. In your example - after `Ticket.save` On Mon, Nov 17, 2008 at 14:49, Marco Minutoli <[EMAIL PROTECTED]>wrote: > > I have this model: > > class Ticket(models.Model): >## Forei

Re: Serialization of custom model fields

2008-11-15 Thread Alex Koshelev
There is ticket and patch for this issue http://code.djangoproject.com/ticket/9522 On Sat, Nov 15, 2008 at 16:38, AndyH <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a custom model field class that stores event recurrence > information. In python this is an instance of dateutil.rrule.rule, and >

Re: Problem with named URL and parameters

2008-11-13 Thread Alex Koshelev
Hmm... Why in template tag you wrote `conversions` as view name but in error traceback there is `my_site.conversions`? On Thu, Nov 13, 2008 at 06:27, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi everyone, > > So I have a question/problem with a named URL pattern... > > #urls.py > url(r'^resou

Re: Views triggering twice

2008-11-13 Thread Alex Koshelev
How have you noticed that view was triggered twice? On Fri, Nov 14, 2008 at 00:17, Jeff Gentry <[EMAIL PROTECTED]>wrote: > > > Actually I lied a little bit - a completely blank file doesn't trigger > this (I can also seem to put in a and tag), but adding > anything else will cause the view to

Re: Query for all objects in table1 that DO NOT have corresponding objects in table2

2008-11-13 Thread Alex Koshelev
Hi, Ropley! Try this: jobs.objects.exclude(viewed_jobs=True) On Thu, Nov 13, 2008 at 14:47, Ropley <[EMAIL PROTECTED]> wrote: > > Noob question, but I've been running around in circles. I'm building > an in-house jobs board, and have 2 models: > > class jobs(models.Model): > ... > > class view

Re: General question: Django-Profiles, auth.User and "merging" both data

2008-11-12 Thread Alex Koshelev
Hi, Alex! Look at the small merging framework [1]. It allows to track changes of objects and merge them when they change. Here is [2] a usage example formed as unit test:-) [1]: http://svn.turbion.org/turbion/trunk/turbion/utils/merging.py [2]: http://svn.turbion.org/turbion/trunk/turbion/utils/t

Re: user.username not resoving in templates.

2008-11-11 Thread Alex Koshelev
Do you use RequestContext [1] in your views? [1]: http://docs.djangoproject.com/en/dev/ref/templates/api/#id1 On Tue, Nov 11, 2008 at 23:43, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > Hello, > > I am having issues acquiring the user context from templates other > than the template I spec

Re: compare old and new model field value

2008-11-11 Thread Alex Koshelev
Why not simple fetch `old version` of object from database and compare its fields. For example: def save(self, *args, **kwargs): if self._get_pk_val(): old = self.__class__.objects.get(pk=self._get_pk_val() for field in self.__class__._meta.fields: old_value = field._ge

Re: django.db.models.Q

2008-11-09 Thread Alex Koshelev
http://docs.djangoproject.com/en/dev/topics/settings/#designating-the-settings On Mon, Nov 10, 2008 at 07:13, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: > > >>> from django.db.models import Q > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.5/site-packa

Re: Interesting result when displaying errors for contrib.auth.forms AuthenticationForm

2008-11-09 Thread Alex Koshelev
rrors }} > >{% endif %} > > type="submit" value="Login" /> > > >

Re: Help! Login() exceeds maximum recursion depth!

2008-11-09 Thread Alex Koshelev
Do you have `login` function in this module? On Mon, Nov 10, 2008 at 00:17, nkulmati <[EMAIL PROTECTED]> wrote: > > Hi guys! > > Ok this really pisses me off, because I am using the code directly > from the documentation: > > def my_view(request): >username = request.POST['username'] >pa

Re: Interesting result when displaying errors for contrib.auth.forms AuthenticationForm

2008-11-09 Thread Alex Koshelev
Please show complete template code On Sun, Nov 9, 2008 at 20:55, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi everyone, > > I'm leveraging auth and have a login form that uses contrib.auth.forms > AuthenticationForm. > > When displaying non-field-specific errors, I get interesting results: >

Re: Per-Test Caching?

2008-11-08 Thread Alex Koshelev
Use database backend for caching while testing. Tests create temporary database so it will have no side effects. On Sun, Nov 9, 2008 at 03:13, Adam Seering <[EMAIL PROTECTED]> wrote: > > Hi, >I have a Django app that relies heavily on caching. I'd like > "./manage.py test" to run on its

Re: global name 'Image' is not defined

2008-11-08 Thread Alex Koshelev
I think you have a typo in this line, May be you write `Image.new` with lowercase "L" not uppercase "I" as first char. On Sun, Nov 9, 2008 at 02:54, Tsinga <[EMAIL PROTECTED]> wrote: > > Hi Djangonauts, > > I need your help > > I am trying to test a view using PIL(Python Imaging Library). This i

Re: [Newbie] Self referencing models

2008-11-08 Thread Alex Koshelev
Did you read the documentation? http://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey On Sat, Nov 8, 2008 at 09:58, sunn <[EMAIL PROTECTED]> wrote: > > How do I make a foreign key to self? > > class Page(models.Model): >title = models.CharField(max_length=128) >display = mod

Re: Model Inheritance - And Signals

2008-11-07 Thread Alex Koshelev
Try to connection handler without `sender` specified. And filter needed models inside it. def my_handler(sender, **kwargs): if not isinstance(sender, CustomModel): return signals.pre_save.connect(my_handler) On Fri, Nov 7, 2008 at 20:03, Vitaly Babiy <[EMAIL PROTECTED]> wrote: > if

Re: getting request.user into a ModelForm?

2008-11-07 Thread Alex Koshelev
For example you can use `thread locals` to store there request object On Fri, Nov 7, 2008 at 10:58, Rob Hudson <[EMAIL PROTECTED]> wrote: > > I have the following: > > ## MODELS > > class Category(models.Model): >user = models.ForeignKey(User) >name = models.CharField(max_length=200) > >

Re: Select a list item by index

2008-11-07 Thread Alex Koshelev
The is not way to get list item by variable index with standard django template tags. On Fri, Nov 7, 2008 at 03:52, jago <[EMAIL PROTECTED]> wrote: > > I have a for loop over a list A. > > inside the loop I want to print out the item of list B at the index > 'forloop.counter0' of list A. > > It

Re: Confused about unittests and fixtures

2008-11-06 Thread Alex Koshelev
GenericForeignKey and content type application itself look very doubtful for me. If you have a ForeignKey to the ContentType model then you depends on order with ContentType objects creates on syncdb. Because ContentType that references to some model can have different primary key any time you flus

Re: Getting non-related records

2008-11-06 Thread Alex Koshelev
Hi, John Try this: Category.objects.exclude(bulletpoint__report=r) On Fri, Nov 7, 2008 at 01:54, John M <[EMAIL PROTECTED]> wrote: > > i have a model at http://dpaste.com/88760/ > > for a particular Report (r), I'd like to get all categories that > aren't in it's bulletpoints. > > For example,

Re: how to get the id in an admin template

2008-11-06 Thread Alex Koshelev
`example.com` is default Site added by the project setup into sites contrib application [1] [1]: http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites On Fri, Nov 7, 2008 at 00:12, webcomm <[EMAIL PROTECTED]> wrote: > > I don't understand the documentation. I am able to get

Re: Sort querysets by their data attribute values

2008-11-06 Thread Alex Koshelev
There is no other way to do this in python/django layer. But you can try to add your temp data in database layer and sort where. On Thu, Nov 6, 2008 at 22:58, dexter <[EMAIL PROTECTED]> wrote: > > I have a queryset which I have looped thru and added a (temporary) > data attribute to each instanc

Re: Logout- Back Button

2008-11-06 Thread Alex Koshelev
The is no way to do "redirect to login page, if i hit back button after logout". But what is wrong that user can see non-actual old data? I think it has no matter. On Nov 6, 8:27 pm, jai_python <[EMAIL PROTECTED]> wrote: > Please help me out --~--~-~--~~~--

Re: Having trouble with django-multilingual

2008-11-06 Thread Alex Koshelev
Django-multilingual has its own discussion group: http://groups.google.com/group/django-multilingual. Try to ask there. On Thu, Nov 6, 2008 at 18:44, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi Everyone, > > I'm having a hard time getting django-multilingual to work the way I > expect. > >

Re: Help regarding renaming the uploaded file name in Django.

2008-11-06 Thread Alex Koshelev
Django uploading mechanism allow you to add date-bases values to path. See `upload_to` section in [1] [1]: http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield On Thu, Nov 6, 2008 at 15:45, sadeesh Arumugam <[EMAIL PROTECTED]>wrote: > Hi Friends, > > I need a help from you. How to

Re: multi foreign keys and ordering in admin

2008-11-06 Thread Alex Koshelev
Try to set meta [1] `ordering` setting [1]: http://docs.djangoproject.com/en/dev/ref/models/options/ On Thu, Nov 6, 2008 at 14:51, MikeKJ <[EMAIL PROTECTED]> wrote: > > Got something like this > > class A(models.Model): >x >class Admin: >x > > class B(models.Model): >

Re: Getting a relationship using double underscores

2008-11-06 Thread Alex Koshelev
If you have `serverid` field in database so you can add reference with custom column name [1]. For example: server = models.ForeignKey(Server, db-column="serverid") [1]: http://docs.djangoproject.com/en/dev/ref/models/fields/#db-column On Thu, Nov 6, 2008 at 15:10, gv <[EMAIL PROTECTED]> wrote:

Re: Is it possible to output JSON like this?

2008-11-06 Thread Alex Koshelev
lt;[EMAIL PROTECTED]> wrote: > > Hey Alex, > > I tried this hard coded JSON the other day: > > results = [] > results.append( { 'date' : '2008-11-04 00:00:00', 'dayEvents' : > [ { 'title' : 'Event 1', 'location' :

Re: Best practice

2008-11-06 Thread Alex Koshelev
> Profile.objects.create(name=name, foo=foo) How do you get this `name` and `foo` variables in `save` method? On Thu, Nov 6, 2008 at 08:20, meppum <[EMAIL PROTECTED]> wrote: > > I've run into a funny case and I'm not sure how to best deal with it. > Basically, I have the following classes. > >

Re: i18n strategy

2008-11-06 Thread Alex Koshelev
The is an existing db internalization application - http://code.google.com/p/django-multilingual/. Try to look at it. On Thu, Nov 6, 2008 at 11:20, Brandon Taylor <[EMAIL PROTECTED]>wrote: > > Hi everyone, > > I'm tasked with translating a mostly database-driven site into > Spanish. I'm familiar

Re: Upload Progress Bar

2008-11-06 Thread Alex Koshelev
And what error message do you receive? On Thu, Nov 6, 2008 at 09:46, Pawel Pilitowski <[EMAIL PROTECTED]>wrote: > > Hi all, > > I'm in the process of trying to write an Upload Progress Bar for my app. > > I'm using the latest trunk version of Django, mod_python 3.3.1, > Memcached, Apache 2.2.8 p

Re: Is it possible to output JSON like this?

2008-11-05 Thread Alex Koshelev
With simplejson module (that is part of django distribution) you can covert to JSON any python objects. So create data structure you need and pass it to simplejson dump/dumps functions. On Thu, Nov 6, 2008 at 01:17, Darthmahon <[EMAIL PROTECTED]> wrote: > > Hi, > > Ok I'm using the following cod

Re: redirection 2 links back after signing up?

2008-11-05 Thread Alex Koshelev
And how about to ignore `next` param in `create_account` view and explicitly redirect user to his restricted area? On Wed, Nov 5, 2008 at 17:12, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote: > > Hello, > > I have the following situation: > > 1) User goes to a restricted area and is offered a cha

Re: How to use post_save signal

2008-11-05 Thread Alex Koshelev
Make `update_stock_status` a free function not `Sale` method. On Wed, Nov 5, 2008 at 12:43, Low Kian Seong <[EMAIL PROTECTED]> wrote: > > My code is here > > http://dpaste.com/88831/ > > It's not working I really don't know why the other part of the > post_save is not even being executed > > On W

Re: Overriding update in models

2008-11-04 Thread Alex Koshelev
Hi, Antonio. Try to replace `datetime.date.today()` with `datetime.datetime.now()` calls. On Tue, Nov 4, 2008 at 23:58, Antonio Volpon <[EMAIL PROTECTED]>wrote: > > Hello. > > I am very new to Django and I'm having some problems in overriding the > save method for a simple class. In particular,

Re: ManyToManyFieldManager in post_save signal

2008-10-12 Thread Alex Koshelev
There is not way track M2M field change with post_save signal. You can write your own derived M2M field class with needed hooks. On Oct 12, 9:01 pm, Viktor <[EMAIL PROTECTED]> wrote: > Hi, > > I have three simple models Project and Member, where Project.member is > a ManyToManyField to User throu

Re: ModelForm and request.POST

2008-09-29 Thread Alex Koshelev
If you what to provide some init state for form - use `initial` param On Sep 30, 2:31 am, globophobe <[EMAIL PROTECTED]> wrote: > I would like to instantiate a modelform with a dictionary to work with > an existing object, e.g. > > a = Article.objects.get(title='Big news') > f = ArticleForm({'tit

Re: problem with permalink

2008-07-22 Thread Alex Koshelev
Hi. `permalink` - is a decorator [1], not an 'ordinary' function. So it can be used like this: @permalink def get_url(self): return ('experiment_view', (), {'exp_id': self.id}) [1]: http://www.djangoproject.com/documentation/model-api/#the-permalink-decorator On Jul 22, 1:30 pm, mwebs <[

Re: Many to many array accessible from template?

2008-07-13 Thread Alex Koshelev
like this: > > {{ message.users.all }} > > It prints out something like: > > [,] > > So I know that it is working... > > On Jul 13, 12:52 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > I`UserMessage` model has `users_read` field why do you write i

Re: Many to many array accessible from template?

2008-07-13 Thread Alex Koshelev
I`UserMessage` model has `users_read` field why do you write in template `message.users`? On Jul 13, 2:56 pm, Darthmahon <[EMAIL PROTECTED]> wrote: > Hey, > > I'm writing a messaging module at the moment. I'm printing out the > list of messages fine, but when I loop through each message I want to

Re: connection.queries - show improper SQL?

2008-07-08 Thread Alex Koshelev
While you don't have an exception if using ORM so it isn't bug it is feature. On Jul 8, 10:07 pm, Peter <[EMAIL PROTECTED]> wrote: > When I look at generated sql from connection.queries, it doesn't show > any quotes around strings. > > For example:>>> from django.db import connection > >>> from d

Re: clean_* method for ModelForms?

2008-07-06 Thread Alex Koshelev
Oh, `required=True` of course On Jul 6, 10:31 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Field for `author` created with `required=False`. And `clean` method > doesn't call `clean_author` if `author` data isn't present. > > On Jul 6, 10:14 pm, "Rob Hudson&quo

Re: clean_* method for ModelForms?

2008-07-06 Thread Alex Koshelev
Field for `author` created with `required=False`. And `clean` method doesn't call `clean_author` if `author` data isn't present. On Jul 6, 10:14 pm, "Rob Hudson" <[EMAIL PROTECTED]> wrote: > Is it possible to supply a clean_[fieldname] method to a ModelForm for > custom validation rules like you

Re: Test client and GET parameters problem

2008-07-02 Thread Alex Koshelev
There is[1] special parameter named `data` that represents GET query as dictionary. Or you can pass QUERY_STRING parameter with raw GET string [1] http://www.djangoproject.com/documentation/testing/#making-requests On Jul 3, 9:42 am, Thomas <[EMAIL PROTECTED]> wrote: > Weird problem, > > I am do

Re: django+mod_python, caching or something else?

2008-07-02 Thread Alex Koshelev
Or may be a custom template tag for common stuff. On Jul 2, 5:59 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > Brrr... Try to use context > processorshttp://www.djangoproject.com/documentation/templates_python/#subclass... > > On Jul 2, 5:43 pm, Mario <[EMAIL PROTE

Re: django+mod_python, caching or something else?

2008-07-02 Thread Alex Koshelev
der_by('- > created')[:5] >     return render_to_response('index.html', context) > > Please, help me to write good code. I don't want repeat code in every > view... > > On Jul 2, 3:42 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: >

Re: django+mod_python, caching or something else?

2008-07-02 Thread Alex Koshelev
Of course. But author don't write where he create context in some view function or in module scope. On Jul 2, 4:42 pm, "James Bennett" <[EMAIL PROTECTED]> wrote: > On Wed, Jul 2, 2008 at 7:09 AM, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > Client-side cach

Re: django+mod_python, caching or something else?

2008-07-02 Thread Alex Koshelev
Client-side caching. Use the `never_cache` decorator On Jul 2, 3:43 pm, Mario <[EMAIL PROTECTED]> wrote: > Hi, all! > I have a some little project that consists news list, several text > blocks and else > All worked... But after adding, for example news, it not publish on > main page while apache

Re: Bug with unique_together on mod_wsgi?

2008-06-29 Thread Alex Koshelev
`unique_together` is a database level feature so it cannot depend on web-server and its modules. When you don't give any code to see where you add new entry and retrieve. On Jun 29, 10:32 am, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > Since I switched my site from mod_python to mod_wsgi, the met

Re: CMS application: auto-setting the post author

2008-06-23 Thread Alex Koshelev
Try this http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser On Jun 17, 6:02 am, saxon75 <[EMAIL PROTECTED]> wrote: > I'm working on a CMS application and had a question about > automatically setting certain model fields. > > Suppose I have the following model (this is simplified from

Re: Another question about form validation?

2008-06-23 Thread Alex Koshelev
Pass it through form custom constructor On Jun 23, 7:12 pm, Adi <[EMAIL PROTECTED]> wrote: > How do you pass model objects that you may need access to when > implementing the clean() or clean_ methods? > > In other words, how can a form access model objects that it may need > access to perform it

Re: Extending the method that is called the first time a model is deployed.

2008-06-21 Thread Alex Koshelev
try `class_prepared` or `post_syncdb` signals On Jun 21, 3:43 pm, mwebs <[EMAIL PROTECTED]> wrote: > I want to register a specific model(not an object of the model, the > model itself) in another model. > This should be done the first time the model is deployed with syncdb. > > So what I need is

Re: HELP: Foreign keys, models, and querysets

2008-06-09 Thread Alex Koshelev
What is this `pid = models.ForiegnKey()` ? On 9 июн, 23:44, Huuuze <[EMAIL PROTECTED]> wrote: > I have the following models in my models.py file: > > >> class Person(models.Model): > >> pid = models.AutoField(primary_key=True) > >> fname = models.CharField(max_length=50) > >> lname = models

Re: Problem with login()

2008-06-09 Thread Alex Koshelev
Check if your cookies are enabled. On 9 июн, 22:47, bcrem <[EMAIL PROTECTED]> wrote: > Sorry, get_user(request) was a blind alley; I'm actually using 'user = > request.user' right now, and my first attempt was 'if > request.user.is_authenticated():' as you suggest. Behavior's the > same. > > On

Re: foreign key and verbose name?

2008-06-09 Thread Alex Koshelev
That fields accepts `model class` as first argument which is more important then `verbose_name` in this case. On Jun 9, 8:10 pm, pihentagy <[EMAIL PROTECTED]> wrote: > Hi all! > > In the docs > here:http://www.djangoproject.com/documentation/model-api/#verbose-field-n... > > Each field type, exc

Re: Post count in blog archive month list

2008-06-08 Thread Alex Koshelev
http://www.djangoproject.com/documentation/db-api/#month On Jun 8, 10:32 pm, Jason K <[EMAIL PROTECTED]> wrote: > So I'm building the archive pages for a blog. In the sidebar I have a > list of months that contain posts, linking to the archive month page. > I've made an inclusion tag for this whi

Re: reversing url tag with viewname as variable in the context

2008-06-08 Thread Alex Koshelev
t_var_viewname)) i > work in this > > thnaks > > On Jun 8, 10:54 am, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > No. Built-in {% url %} tag doesn't support variable as view name. To > > solve this you can write your own url-like template tag with needed

Re: reversing url tag with viewname as variable in the context

2008-06-08 Thread Alex Koshelev
No. Built-in {% url %} tag doesn't support variable as view name. To solve this you can write your own url-like template tag with needed functionality. Or refactor you code to avoid using the view name as variable:) On Jun 8, 12:39 pm, ferran <[EMAIL PROTECTED]> wrote: > Hi all, > > The tag {% ur

Re: confusing querying

2008-06-07 Thread Alex Koshelev
When in your first example you call `[0]` it replaced earlier `[22:44]` slicing. In second example before `[0]` slice query set is converted into list (for `repr` call and output) and then you apply `[0]` to result list. On Jun 7, 7:54 pm, birkin <[EMAIL PROTECTED]> wrote: > I just posted some c

Re: Django models - newbie question

2008-06-07 Thread Alex Koshelev
Hmm.. def __unicode__( self ): return "%s" % self.team1 # if Teams model has its own __unicode__ method On Jun 7, 5:34 pm, nikosk <[EMAIL PROTECTED]> wrote: > Hi all > > Does anyone know how to do something like this : > > class Game(models.Model): > team1 = models.ForeignKey(Teams, relat

Re: Need a Middleware to select urlpatterns

2008-06-06 Thread Alex Koshelev
You can set `urlconf`(plain string - path to the needed urlconf) attribute to request object that is passed into `process_request`. Then django will use it not default. On Jun 6, 8:42 pm, Siah <[EMAIL PROTECTED]> wrote: > Hi, > > I need to select different urlpatterns in my middleware's > process

Re: Reference to the url of the current page in a template

2008-05-16 Thread Alex Koshelev
If you have `django.core.context_processors.request` context processor enabled and you use RequestContext so the `{{request.path}}` will return current path. Or you can simple pass `request.path` variable to the template context manually. On May 16, 8:58 pm, "M.Ganesh" <[EMAIL PROTECTED]> wrote:

Re: post_save Signal Trouble

2008-04-20 Thread Alex Koshelev
No, in python each module evaluates one time - at import process. On Feb 29, 12:18 am, itodd <[EMAIL PROTECTED]> wrote: > Ok, > > I've figured out models.py was being evaluated multiple times. Where > should I put my dispatcher code to ensure this doesn't happen? > > Thanks, > > Todd > > On Feb 2

Re: Does request.is_ajax() really work?

2008-04-19 Thread Alex Koshelev
What is `is_ajax` method? On Apr 19, 4:06 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have made up a view to check a request is ajax or not, but the > function is_ajax() always return false. I used prototype to fire the > ajax request and I confirmed it with Firebug. The request header

Re: users and profiles - model structure question

2008-04-18 Thread Alex Koshelev
I usually make link to User model not profile. And have no problems with usage. On Apr 18, 2:02 pm, andy baxter <[EMAIL PROTECTED]> wrote: > Hello, > > I have built a data model for a virtual library, which contains the > following classes (among others): > > User - the built in user class from d

Re: Calling a template from a template

2008-04-18 Thread Alex Koshelev
http://www.djangoproject.com/documentation/templates/#include On Apr 18, 1:29 pm, Salim Fadhley <[EMAIL PROTECTED]> wrote: > I'm trying to write a view & template collection that will render > arbitrary objects in a database. I cannot change these objects and > make them more view-friendly, so I

Re: Dynamic queryset to ModelChoiceField

2008-04-15 Thread Alex Koshelev
Or `Topic.objects.none()` On Apr 15, 8:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Sure, just give the modelchoicefield Topic.objects.all() to start > with, as this will never actually get used. > > On Apr 14, 11:14 pm, shabda <[EMAIL PROTECTED]> wrote: > > > I have a form where I wan

Re: Reading an entire template into a string

2008-04-14 Thread Alex Koshelev
Not render, just load. I think `django.template.loader.find_template_source` can help On Apr 14, 4:17 pm, Darryl Ross <[EMAIL PROTECTED]> wrote: > nandu wrote: > > Dear Folks, > > > I wish to read an entire template into a string or at least use a > > method in django.template that will output t

Re: Tag

2008-04-13 Thread Alex Koshelev
Look at the docs: http://www.djangoproject.com/documentation/templates_python/#parsing-until-another-block-tag On Apr 13, 8:22 pm, "Claudio Escudero" <[EMAIL PROTECTED]> wrote: > Hi, > > What is block-like tag? > =/ > > Thanks, > Claudio > > On Sat, Apr 12, 2008 at 10:26 PM, Malcolm Tredinnick <

Re: Custom field not created with model inheritance

2008-04-13 Thread Alex Koshelev
Do you use proper django branch with model inheritance support? Trunk doesn't On Apr 13, 5:37 pm, Julien <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to have a model inherit from another which has a custom > field: > > import uuid > from django.db import models > from django.db.models.fields i

Re: Tree from the model.

2008-04-10 Thread Alex Koshelev
Try to use this very good application http://code.google.com/p/django-mptt/. On Apr 10, 11:15 pm, Dmitriy Sodrianov <[EMAIL PROTECTED]> wrote: > Hi to all. > > I have a model that can be described briefly as follows: > > class Task(models.Model): > title = models.CharField(max_length = 250) >

Re: Best practices for creating Manager methods?

2008-02-24 Thread Alex Koshelev
Manager instance is accessed by model class not instance. So there is no way to get model instance inside manager method (of course except situations when you pass it directly). If you need some extra functionality for instances the best way is to create model methods. Manager operates with the se

Re: MEDIA_URL doesnt work

2008-02-22 Thread Alex Koshelev
http://www.djangoproject.com/documentation/static_files/ troeten wrote: > Hi, > i have a problem with the MEDIA_URL in django. > My settings.py section looks like this: > > # Absolute path to the directory that holds media. > # Example: "/home/media/media.lawrence.com/" > MEDIA_ROOT = '/Users/ste

Re: coercing to Unicode

2008-02-15 Thread Alex Koshelev
__unicode__ method must return string, so def __unicode__(self): return unicode( self.ID ) On Feb 15, 4:23 am, SeanFromIT <[EMAIL PROTECTED]> wrote: > Any ideas what would cause this? > > TypeError at /admin/app/report/ > coercing to Unicode: need string or buffer, long found > > The debug

Re: How to use django.contrib.sitemaps for Django app?

2008-02-14 Thread Alex Koshelev
(r'^sitemap.xml$', and http://patrickbeeson.com/sitemaps.xml. are different urls On Feb 14, 10:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm using Django to publish my Web site and blog, and would like to > use the sitemaps app that comes with Django. But I can't get the urls > or

Re: How to serve robots.txt for Django?

2008-02-14 Thread Alex Koshelev
I use something like this: (r'^robots.txt$', 'django.views.static.serve', { 'path' : "/ txt/robots.txt", 'document_root': settings.MEDIA_ROOT, 'show_indexes': False } ), On Feb 14, 10:53 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I built a Django site for my blog and want

Re: shared state between requests and FastCGI

2008-02-14 Thread Alex Koshelev
Look at idea behind this: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser On Feb 14, 6:40 pm, Amit Ramon <[EMAIL PROTECTED]> wrote: > Hello, > > I'm developing a site that need to display ads. The ad to display on a page > is selected by a function based on the value of a global

Re: Where's HttpRequest?

2008-02-14 Thread Alex Koshelev
Hi Built-in `authenticate` function takes `**credentials` parameters that when pass to backend. So if you need request object in backed you have to pass it to built-in function. Examle: from django.contrib import auth def my_view( request ): #... auth.authenticare( username = username,

Re: reverse( ) and template tag 'url' fail when pattern has include

2008-02-13 Thread Alex Koshelev
Hi, graham Imagine that your urls2.py has some number of patterns. And then you call `reverse('eat')` what of them have to be returned? So to get proper result you have to write something like this `reverse('views.func')` On 14 фев, 02:22, grahamu <[EMAIL PROTECTED]> wrote: > Lots of people corr

Re: 'unicode' object has no attribute 'strftime'

2008-02-13 Thread Alex Koshelev
y set as a datefield, but for some reason it seems as > though my join is converting it into a string and Django doesn't like > that. > > By the way, I am using Django 0.96 and MySQL. > > On Feb 13, 10:38 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > If birt

Re: 'unicode' object has no attribute 'strftime'

2008-02-13 Thread Alex Koshelev
If birthday UserProfile field in DataField you must set date object to it. Not string. On 14 фев, 00:50, Darthmahon <[EMAIL PROTECTED]> wrote: > Hmm I seem to have hit another problem just after another! > > I've got a form that lets user's select the birthday via three > dropdowns (day, month an

Re: custom admin action?

2008-02-10 Thread Alex Koshelev
You can create a ImageFIeld subclass with needed functionality of image processing. And use it with some models. On 10 фев, 14:20, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > i have an ImageField in my model (editable only by staff memebrs), i > would like to generate a thumbnail everytime a

Re: Adding new field to model again

2008-02-07 Thread Alex Koshelev
See schema migration tools for django: http://code.djangoproject.com/wiki/SchemaEvolution On 7 фев, 20:40, bobhaugen <[EMAIL PROTECTED]> wrote: > I am trying to evolve a Django project in piecemeal-growth fashion. > > I was happy to learn that I cd easily add tables to an existing model > using s

Re: User permissions

2008-01-31 Thread Alex Koshelev
No, just now django doesn't support row level permissions. Look at this branch http://code.djangoproject.com/wiki/RowLevelPermissions On 1 фев, 02:06, Chris <[EMAIL PROTECTED]> wrote: > I've been reading up on user permissions and I have found that user > permissions are on a per-model basis. My

Re: Any way to know if a value has changed before saving?

2008-01-31 Thread Alex Koshelev
def save( self ): if self._get_pk_val(): old = MyModel.objects.get( pk = self._get_pk_val() ) if self.field != old.field: print "Values do not match" super( MyModel, self ).save() On 31 янв, 10:54, Julien <[EMAIL PROTECTED]> wrote: > Hi there, > > I'd like to ove

Re: Access context from with a custom filter

2008-01-30 Thread Alex Koshelev
Look at thread local storage. Here is an example this user instance save: http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser On 31 янв, 00:28, Paul <[EMAIL PROTECTED]> wrote: > I need to access the context from within a filter. The filter needs > to change its behavior based on the t

Re: dynamic tag count

2008-01-30 Thread Alex Koshelev
for tag in tag_list: for model in [ 'weblog', 'article', 'project' ]: print getattr( tag, model ).count() On 30 янв, 09:22, Chris <[EMAIL PROTECTED]> wrote: > Hello I have a Tagging app that I have created which could have a m2m > relation with several other applications suchas a webl

Re: Loading fixtures from views

2008-01-20 Thread Alex Koshelev
Try this code: from django.core.management.commands.loaddata import Command def my_view( request, fixture_label1, fixture_label2 ) Command().handle( fixture_label1, fixture_label2 ) #... On 20 янв, 20:04, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > To support testing (using Seleniu

Re: ImageField Example

2008-01-20 Thread Alex Koshelev
Read the docs http://www.djangoproject.com/documentation/newforms/#binding-uploaded-files-to-a-form On 19 янв, 15:32, Darthmahon <[EMAIL PROTECTED]> wrote: > Hey, > > Does anyone have a working example of uploading images using Django? > I've looked extensively and haven't found anything - any id

Re: Incorrect ImageField get_file_url() output on Windows?

2008-01-19 Thread Alex Koshelev
What path is saved into field? On 19 янв, 23:38, tom <[EMAIL PROTECTED]> wrote: > I'm doing local development on XP, and with the exeception of this, it > has worked really well. In my settings.py, I have > > MEDIA_ROOT = 'C:/worker/cms/media/' > MEDIA_URL = 'http://localhost:8000/docs/' > ADMIN_

Re: Strange Many-to-Many relationship question

2008-01-19 Thread Alex Koshelev
In your template people_list is list of UserProfile instances so avatar is accessed by {{people.avatar}} If you try to iterate through friends that you can access to avatar like so: {{friend.get_profile.avatar}} Of course if you set proper AUTH_PROFILE_MODULE setting. On 19 янв, 22:24, Darthmahon

Re: Strange Many-to-Many relationship question

2008-01-19 Thread Alex Koshelev
If you try to iterate through `friends` then you can access to avatar like so: {{friend.get_profile.avatar}} Of course if you set proper AUTH_PROFILE_MODULE setting. On 19 янв, 22:24, Darthmahon <[EMAIL PROTECTED]> wrote: > Hi, > > I'm using the built in authentication of Django, so new users who

Re: memcached

2008-01-18 Thread Alex Koshelev
http://effbot.org/zone/django-memcached-view.htm On 18 янв, 19:51, bfrederi <[EMAIL PROTECTED]> wrote: > I am using memcached as my backend for cache, but I am not sure how to > check the statistics on memcached, to see what it is actually doing. I > can tell it is working, but I want to see some

Re: Internationalization

2008-01-16 Thread Alex Koshelev
http://code.google.com/p/django-multilingual/ Helps you to have translations for database entries On 15 янв, 20:42, Grupo Django <[EMAIL PROTECTED]> wrote: > I have a Menu app that takes data from the database and renders it > into a template. I was wondering if I can translate the output from >

Re: generic views

2008-01-14 Thread Alex Koshelev
can't seem to find the proper accessor to grab > the tag_catagory value from the expression. > > Any other suggestions as to why it is not working? > > On Jan 14, 12:30 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote: > > > You must specify details in pattern >

Re: Where to store static files?

2008-01-14 Thread Alex Koshelev
The best solution is to separate admin media files and site specific files. For example: /media/admin/ - for admin static files /media/ - for others On 14 янв, 20:14, "Prof. William Battersea" <[EMAIL PROTECTED]> wrote: > Hello, > > Does any one have any suggestions for setting up apache so that:

Re: generic views

2008-01-14 Thread Alex Koshelev
You must specify details in pattern definitian http://www.djangoproject.com/documentation/generic_views/ On 14 янв, 20:08, Chris <[EMAIL PROTECTED]> wrote: > Hello I am working with a generic view and I am trying to grab the url > expression variable and pass it to a dictionary for the generic vi

Re: Multilingual text in db

2008-01-14 Thread Alex Koshelev
django-multilingual is more clean and have very good design. I have used it in some commercial projects. transdb is ugly in it design and concept. On 12 янв, 17:04, Grupo Django <[EMAIL PROTECTED]> wrote: > IMHO Internationalization is useless if there is no support for > multilingual translatio

Re: ManyToManyField - referencing attribute

2008-01-14 Thread Alex Koshelev
{% for cat in client.categories.all %} {{cat.name}} {% endfor %} On 14 янв, 16:41, shocks <[EMAIL PROTECTED]> wrote: > Hi > > I'm trying to get a ManyToManyField working in my model. It all works > fine apart from the functionality in my view template. I'm using it > to export some XML and h

Re: problem with django admin after update to development version

2008-01-14 Thread Alex Koshelev
admin/ > Exception Type: ViewDoesNotExist > Exception Value:Tried home1 in module prog_innov.views. Error was: > 'module' object has no attribute 'home1' > I dont' undestand this expression > > On Jan 14, 3:47 pm, Alex Koshelev <[EMAIL PROTECTED

<    1   2   3   4   >