Re: Retrieving the values from query set

2009-08-03 Thread Subramanyam Vemu
Hi Malcom The values_list() returns a list of tuples whereas I am looking for a simple list of the values On Mon, Aug 3, 2009 at 10:48 AM, Malcolm Tredinnick < malc...@pointy-stick.com> wrote: > > On Sun, 2009-08-02 at 21:59 -0700, bvemu wrote: > [...] > > Is there a django way of retrieving

Re: Retrieving the values from query set

2009-08-03 Thread Daniel Roseman
On Aug 3, 7:03 am, Subramanyam Vemu wrote: > Hi Malcom > > The values_list() returns a list of tuples whereas I am looking for a simple > list of the values > >From the link Malcolm so helpfully provided: "If you only pass in a single field, you can also pass in the `flat`

Re: Retrieving the values from query set

2009-08-03 Thread Subramanyam Vemu
Hi Daniel ,Malcom Thanks for the reply That exactly was the solution I wanted On Mon, Aug 3, 2009 at 11:47 AM, Daniel Roseman wrote: > > On Aug 3, 7:03 am, Subramanyam Vemu wrote: > > Hi Malcom > > > > The values_list() returns a list of tuples

Re: Caching template fragments without specifying expiration time

2009-08-03 Thread Reiner
Be aware that the way the cache key is constructed changed a bit. I'm also invalidating template fragments when models used for rendering changed, and found this while randomly reading changesets: It used to be: fragment_name:additional:arguments:seperated:by:colons Now it is:

how to modified filefiled after created it

2009-08-03 Thread Shuge Lee
Please take a look http://dpaste.com/74606/ or here # in models.py UNAPPROVE = 0 ACCEPT = 1 REJECT = 2 unapprove_path = os.path.join(MEDIA_ROOT, 'unapprove') accept_path = os.path.join(MEDIA_ROOT, 'accept') reject_path = os.path.join(MEDIA_ROOT, 'reject') def get_filepath(instance,

Re: how to modified filefiled after created it

2009-08-03 Thread Shuge Lee
I think Django could add new API for FileField such as FileField.change_path(new_path) On Aug 3, 7:28 am, Shuge Lee wrote: > Please take a lookhttp://dpaste.com/74606/ > > or here > > # in models.py > > UNAPPROVE = 0 > ACCEPT = 1 > REJECT = 2 > > unapprove_path =

Admin: raw-id: Link to edit page

2009-08-03 Thread Thomas Guettler
Hi, How can I display a link to the edit page of a foreign key? Example: class Place: city=models.ForeignKey(City) In the admin page of the place I want a link to the city admin page. Regards, Thomas Güttler -- Thomas Guettler, http://www.thomas-guettler.de/ E-Mail: guettli (*)

ForeignKey drop box modification in admin site

2009-08-03 Thread Oleg Oltar
Hi! I have 3 models: categories sections articles Each section is related to some category, and in similar way each article is related to some section: The code looks like this: class Category(models.Model): category = models.CharField(max_length=200) name =

Re: Scientific Data Frontend with Django

2009-08-03 Thread Markus Becker
Hi, last week I started something in this direction. Similarly to admin.py (which describes how to administrate the data) there is a graph.py, which describes how to graph the data. It is still very rough on the edges, but you can use matplotlib in graph.py to create a plot of the data. Possibly

many to many model

2009-08-03 Thread elminio
Hello, My problem is that I have (for example), a model teacher - subject many to many. So that I made additional table named teacherSubject with both ids. Now I would like to have an opportunity to add subjects to Teachers in admin panel but no by id of the subject but by name. Now according

Re: app __init.py__ question

2009-08-03 Thread chexov
On Aug 3, 2:46 am, joep wrote: > Hi all, > > I have both a project and an app I just created (using django-admin). > I modified the __init.py__ file in the app to execute a print > statement on import. But it gets executed twice when I start the > development server. > >

Non html safe chars on urls,

