Re: Get model name

2008-12-25 Thread Alex Koshelev
Foo._meta.object_name On Thu, Dec 25, 2008 at 2:44 PM, Kless wrote: > > How to know the name of the model? i.e. > > class Foo(models.Model): > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: How to implement code that runs in the background?

2008-12-26 Thread Alex Koshelev
Use cron and custom manage.py commands On Fri, Dec 26, 2008 at 10:58 AM, Fluoborate wrote: > > I have a philosophical question. How should I implement code that runs > in the background, automatically, and continuously? What is a safe and > kosher way to do that? > > >

Re: sql translation error in django?

2008-12-26 Thread Alex Koshelev
Paper.objects.filter(Journal__Name='Science').order_by("-PublishedDate") Read the documentation please. On Fri, Dec 26, 2008 at 8:43 PM, 夏恺 wrote: > > Hi all! > > I'm working on an app which has two classes: > > # This one records acedemic journal name and related

Re: cross table querying II

2008-12-26 Thread Alex Koshelev
tb1.objects.extra(select={"tb2_name": "app_tb2.name"},where=["app_tb1.name= app_tb2.name"], tables=["app_tb2"]).values("name", "tb2_name") On Sat, Dec 27, 2008 at 7:16 AM, Shuge Lee wrote: > > class tb1( models.Model ): >name = models.CharField(max_length=32) >tb2 =

Re: enumerate in templates

2008-12-27 Thread Alex Koshelev
{% for %} itself On 12/27/08, Vicky wrote: > > Is there a way to access the previous value of a for loop in > templates. Can anyone tell the template representation for the python > code like: > > for i,j in enumerate(item): >

Re: Field.default optional attribute is not working properly

2008-12-29 Thread Alex Koshelev
Default values stay only on python layer. For example you can specify any callable as default value so it cannot be "mapped" into DLL. On Mon, Dec 29, 2008 at 3:50 PM, Rama wrote: > i have a model class as below. *(please observe the red color lines)* > > class

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread Alex Koshelev
How have you created custom AdminSite? Have you registered auth and site models to it? On Mon, Dec 29, 2008 at 1:41 PM, raj wrote: > > In the usual admin index at http://host:port/admin/ page, there are > the auth and sites app visible on top of our custom app list. I'd

Re: Sites and Auth apps not visible on using custom AdminSite

2008-12-29 Thread Alex Koshelev
Right here: http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/admin.py http://code.djangoproject.com/browser/django/trunk/django/contrib/sites/admin.py On Mon, Dec 29, 2008 at 8:50 PM, raj wrote: > > Yes, I've found the way out. Adding these lines to

Re: Django in runfcgi mode does not have log even is daemonize=false

2008-12-30 Thread Alex Koshelev
How do you put messages to log? On Tue, Dec 30, 2008 at 7:08 AM, CG wrote: > > Hi, all I am using Django 1.02 + lighttpd , and I run my django app in > fastCGI mode using the following > > runfcgi method=prefork socket=/tmp/socket.sock > pidfile=/var/run/process.pid

Re: form validation does not work