2009-08-03 Thread Mirat Bayrak
Hi i have an account system that you have to validate your email after you created an account. My validation url is lik : www.foo.com/account/confirm/* username/keyyy* But there is a problem, sometimes username contains non html safe chars for example : *â*lice, or s*ü*leyman cant go that

Re: Non html safe chars on urls,

2009-08-03 Thread Maksymus007
On Mon, Aug 3, 2009 at 11:27 AM, Mirat Bayrak wrote: > Hi i have an account system that you have to validate your email after you > created an account. My validation url is lik : > www.foo.com/account/confirm/username/keyyy > > But there is a problem, sometimes

how to, complex filters in admin

2009-08-03 Thread selcukcihan
Hi, is there a ready to go solution within django for providing complex filters(besides the date filters and others) on models within the admin? For instance, there is a model with an integer field, i would like to be able to apply filters of the form "greater than or equal to" or "between this

Re: Scientific Data Frontend with Django

2009-08-03 Thread Frank Stüss
My grain of salt: I use django with matplotlib for a data plotting view in a status control app. It is updated every 20sec or so. With plotting embedded in my django app and called via ajax i encountered a memory leak within numpy and/or matplotlib that caused to crash the server after a week

UserProfile and select_related

2009-08-03 Thread alant...@neei.uevora.pt
Hello, I'm displaying lot of user profile picture with are on a user profile (i'm using contrib.auth). So for each picture I have a query for the user profile. I wanted to use User.objects.filter(stuff).select_related ('userprofile') but this has no effect. Any ideas how to prevent the +200

Re: many to many model

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 02:24 -0700, elminio wrote: > Hello, > > My problem is that I have (for example), a model teacher - subject > many to many. So that I made additional table named teacherSubject > with both ids. Instead of thinking about what database tables would be created, use Django's

Re: Non html safe chars on urls,

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 12:27 +0300, Mirat Bayrak wrote: > Hi i have an account system that you have to validate your email after > you created an account. My validation url is lik : > www.foo.com/account/confirm/username/keyyy > > But there is a problem, sometimes username contains non

Re: UserProfile and select_related

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 02:48 -0700, alant...@neei.uevora.pt wrote: > Hello, > > I'm displaying lot of user profile picture with are on a user profile > (i'm using contrib.auth). So for each picture I have a query for the > user profile. > > I wanted to use

Re: need help with model design and table relationship

2009-08-03 Thread Unnamed_Hero
Thanks for your reply. And the point is that (forgot to say)... the boss field in c12b table doesn't exists, it is virtual and exists only in my model. I think, this trick can work for me, but I've got (c12b_boss relation does not exist). I thought, that if I point it to a real A22 field (unique

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Peter Bengtsson
On 3 Aug, 10:12, Thomas Guettler wrote: > Hi, > > How can I display a link to the edit page of a foreign key? > > Example: > > class Place: >     city=models.ForeignKey(City) > > In the admin page of the place I want a link to the city admin page. > class

Re: need help with model design and table relationship

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 03:19 -0700, Unnamed_Hero wrote: > Thanks for your reply. > > And the point is that (forgot to say)... the boss field in c12b table > doesn't exists, it is virtual and exists only in my model. When you add a ManyToManyField to a Django model, it doesn't create a column in

Re: how to modified filefiled after created it

2009-08-03 Thread Peter Bengtsson
Not sure I understand what you want to achive but you talked about changing one class attribute when you change another. Look at this for example/inspiration:: class Foo(object): status = '' def __init__(self): self.name = '' def __setattr__(self, k, v): if k ==

Re: newbie tutorial part 1 startproject doesn't create folder and appropriate files

2009-08-03 Thread Peter Bengtsson
Look at if perhaps the project "mysite" was created somewhere else, like for example where the django-admin.py file is located. If so, there could be a fundamental problem with your setup or a bug in the windows implementation for django-admin.py At worst, search your whole hard drive for it. On

Re: many to many model

2009-08-03 Thread elminio
Hi, tahnks for reply I added additional ManyToManyfield to one table and admin panel looks ok but in fact even using syncdb new intermediate table wasn't created. Is there anything else I should do ? --~--~-~--~~~---~--~~ You received this message because you

Help building a custom RadioSelect widget.

2009-08-03 Thread Sam Walters
Hi fellow Django users. This is the first time necessity has required me to look at overriding functionality in the django code. I need to replace the and tags in a choicefield using radio buttons with tags as my project has very specific formatting requirements for this form. I basically

Re: Image handling - Custom image field?

2009-08-03 Thread Peter Bengtsson
I would write a management command and let a cron job fire off to run it. See this for how to write management commands: http://docs.djangoproject.com/en/dev/howto/custom-management-commands/ Then your cron job can look something like this: */5 * * * * python /path/to/manage.py copyfromftp >>

Two django devlopments under same apache config

2009-08-03 Thread Miguel
Hi all, I would like to configure two django sites using the same apache. One running on 80 port and other running on 8080 port. The problem I have found is that the configuration I have done for the second one it is using teh configuration of the first one (settings.py) I have set the

Re: Two django devlopments under same apache config

2009-08-03 Thread Graham Dumpleton
On Aug 3, 8:56 pm, Miguel wrote: > Hi all, > > I would like to configure two django sites using the same apache. One > running on 80 port and other running on 8080 port. > The problem I have found is that the configuration I have done for the > second one it is using teh

Re: Two django devlopments under same apache config

2009-08-03 Thread Miguel
thank you graham! Miguel Sent from Madrid, Spain On Mon, Aug 3, 2009 at 1:07 PM, Graham Dumpleton wrote: > > > > On Aug 3, 8:56 pm, Miguel wrote: > > Hi all, > > > > I would like to configure two django sites using the same apache. One > >

Re: many to many model

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 03:49 -0700, elminio wrote: > Hi, > tahnks for reply I added additional ManyToManyfield to one table and > admin panel looks ok but in fact even using syncdb new intermediate > table wasn't created. > Is there anything else I should do ? Syncdb does not incrementally update

Re: how to, complex filters in admin

2009-08-03 Thread Peter Bengtsson
Untested but should work (in admin.py): class ThingAdmin(admin.ModelAdmin): def queryset(self, request): qs = super(ThingAdmin, self).queryset(request) qs = qs.filter(some_integer_field__gt=10) return qs admin.site.register(Thing, ThingAdmin) On 3 Aug, 10:52,

Re: Scientific Data Frontend with Django

2009-08-03 Thread Torsten Bronger
Hallöchen! blaine writes: > [...] > > My question: Has anyone used (or heard of using) a Django-powered > application as a quick and powerful frontend to a scientific > database? My scientific institute is about to create a database for the samples (thin silicon layers) produced here. We have

cab snippet add gives error

2009-08-03 Thread andreas schmid
hi, im trying to build the cab code sharing app with the practical django projects book, at the moment i have a problem adding snippets bc i get this error: http://dpaste.com/74671/ solutions? thx --~--~-~--~~~---~--~~ You received this message because you are

WAR creation problem

2009-08-03 Thread Sumeet
Hi Can anyone help me creating WAR file of a Django project. Somewhere I realized we need Jython to do this. So I installed Jython on my machine and then tried to create WAR file using the following command from my project directory. jython manage.py war But its repeatedly showing me an error

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Thomas Guettler
Thank you Peter. But list_display does not get used on the edit page of an object. If you use raw_id the ID of the foreign key gets displayed right to the input field. It would be nice to make it a hyperlink. HTH, Thomas Peter Bengtsson schrieb: > > > On 3 Aug, 10:12, Thomas Guettler

Re: how to modified filefiled after created it

2009-08-03 Thread Shuge Lee
NO just image add new seed in admin upload a file with status "UNAPPROVE" then you change its status as "ACCET" the problem is, the file you upload is still point to UNAPPROVE_PATH how to make it point to ACCEPT_PATH ? On 8月3日, 下午6时45分, Peter Bengtsson wrote: > Not sure I

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread cootetom
When I first started using django I was surprised that it limited usernames and didn't allow email address's by default. It is probably the only thing in the whole framework that I have wanted to change. Yes it would be nice to have a clear solution rather than the approach I have taken which is