2008-12-30 Thread Alex Koshelev
Please post here entire view code On Wed, Dec 31, 2008 at 8:18 AM, Chuck22 wrote: > > class ContactForm(forms.Form): > email = forms.EmailField(required=True, > widget=forms.TextInput(attrs= > {'size':'30'}), >

Re: unbalanced parenthesis

2009-01-05 Thread Alex Koshelev
You've forgotten ")" after `(?P\d{4}` On Mon, Jan 5, 2009 at 7:30 PM, mangamonk wrote: > > I'm trying to complete the practical django applications tutorial.. > > error at /weblog/ > unbalanced parenthesis > Request Method: GET > Request URL:

Re: request.FILES always empty

2009-01-05 Thread Alex Koshelev
You don't set proper `enctype` to the form [1] [1]: http://docs.djangoproject.com/en/dev/ref/forms/api/#binding-uploaded-files-to-a-form On Mon, Jan 5, 2009 at 11:34 PM, Glimps wrote: > > I'm using ModelForm to render my form. I have a FileField in my model > that shows

Re: strip_tags in django admin issues

2009-01-06 Thread Alex Koshelev
Form class really doesn't have `strip_tags` method. I think you are interested in `strip_tags` functon from `django.utils.html`(and your comment says the same). So your method may look like this: def clean_title(self): from django.utils.html import strip_tags

Re: Newbie: Help to understand string handling

2009-01-06 Thread Alex Koshelev
Yes. Django is just Python On Tue, Jan 6, 2009 at 11:14 PM, phoebebright wrote: > > As a newbie to both python and django (ex PHP) I am not clear on when > I can use python functions and when I can't. > > I want to do some simple string handling in a view, search and

Re: subquery has too many columns

2009-01-07 Thread Alex Koshelev
And what is `groupadmins`? On Wed, Jan 7, 2009 at 8:36 PM, timc3 wrote: > > I updated my django version to revision 9710 today and now I am > getting the following error message on screen: > > Caught an exception while rendering: subquery has too many columns > > This is the

Re: editing multiple records using admin list view

2009-01-11 Thread Alex Koshelev
There is an application: http://code.google.com/p/django-batchadmin/ On Sun, Jan 11, 2009 at 1:53 PM, sateeshk...@gmail.com wrote: > > Hi, > I want to edit multiple records of users ( say selecting the user > records which I want to edit ) and then say if I press >

Re: Aggregation across foreign keys / complex aggregation and annotation

2009-01-16 Thread Alex Koshelev
Try this: Process.objects.filter(exchange__input__unit__unit="kilogram")\ .annotate(sum_amount=Sum("exchange__amount"))\ .filter(sum_amount__gt=1) On Fri, Jan 16, 2009 at 12:38 PM, Christopher Mutel wrote: > > Following the

Re: meet issue in Django tutorail

2009-01-16 Thread Alex Koshelev
Do you have the `__init__.py` file in mysite directory? On Fri, Jan 16, 2009 at 2:21 PM, syo wrote: > > hi , i'm now reading a Django tutorail naming: > "Writing your first Django app, part 1" > > In the "Activating models" part , it asks me to: > 1. add

Re: ifequal with floatformat:"0" doesn't work

2009-01-20 Thread Alex Koshelev
Just now {% ifequal %} tag doesn't apply filters to its operands. On Tue, Jan 20, 2009 at 2:58 PM, ltcstyle wrote: > > is this a bug or what? > > {{float_number|floatformat:"0"}} give me correct number 1 > > but > {% ifequal float_number|floatformat:"0" 1 %} > never match >

Re: Error when Resending forgotten password

2009-01-22 Thread Alex Koshelev
Try to check your EMAIL_ settings. On Fri, Jan 23, 2009 at 8:55 AM, Oleg Oltar wrote: > Hi! I am getting a strange error when trying to reset, forgotten password. > I am using it this way > ># Password resend group >

Re: Error: 'PersonForm' object is not callable

2009-01-22 Thread Alex Koshelev
You don't need to "call" form second time: pForm = PersonForm(request.POST.copy(), instance=p) And pForm is the ready to use instance of form. On Fri, Jan 23, 2009 at 8:29 AM, waltbrad wrote: > > Hi folks. PersonForm is a modelform. I'm trying to validate data

Re: Refresh Queryset - I know the answer is there somewhere

2009-01-23 Thread Alex Koshelev
Your query executes in module import time and it happens only one time. So you cannot reevaluate it using choices field param like that. Solution - redefine form `__init__` and manually reassign choices to given field every time form is created. def __init__(self, *args, **kwargs):

Re: Several test files

2009-01-23 Thread Alex Koshelev
Yes, you can do that. You can create tests package with some test modules and in `__init__.py` import needed test cases into package namespace. On Fri, Jan 23, 2009 at 12:29 PM, gderazon wrote: > > My tests.py has become too big, I want to split it to several test > files >

Re: Last-Modified headers and render_to_response

2009-01-24 Thread Alex Koshelev
Just now you can store response object for a while and don't return it immediately. When set needed headers response = render_to_response("foobar.html") response["Last-Modified"] = "some value" return response On Sat, Jan 24, 2009 at 8:24 PM, Viktor Nagy wrote: > Hi, >

Re: Import Fixtures per test

2009-01-24 Thread Alex Koshelev
Extract this test to its own TestCase with needed fixtures. On Sat, Jan 24, 2009 at 8:15 PM, Vitaly Babiy wrote: > Is there a way to specify which fixtures I want to import per test? > > Vitaly Babiy > > > > --~--~-~--~~~---~--~~ You

Re: Queryset unexpectedly turning into list

2009-01-24 Thread Alex Koshelev
All magic happens in line: if(queryset):#check if query returned somethin To perform this check QuerySet is evaluated and makes query to DB and stores result in list. After that QuerySet slice operation make real slice on underlying cache and of cource return list. On Sun, Jan 25, 2009 at 1:26

Re: Issue with save(commit=False). Can't append primary key.

2009-01-26 Thread Alex Koshelev
Form.save() returns an object. So your code may look like this: comment = commentform.save(commit=False) comment.entry = entry comment.save() On Mon, Jan 26, 2009 at 7:28 PM, Ty wrote: > > Here's a snip of my model: > > class Comment(models.Model):

Re: Django unittest fails to check empty values

2009-01-26 Thread Alex Koshelev
What DB backend do you use? In some cases it rises OperationalError On Mon, Jan 26, 2009 at 2:25 PM, marco sedda wrote: > > Hi, I've a problem with unittest in django: > > I've described a models.py: > >class Season(models.Model): >name =

Re: admin list display icons for callable?

2009-01-26 Thread Alex Koshelev
Try this: def photo_ad(self): if self.photo: return True return False photo_ad.boolean = True --- Александр Кошелев daeva...@gmail.com On Tue, Jan 27, 2009 at 8:51 AM, Paddy Joy wrote: > > The admin interface

Re: How do I correctly format a Querydict derived list in a url?

2009-01-30 Thread Alex Koshelev
Try this: return HttpResponseRedirect('/activities/%s/' % "-".join(location_filter)) On Fri, Jan 30, 2009 at 10:26 PM, Alfonso wrote: > > I've got a form delivering multiple variables from a checkbox group > via POST to a view that defines where to redirect to. > >

Re: "invalid reference to FROM-clause" for nested annotate query

2009-01-31 Thread Alex Koshelev
What database backend do you use? On Sat, Jan 31, 2009 at 6:44 PM, omat wrote: > > Hi all, > > I obtain a list of tag ids by: > tag_ids = TaggedItem.objects.all().order_by('-added__max').annotate(Max > ('added'))[:10] > > and try to use it in the following query to obtain tag

Re: Displaying the names of executed tests

2009-02-02 Thread Alex Koshelev
Look at the `--verbosity` test command option On Mon, Feb 2, 2009 at 3:16 PM, Julien Phalip wrote: > > Hi, > > I'd find quite useful to have the names of all the tests displayed > after they have been executed. Instead of just having something like > 'Ran 3 tests 0.672s',

Re: Model Form Field Ordering

2009-02-04 Thread Alex Koshelev
The is no public/documented API for reorder fields, but you can do some trick with SortedDict: class MyModelForm(forms.ModelForm): mySpecialField = forms.ChoiceField(label='Special', choices=(('a','aa'))) class Meta: model = MyModelType MyModelForm.base_fields.keyOrder =

Re: get_FOO_display

2009-02-06 Thread Alex Koshelev
get_FOO_display is an instance method not field. So try this: {{ object.get_invoice_type_display }} On Fri, Feb 6, 2009 at 6:09 PM, Alfonso wrote: > > I've got a field called 'invoice_type' which is a ChoiceField. > > In my template I'm trying to pull out the

Re: Adding fields to model objects that don't correspond to database state

2009-02-08 Thread Alex Koshelev
try this: def attach_bar(self, bar): if getattr(self, "bars", None) is None: self.bars = [] self.bars.append(bar) On Mon, Feb 9, 2009 at 12:03 AM, Jack Orenstein wrote: > > I have a model object that looks something like this: > >

Re: order_by Ignore case

2009-02-11 Thread Alex Koshelev
You can do the same trick with django: Entry.objects.extra(select={'foo_upper': 'upper(foo)'}, order_by=['foo_upper']) On Wed, Feb 11, 2009 at 7:20 PM, jeffhg58 wrote: > > I currently have a field which has upper and lower case characters. Is > there a way for the django

Re: Strange url tag behaviour

2009-02-11 Thread Alex Koshelev
Leave it empty FORCE_SCRIPT_NAME ='' On Wed, Feb 11, 2009 at 8:36 PM, Leslie Maclachlan wrote: > Thanks Dmitry, > > I entered it as: FORCE_SCRIPT_NAME = '/var/opt/django/projects/ilayer' this > has not resolved it - did I put it in the correct format? > > Regards, >

Re: get_absolute_url always returning empty string

2009-02-15 Thread Alex Koshelev
Why do you wrap two times the same `get_absolute_url` with `models.permalink` decorator? On Sun, Feb 15, 2009 at 10:42 AM, Michael Strickland wrote: > > Completely lost on this... I'm trying to set up permalinks to my > articles, which are using generic views. I've gotten

Re: Keys composed of multiple fields

2009-02-16 Thread Alex Koshelev
Django doesn't suppurt multi-field PKs. Try to search this group for more diussion. On Mon, Feb 16, 2009 at 12:43 PM, jfmxl wrote: > > Hi again, > > How do I handle multifield keys? > > I have multifield primary keys which are in turn used as foreign keys > in other tables. > >

Re: Template rendering error

2009-02-20 Thread Alex Koshelev
Do you read an attribute resolution rules [1]? [1]: http://docs.djangoproject.com/en/dev/topics/templates/#variables On Fri, Feb 20, 2009 at 5:53 PM, Timothy <83...@gmx.de> wrote: > > Hi Folks, > > in views: > > return render_to_response('tliste/import.html', {'data': > allWrongData}) > >

Re: Removing fields in a form subclass

2009-02-20 Thread Alex Koshelev
Try this: del SubForm.fields['fields2'] On Fri, Feb 20, 2009 at 6:15 PM, David Zhou wrote: > > Suppose I had this form: > > class BaseForm(forms.Form): >field1 = forms.CharField(...) >field2 = forms.Charfield(...) > > And then in a subclass, I had: > > class

Re: Removing fields in a form subclass

2009-02-20 Thread Alex Koshelev
No. Place this code right after the SubForm definition. On Fri, Feb 20, 2009 at 6:42 PM, David Zhou <da...@nodnod.net> wrote: > > Do you mean del self.fields['field2'] in SubForm's __init__? > > -- dz > > > > On Fri, Feb 20, 2009 at 10:39 AM, Alex Koshelev <dae

Re: Removing fields in a form subclass

2009-02-20 Thread Alex Koshelev
Oh, sorry. Of course `base_field` instead. class SubForm(BaseForm): field1 = forms.EmailField(...) del SubForm.base_fields['fields2'] On Fri, Feb 20, 2009 at 6:45 PM, Alex Koshelev <daeva...@gmail.com> wrote: > No. Place this code right after the SubForm definition. > > &

Re: Can QuerySet methods combine filters with an "OR" conjunction?

2009-02-21 Thread Alex Koshelev
You have to use `Q` objects [1] [1]: http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects On Sat, Feb 21, 2009 at 9:40 PM, Nate Morse wrote: > > Before I go down the road of writing SQL by hand or using > QuerySet.extra(...) [ don't know

Re: Manually parsing a URL and returning the view name and args

2009-02-27 Thread Alex Koshelev
Of course within `reverse` function there is `resolve` function that parses path and return view function, positional arguments, and named arguments. On Fri, Feb 27, 2009 at 2:33 PM, Andrew Ingram wrote: > > Hi All, > > I'm trying to to build a model which can store a

Re: How to compare two different types in templates using ifequal

2009-03-02 Thread Alex Koshelev
Just now {% ifequal %} doesn't support filter expressions as arguments. So you must prepare values by {% with %} tag before using them in {% ifequal %}. On Mon, Mar 2, 2009 at 12:22 PM, eli wrote: > > Hi, > > I have a problem: > > Python: > week = [1, 2, 3, 4, 5, 6,

Re: count and group by aggregation

2009-03-06 Thread Alex Koshelev
Try this: R.objects.values('type').aggregate(Count('type')) On Fri, Mar 6, 2009 at 10:12 PM, kbs wrote: > > Hello, > > I got a model with a type field > > > class R(mode): >type = CharField(max_length=100) > > > Here is what im trying to do using sql notation: > > >

Re: manage.py dumpdata app.model doesn't seem to work?

2009-03-06 Thread Alex Koshelev
This `dumpdata` command you can only serialize whole application not just its models. On Fri, Mar 6, 2009 at 11:17 PM, John M wrote: > > I tried using the command > > $ python manage.py dumpdata app.model. > > where app is the name of my application and model is one of

Re: Insert insetad edition with model form

2009-03-10 Thread Alex Koshelev
What task_id do you send when editing the entry? On Tue, Mar 10, 2009 at 3:54 PM, Dmitry Teslenko wrote: > > Hello! > > I'm starting with django framework; I use django 1.0 and sqlite > database backend. > I've stumbled upon this thing: when editing model entry with

Re: django.core.management changes

2007-08-30 Thread Alex Koshelev
try this: from django.core.management import call_command call_command( "reset", models.get_app('myapp'), interactive = False ) call_command( "load_data", [FIXTURE_PATH], verbosity = 0 ) --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Newbie with generic views

2007-08-30 Thread Alex Koshelev
What is field.choices ? object_list doesn't pass _field_ variable to context. http://www.djangoproject.com/documentation/generic_views/#django-views-generic-list-detail-object-list see Template context section --~--~-~--~~~---~--~~ You received this message

Re: admin site and parent/child relationship

2007-08-30 Thread Alex Koshelev
There is no way to do so in django admin now. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group,

Re: Collapse edit inline?

2007-08-30 Thread Alex Koshelev
No, you can not collapse edit inline block in admin. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this

Re: problem with importing "Template" module

2007-08-31 Thread Alex Koshelev
You can do in django interactive shell. http://www.djangoproject.com/documentation/django-admin/#shell Or set DJANGO_SETTINGS_MODULE environment variabale ot your project settings.py http://www.djangoproject.com/documentation/templates_python/#configuring-the-template-system-in-standalone-mode

Re: template context issue with "with"

2007-08-31 Thread Alex Koshelev
{%with%} tag creates only alias to variable. You cannot use it as parameter and "regular" context variable too. So you have to redesign you code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users"

Re: send_mail() doesn't handle extra headers?

2007-08-31 Thread Alex Koshelev
Yes, you may use EmailMessage class that is more flexible then send_mail function http://www.djangoproject.com/documentation/email/#the-emailmessage-and-smtpconnection-classes --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: problem with importing "Template" module

2007-09-01 Thread Alex Koshelev
In shell: export PYTHON_PATH=/path/to/dir/where/settings.py/script/lies/: $PYTHON_PATH export DJANGO_SETTINGS_MODULE=settings --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: truncating posts with markdown

2007-09-03 Thread Alex Koshelev
Markdown wraps all text in tag so truncate_html doesn't work --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe

Re: Sharing models between applications

2007-09-03 Thread Alex Koshelev
Just put the full import path to your app in INSTALLED_APPS. It's no mater where this application lies. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: newforms and DateField

2007-09-03 Thread Alex Koshelev
There is no way to use admin's calendar into regular pages with newforms. You have to implement it by yourself. On 3 сент, 11:07, picky <[EMAIL PROTECTED]> wrote: > That's what I was thinking. I try it but I don't fuind how to display > calendar button. > I don't see anything in http code of an

Re: Signals Question - Firing off an email after a save

2007-09-03 Thread Alex Koshelev
save() is method, so it must get at least one parameter - self. def save( self ): ... > > TypeError at /admin/envwork/environment/12/ > save() takes no arguments (1 given) > > Any thoughts? > --~--~-~--~~~---~--~~ You received this message because you are

Re: Unable to get Django to output variables when calling from a different app

2007-09-03 Thread Alex Koshelev
Please show your views code or tell what you pass into template context. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To

Re: How to convert a Django model item to the underlying python object

2007-09-03 Thread Alex Koshelev
Each field class has to_python() method: class MyModel( models.Model ): date = models.DateField() # field = MyModel._meta.get_field( "date" ) date_obj = field.to_python( "2007-09-03" )#date_obj is python Date instance --~--~-~--~~~---~--~~ You received

Re: Unable to get Django to output variables when calling from a different app

2007-09-03 Thread Alex Koshelev
Yes you can try to play with custom template tags or with context processors http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: how to select posts in this situation?

2007-09-03 Thread Alex Koshelev
Something like this: from django.db.models import Q import operator query_set = Post.objects.all() users = [ Q( user = user) for user in [ user1, user2, user3 ] ] query_set = query_set.filter( reduce(operator.or_, users ) ) --~--~-~--~~~---~--~~ You received

Re: Calling User data from within templates

2007-09-03 Thread Alex Koshelev
Check your TEMPLATE_CONTEXT_PROCESSOR setting. auth TCP must be installed http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-auth On 3 сент, 22:33, Robert <[EMAIL PROTECTED]> wrote: > Hi all, I'm new to Django and python in general, so please overlook my

Re: Calling User data from within templates

2007-09-03 Thread Alex Koshelev
Yes. You have to use RequestContext. If you don't use it django will not execute context processors and user variable never be passed into context On 4 сент, 00:41, Robert <[EMAIL PROTECTED]> wrote: > I'm not sure that requestContext was what i needed... I need simply to > be able to get user

Re: How to add a non database item to a python model

2007-09-04 Thread Alex Koshelev
http://www.djangoproject.com/documentation/models/custom_methods/ On 4 сент, 07:21, shabda <[EMAIL PROTECTED]> wrote: > I have a python model > > class MyModel(models.Model): > fld1 = models.TextField() > fld1 = models.TextField() > > I want to have a non database item in this

Re: existing tables

2007-09-04 Thread Alex Koshelev
Look this: http://www.djangoproject.com/documentation/django-admin/#inspectdb Creates django models from the existing db structure On 4 сент, 11:25, [EMAIL PROTECTED] wrote: > hello > > I am very new to django. > > What can I do to reach existing tables ? > > in examples I met, new tables have

Re: How to add a non database item to a python model

2007-09-05 Thread Alex Koshelev
Show all exception dump --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Re: adding field to model

2007-09-06 Thread Alex Koshelev
http://code.djangoproject.com/wiki/SchemaEvolution On 6 сент, 14:51, ksuess <[EMAIL PROTECTED]> wrote: > hi. I had to add a field to an existing model. how do i update the db? > (of course there is content.) --~--~-~--~~~---~--~~ You received this message

Re: data manipulation in templates or views?

2007-09-07 Thread Alex Koshelev
Templates just represents data to the client, all calculations must by in views or model methods --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: FileInput widget and FileField

2007-09-10 Thread Alex Koshelev
Read the docs: http://www.djangoproject.com/documentation/db-api/#get-foo-filename On 10 сент, 11:19, Ronald <[EMAIL PROTECTED]> wrote: > Hi there, > > I need a little bit of help here. > > I want to let user to import a csv file which will be parsed into the > database. > I am thinking of using

Re: how to access the host-name in settings.py

2007-09-13 Thread Alex Koshelev
Where is no way to find host name in settings module. To solve the problem you can split your settings.py file into host-specified- settings.py and settings.py Into settings.py: from host-specified-settings import * So you can have one settings.py but many host-specified files at different

Re: ifequal function not working?

2007-09-13 Thread Alex Koshelev
Hmm... What is `recordset`? QuerySet? QuerySet doesn't have id attribute. {% for recod in recodeset %} {% ifequal record.id selected_id %} Selected! {% endifequal %} {% endfor %} --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: two questions about data model

2007-09-15 Thread Alex Koshelev
Thereis no `length` argument in Field constructor. Don't use it. Your User already has imagefiel_set attribute, so you have to define another related name for imagefile manager. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Getting an object's meta value

2007-09-18 Thread Alex Koshelev
MyModel._meta.verbose_name On 18 сент, 20:31, Rob Slotboom <[EMAIL PROTECTED]> wrote: > For a class method I want to use the value of the > Model>Meta>verbose_name. > Can someone tell me how to get this value? > > Thanks, Rob --~--~-~--~~~---~--~~ You received

Re: form variables in templates

2007-09-22 Thread Alex Koshelev
Yes. If you had request context processor installed you can access to variables like so {{request.POST.foo}} On 22 сент, 18:47, Florian Lindner <[EMAIL PROTECTED]> wrote: > Hello, > can I access form variables (like request.POST["foo"]) in a template? Without > writing them in the argument

Re: shemas evolution

2007-09-23 Thread Alex Koshelev
There is limited functionality for ALTER in sqlite On 23 сент, 09:19, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 9/22/07, Alexandre Forget <[EMAIL PROTECTED]> wrote: > > > I wonder what people are using *right now* to evolve their data ? > > ALTER TABLE. > > No, really ;) > > -- >

Re: model objects question

2007-09-23 Thread Alex Koshelev
class Country(models.Model): #... class Meta: ordering = ('name','tour',) On 23 сент, 03:47, Oleg Korsak <[EMAIL PROTECTED]> wrote: > Hello. I have such models: > > class Country(models.Model): > name = models.CharField(_('name'), maxlength=32) > >

Re: How does Django know the PK of the newly created object

2007-09-23 Thread Alex Koshelev
I think that when you create Product object django inserts new row into database and retrieves with SELECT new id. On 23 сент, 16:00, Siah <[EMAIL PROTECTED]> wrote: > Hi, > > When in a model you run something like this: > > >> obj = Product(name='Apple') > >> obj.id > > 4 > > I realize the

Re: QUERY

2007-09-23 Thread Alex Koshelev
If you want use django templates standalone read this: http://www.djangoproject.com/documentation/templates_python/#configuring-the-template-system-in-standalone-mode P.S. Why "query"? On 23 сент, 17:26, mayank bhargava <[EMAIL PROTECTED]> wrote: > when i type : >>>from django.template import

Re: admin gives error on add or select item from list

2007-09-23 Thread Alex Koshelev
Check that your __str__/__unicode__ model's methods return strings On 23 сент, 17:41, paulh <[EMAIL PROTECTED]> wrote: > I select a model in the initial admin page and am offered a choice of > the available instances/rows to change. If I either select one of > these, or press the add button I

Re: Design a model for a Blog

2007-09-23 Thread Alex Koshelev
Slug is very good when you want to create "fine" urls. You can convert (using prepopulate_from param) your title field of entry to slug and use it for entry's permalink. But of course you can use entry's id(integer value) for url mapping On 23 сент, 17:12, Florian Lindner <[EMAIL PROTECTED]>

Re: How does Django know the PK of the newly created object

2007-09-23 Thread Alex Koshelev
> > > The code: > > obj = Product(name='Apple') > > > obj.id will not be set until you either explicitly set it, or call > > save(), at which time django will utilize the lack of a pk (among > > other things) to determine whether or not to do an insert or update. &

Re: Design a model for a Blog

2007-09-24 Thread Alex Koshelev
No, you must set unique=True argument manual for slug field On 24 сент, 23:39, Florian Lindner <[EMAIL PROTECTED]> wrote: > Am Sonntag, 23. September 2007 schrieb Alex Koshelev: > > > Slug is very good when you want to create "fine" urls. You can convert > > (

Re: guid's in python

2007-09-25 Thread Alex Koshelev
http://www.djangosnippets.org/snippets/335/ On 25 сент, 00:52, Leo Shklovskii <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to represent an Active Directory's user guid in Django. In > AD, its a 128 bit integer that I can pull out with using the ldap > library. When I access the guid, python

Re: about auth

2007-09-27 Thread Alex Koshelev
You may write special admin interface or wait when low-level permission will be placed in django. On 27 сент, 16:54, "Lic. Jos M. Rodriguez Bacallao" <[EMAIL PROTECTED]> wrote: > hi people, I got a little question, how can I make some users add news > (model News), modify only news owned by him

Re: Objects.get() need to limit 1 record

2007-10-01 Thread Alex Koshelev
user = User.objects.filter(email='[EMAIL PROTECTED]')[ 0 ] On 1 окт, 10:30, cschand <[EMAIL PROTECTED]> wrote: > Hello all, > I have a problem with get objects from User > > when i give > user = User.objects.get(email='[EMAIL PROTECTED]') > > if only one data is there it is executing ok... but

Re: Django-multilingual

2007-10-07 Thread Alex Koshelev
I've use django-multilingual in many projects and happy. It's simple to integrate and use. No other implementations can do it so transparent for developer and end user( django-multilingual extends admin edit page and allows edit entry in all languages very simple). Use it! Chris Hoeppner: > Hi

Re: Multilanguage - I know what I want, should I do it this way?

2007-10-11 Thread Alex Koshelev
Look at this: http://code.google.com/p/django-multilingual/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe

Re: The signal is not working... I don't know what's wrong

2007-10-11 Thread Alex Koshelev
1. Related objects are deleted automatically 2. post_delete signal sends when object already is deleted. so it has no primary key(id=None) On 11 окт, 17:33, "Young Gyu Park" <[EMAIL PROTECTED]> wrote: > > def delete_comment_by_entry(sender, instance, signal, *args, **kwargs): > > entry =

Re: How to allow a ForeignKey field to be null

2007-10-11 Thread Alex Koshelev
You must recreate your database tables for this application. See docs for "manage.py reset" --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: linking to external resources

2007-10-11 Thread Alex Koshelev
> open in the browser and just shows me lots of (IMHO) garbage it just binary data of your chm file. how do you serve static data? through apache or other? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django

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

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

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

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

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

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

  1   2   3   4   >