Re: UserProfile and select_related

2009-08-03 Thread Alex Gaynor
On Mon, Aug 3, 2009 at 5:12 AM, Malcolm Tredinnick wrote: > > On Mon, 2009-08-03 at 02:48 -0700, alant...@neei.uevora.pt wrote: >> Hello, >> >> I'm displaying lot of user profile picture with are on a user profile >> (i'm using contrib.auth). So for each picture I have a

Re: UserProfile and select_related

2009-08-03 Thread lfrodrigues
Ok Thanks On Aug 3, 12:12 pm, Malcolm Tredinnick wrote: > On Mon, 2009-08-03 at 02:48 -0700, alant...@neei.uevora.pt wrote: > > Hello, > > > I'm displaying lot of user profile picture with are on a user profile > > (i'm using contrib.auth). So for each picture I have

Re: how to modified filefiled after created it

2009-08-03 Thread Daniel Roseman
On Aug 3, 1:29 pm, Shuge Lee wrote: > NO > > just image add new seed in admin > > upload a file with status "UNAPPROVE" > then you change its status as "ACCET" > the problem is, the file you upload is still point to UNAPPROVE_PATH > > how to make it point to ACCEPT_PATH ?

Re: app __init.py__ question

2009-08-03 Thread Karen Tracey
On Mon, Aug 3, 2009 at 3:20 AM, chexov wrote: > > On Aug 3, 2:46 am, joep wrote: > > Hi all, > > > > I have both a project and an app I just created (using django-admin). > > I modified the __init.py__ file in the app to execute a print > >

why is not IntegrityError an attribute of models?

2009-08-03 Thread dnedbaylo
Hey All, I have a model with unique field. Here is what i get when i try to save record with not-unique field value: >>> from psdj.ksel import models >>> try: ... m = models.Keyword(phrase='insurance') ... m.save() ... except models.Keyword.IntegrityError, e: ... print e ... Traceback

Re: why is not IntegrityError an attribute of models?

2009-08-03 Thread Daniel Roseman
On Aug 3, 3:08 pm, dnedbaylo wrote: > Hey All, > > I have a model with unique field. Here is what i get when i try to > save record with not-unique field value: > > >>> from psdj.ksel import models > >>> try: > > ...   m = models.Keyword(phrase='insurance') > ...  

Re: why is not IntegrityError an attribute of models?

2009-08-03 Thread dnedbaylo
On Aug 3, 5:23 pm, Daniel Roseman wrote: > On Aug 3, 3:08 pm, dnedbaylo wrote: > > > > > Hey All, > > > I have a model with unique field. Here is what i get when i try to > > save record with not-unique field value: > > > >>> from psdj.ksel

Aggregates over reverse relationships?

2009-08-03 Thread Shai Berger
Hi all, With the new aggregates in django 1.1, I wonder if there's an easy way to aggregate over reverse relationships. As an example, assume a simplistic representation of a set of teams: class Team(models.Model): name = models.CharField(max_length=100) class Player(moedls.Model):

Django Job in Berlin

2009-08-03 Thread krumru...@googlemail.com
Hallo, I´m planning a startup in Berlin for a new online plattform. It will be a plattform for searching and sharing articles from journals and newspapers. Therefore I´m looking for a django developer who can help me in this project. thanks in advance Karsten

Re: UserProfile and select_related

2009-08-03 Thread lfrodrigues
Isn't there any way to cache profile data on User side? When are you planning on closing 7270? A lot of my code uses get_profile in templates and that is always a query. Isn't it possible to optimize this? On Aug 3, 3:45 pm, lfrodrigues wrote: > Ok  Thanks > > On Aug 3,

Receiving email, similar to Rails

2009-08-03 Thread Brandon Taylor
Hi everyone, Does anyone know of a way to mimic the functionality Rails has to set up a URL pattern to receive emails and handle attachments, such as photos? TIA, Brandon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Aggregates over reverse relationships?

2009-08-03 Thread Shai Berger
The question about aggregates still stands -- however, if anybody is wondering about finding all childless parents, I figured a way: On Monday 03 August 2009 17:45:18 Shai Berger wrote: > > class Team(models.Model): > name = models.CharField(max_length=100) > > class Player(moedls.Model):

Re: need help with model design and table relationship

2009-08-03 Thread Unnamed_Hero
And again for your explanations. So I have changed my models as you advise. Also I've made a form from c12b model, and when it displays - I see all peoples from table with people. But I still can't fetch any results Maybe by queryset isn't good. manage.py sql return this: people table:

Re: app __init.py__ question

2009-08-03 Thread chexov
On Aug 3, 5:00 pm, Karen Tracey wrote: > On Mon, Aug 3, 2009 at 3:20 AM, chexov wrote: > > > On Aug 3, 2:46 am, joep wrote: > > > Hi all, > > > > I have both a project and an app I just created (using django-admin). > > >

Re: cab snippet add gives error

2009-08-03 Thread prabhu S
Appears like a data type mismatch. Are you entering some string value in a integer field or something of that sort? On Aug 3, 12:45 pm, andreas schmid wrote: > hi, > > im trying to build the cab code sharing app with the practical django > projects book, at the moment i

Re: Receiving email, similar to Rails

2009-08-03 Thread prabhu S
Not sure whether this is possible out of the box yet. But here is some starter. http://code.google.com/p/jutda-helpdesk/source/browse/trunk/management/commands/get_email.py jutda-helpdesk project as a whole should be a good reference. On Aug 3, 4:14 pm, Brandon Taylor

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Peter Bengtsson
I see. I don't know how to make a link to the City in the Place edit page next to the City drop-down. You can put special links or things like that in the edit page at the top just above the fieldset. You first create a template called: templates/admin/// change_form.html And then do something

Re: Receiving email, similar to Rails

2009-08-03 Thread Masklinn
On 3 Aug 2009, at 17:14 , Brandon Taylor wrote: > Hi everyone, > > Does anyone know of a way to mimic the functionality Rails has to set > up a URL pattern to receive emails and handle attachments, such as > photos? As far as I know Django doesn't have anything close to Rails' ActionMailer (I

Re: WAR creation problem

2009-08-03 Thread Dhruv Adhia
This means you dont have django. Go to shell and check if you have django by importing the module and then checking its version. Dhruv Adhia http://thirdimension.com On Mon, Aug 3, 2009 at 2:52 AM, Sumeet wrote: > > Hi > > Can anyone help me creating WAR file of a Django

Re: how to modified filefiled after created it

2009-08-03 Thread Shuge Lee
I see. Thanks. On Aug 3, 1:54 pm, Daniel Roseman wrote: > On Aug 3, 1:29 pm, Shuge Lee wrote: > > > NO > > > just image add new seed in admin > > > upload a file with status "UNAPPROVE" > > then you change its status as "ACCET" > > the problem is,

Re: Admin: raw-id: Link to edit page

2009-08-03 Thread Michel Thadeu Sabchuk
Hi Thomas, > If you use raw_id the ID of the foreign key gets displayed right to the > input field. It would be nice to make it a hyperlink. I use this ticket to get what you want: http://code.djangoproject.com/ticket/7923 It would be good to have this ticket applied on django trunk ;) Best

Re: Receiving email, similar to Rails

2009-08-03 Thread Brandon
Cool. Thanks for the replies! Jutda Helpdesk seems like a good place to stat from, and also tie into admin. Cheers, Brandon On Aug 3, 10:50 am, Masklinn wrote: > On 3 Aug 2009, at 17:14 , Brandon Taylor wrote:> Hi everyone, > > > Does anyone know of a way to mimic the

Re: 'str' object is not callable

2009-08-03 Thread Dolph
hey Ronghui, Thanks for the reply. I couldnt get your first suggestion to work, I get "name 'coltrane_category_detail' is not defined". Also, Also, I never posted my models.py in my Category class, get_absolute_url: def get_absolute_url(self): return ('coltrane_category_detail',

Changing domain cookie

2009-08-03 Thread Chris McCormick
Hi All, I have a strange issue happening with domain cookies. On the site I'm working on we previously didn't have SESSION_COOKIE_DOMAIN set and so the cookie defaulted to "Host: mysite.com" We have a bunch of users logged in with that cookie set. Then we decided we wanted to share the cookie

Re: how to, complex filters in admin

2009-08-03 Thread selcukcihan
I need to get the filtering criteria from the request, is that right? On Aug 3, 2:24 pm, Peter Bengtsson wrote: > Untested but should work (in admin.py): > > class ThingAdmin(admin.ModelAdmin): >     def queryset(self, request): >         qs = super(ThingAdmin,

Date format in modelform.

2009-08-03 Thread zayatzz
Hello. I have this in my form (modelform) for birth_date field: birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False ), which overrides this in model: birth_date = models.DateField(help_text="birth date", verbose_name="Birth date", blank=True, null=True, ) I also have

Re: cab snippet add gives error

2009-08-03 Thread andreas schmid
dont know what it was but cleaning the tables and make a new sqlall cab solved the problem! prabhu S wrote: > Appears like a data type mismatch. Are you entering some string value > in a integer field or something of that sort? > > On Aug 3, 12:45 pm, andreas schmid wrote:

Date/time field styling?

2009-08-03 Thread mhulse
Hello, {{ form.start }} For example, outputs this: I have tried: {{ form.start_0 }} and {{ form.start_1 }}, but that outputs absolutely nothing. :) Is it possible to split up the two fields so I can handle them individually? Also, is it possible to control the XHTML output? I prefer use a

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread Dana
Ok, I understand the login part but what about registration? Wouldn't the user's need a username still? Or am I misunderstanding... And what about Django admin, it would still need a username correct? On Aug 2, 8:44 pm, Malcolm Tredinnick wrote: > On Sun, 2009-08-02 at

Re: Date format in modelform.

2009-08-03 Thread cootetom
I've always solved this problem in javascript. Plus if you're using jquery it's a bit easier. Before you set the date picker just format the date: $('input#id_date').val($('input#id_date').val().replace(/(\d+)-(\d+)- (\d+)/ig, '$3/$2/$1')).datepicker({showOn: 'focus', dateFormat: 'dd/mm/ yy'});

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread Dana
Yes, I agree that this is probably the best way to do it as I see now and I may well do that change, Im just hoping that Im missing some way to get around hacking up Django to get what I want... This seems like the one thing in the framework that is suboptimal... too bad because it is so crucial.

Re: app __init.py__ question

2009-08-03 Thread joep
Thanks Karen. That helps a lot. I have more questions about what is going on, but I'll read through the translation section of the docs first to see if the answers are there first. On Aug 3, 10:31 am, chexov wrote: > On Aug 3, 5:00 pm, Karen Tracey

annotate() and subsets or related records

2009-08-03 Thread Javier Guerra
Hi all, I've just upgraded to 1.1 (congrats everybody!), and want to put the aggregation/annotation features to use.  but it doesn't seem to be a way to annotate the records with counts of different subsets of related records. my problem:  i have  'Order' and 'Item' models, and the items can

migrating from django 0.96.3 to 1.1

2009-08-03 Thread sjol
Hi, I've started to migrate my site from django 0.96.3 to 1.1 and have encountered a few snags but one seems particularly odd as it only happens in the admin and for the user-tools in "admin/templates/ base.html" . I get a template synthax error "Caught an exception while rendering: Empty

Printing a cetain number of characters

2009-08-03 Thread When ideas fail
Hi, If i am using something like {{object.body}} is it possible to limit the number of characters being printed out. So say you wanted 30 characters, it would print the 30 and ignore the rest. Thanks, Andrew --~--~-~--~~~---~--~~ You received this message because

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread Elliott
Another way to do it is to create subclasses of all the relevant classes and forms. It's easy enough to create middleware that replaces django's default user object with your own, and it's also very easy to set the admin up to use your user model instead of the default. On Aug 3, 3:15 pm, Dana

Re: Printing a cetain number of characters

2009-08-03 Thread Jonas Obrist
use: {{ object.body|slice:":30" }} When ideas fail wrote: > Hi, If i am using something like {{object.body}} is it possible to > limit the number of characters being printed out. So say you wanted 30 > characters, it would print the 30 and ignore the rest. > > Thanks, > > Andrew > > >

change_view to change ModelAdmin

2009-08-03 Thread akhen
Hi I'm using change_view(self, request, object_id, extra_context=None) override on a ModelAdmin object, to display field differently based on the object entries, and change the fieldset order. def change_view(self, request, object_id, extra_context=None): post =

Re: how to, complex filters in admin

2009-08-03 Thread prabhu S
Right. If you are looking for more complex queries take a look at Q http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects On Aug 3, 6:40 pm, selcukcihan wrote: > I need to get the filtering criteria from the request, is that right? > > On

Re: Django on Hostmonster shared hosting

2009-08-03 Thread uxp
On Aug 2, 4:21 pm, Daniel Roseman wrote: > On Aug 2, 8:10 pm, Tim wrote: > > > Hello > > > I have been trying to get Django working with Hostmonster.com shared > > webhosting with FCGI. > > > From what I gather from the HM forums, this is possible,

Re: why is not IntegrityError an attribute of models?

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 07:36 -0700, dnedbaylo wrote: [...] > I was thinking about a case where try clause contains couple of save() > calls of different models and each model has unique field. And there > is no way to catch specific to model IntegrityError, > you can catch only "general"

Re: Printing a cetain number of characters

2009-08-03 Thread When ideas fail
thank you, i should have looked at filters. On 3 Aug, 23:42, Jonas Obrist wrote: > use: {{ object.body|slice:":30" }} > > When ideas fail wrote: > > Hi, If i am using something like {{object.body}} is it possible to > > limit the number of characters being printed out. So

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread djangou...@gmail.com
+1 thought that from the beginning! -- Sent from my Palm Pre Dana wrote: Yes, I agree that this is probably the best way to do it as I see now and I may well do that change, Im just hoping that Im missing some way to get around hacking up Django to get what I want... This seems like the one

Re: Django on Hostmonster shared hosting

2009-08-03 Thread prabhu S
in mysite.fcgi fix the settings file name. os.environ['DJANGO_SETTINGS_MODULE'] = "mysite.settings" Your settings file is inside a directory called "mysite". It will help if you quickly take a look at modules documentation in python. Also your fcgi complains about several missing parameters.

Re: 'str' object is not callable

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 09:51 -0700, Dolph wrote: > hey Ronghui, > > Thanks for the reply. I couldnt get your first suggestion to work, I > get "name 'coltrane_category_detail' is not defined". Also, Which is exactly what the problem is. In the first email you posted, you don't have any view

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread prabhu S
Going a step backward, why cant you make username same as email. Have a custom login_required decorator that uses email and password to authenticate, override registeration pages and not show username field? It seems to work for me. On Aug 2, 4:38 pm, Dana wrote: >

Re: Date/time field styling?

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 11:29 -0700, mhulse wrote: > Hello, > > {{ form.start }} > > For example, outputs this: > > > > > I have tried: > > {{ form.start_0 }} and {{ form.start_1 }}, but that outputs absolutely > nothing. :) > > Is it possible to split up the two fields so I can handle them

Re: Date format in modelform.

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 11:08 -0700, zayatzz wrote: > Hello. > > I have this in my form (modelform) for birth_date field: > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), which overrides this in model: > > birth_date = models.DateField(help_text="birth date",

Re: Using email instead of username in extended "User" model?

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 13:13 -0700, Dana wrote: > Ok, I understand the login part but what about registration? Wouldn't > the user's need a username still? Or am I misunderstanding... And what > about Django admin, it would still need a username correct? Nothing stops you from creating a random

Re: Date/time field styling?

2009-08-03 Thread Alex Gaynor
On Mon, Aug 3, 2009 at 6:18 PM, Malcolm Tredinnick wrote: > > On Mon, 2009-08-03 at 11:29 -0700, mhulse wrote: >> Hello, >> >> {{ form.start }} >> >> For example, outputs this: >> >> > > >> >> I have tried: >> >> {{ form.start_0 }} and {{ form.start_1 }}, but that

Re: Date format in modelform.

2009-08-03 Thread Karen Tracey
On Mon, Aug 3, 2009 at 2:08 PM, zayatzz wrote: > > Hello. > > I have this in my form (modelform) for birth_date field: > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), which overrides this in model: > > birth_date =

Re: UserProfile and select_related

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 08:10 -0700, lfrodrigues wrote: > Isn't there any way to cache profile data on User side? This already happens when you call get_profile(). If you mean using a mass query, then you have just asked if there is a select_related() equivalent for reverse relations. For the

Re: Aggregates over reverse relationships?

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 17:45 +0300, Shai Berger wrote: > Hi all, > > With the new aggregates in django 1.1, I wonder if there's an easy way to > aggregate over reverse relationships. As an example, assume a simplistic > representation of a set of teams: > > class Team(models.Model): >

Re: need help with model design and table relationship

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 08:27 -0700, Unnamed_Hero wrote: [...] > And I still get > Caught an exception while rendering:relation "C12B_boss" doesn't > exist And you still haven't reduced it to a simple case that fails with a specific piece of data at the interactive prompt. You are trying to debug

Re: Changing domain cookie

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 17:51 +0100, Chris McCormick wrote: > Hi All, > > I have a strange issue happening with domain cookies. On the site I'm working > on we previously didn't have SESSION_COOKIE_DOMAIN set and so the cookie > defaulted to "Host: mysite.com" We have a bunch of users logged in

Re: HELP! pysqlite2 FTS3 and datetime not returning datetime

2009-08-03 Thread Carol Hatcher
Hi Karen, Thank you very much for your thorough answer. Yes, indeed, using method #2 ('sqlite3.PARSE_COLNAME) in a sample python script does work with virtual tables using fts3. I've decided to go with creating the models' 'datetime' fields with CharFields. I'll probably create some sort of

Re: app __init.py__ question

2009-08-03 Thread Karen Tracey
On Mon, Aug 3, 2009 at 11:31 AM, chexov wrote: > Clear. Thanks for the answer. > What cause the autoreloader to reload the modules? > Is it reacts only when source code files was changed? > Yes, it reloads when it detects that a source file has changed on disk, to make

Re: migrating from django 0.96.3 to 1.1

2009-08-03 Thread Karen Tracey
On Mon, Aug 3, 2009 at 5:09 PM, sjol wrote: > > Hi, > > I've started to migrate my site from django 0.96.3 to 1.1 and have > encountered a few snags but one seems particularly odd as it only > happens in the admin and for the user-tools in "admin/templates/ > base.html"

virtualenv mixing up sites

2009-08-03 Thread Kenneth Gonsalves
hi, am running django under virtualenv. I find my new site is getting mixed up with the old one. Do I need a separate install of virtualenv for each site? Am using latest trunk, apache and mod_python. -- regards kg http://lawgon.livejournal.com

Re: annotate() and subsets or related records

2009-08-03 Thread Russell Keith-Magee
On Tue, Aug 4, 2009 at 5:17 AM, Javier Guerra wrote: > > Hi all, > > > I've just upgraded to 1.1 (congrats everybody!), and want to put the > aggregation/annotation features to use.  but it doesn't seem to be a > way to annotate the records with counts of different subsets of

formset consisting of multiple models/forms

2009-08-03 Thread sico
Hi, I have several models linked OneToOne by their primary keys. I can make a single view that has a form for each model and allow the user to edit data from the each of the models in a single screen (as if it were all stored in a single table/model) I'd like to be able to do this in a grid,

Re: Date format in modelform.

2009-08-03 Thread Margie
I did this with a combination of a DateWidget and a small .js file that calls the jquery datepicker on each widget. I don't use the same date format as you, but you should be able to modify it to fit your need. It's amazing how easy the code below looks, but I can tell you it took me most of a

  1   2   >