Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
Dear all, I have a model that has a foreign e.g class Foo(models.Model): bar = models.ForeignKey(Bar) class Bar(models.Model): name = models.CharField(max_length=50) This is my FooAdmin: class FooAdmin(admin.ModelAdmin): list_display = ['bar'] Now in the admin Foo's display list I want t

Re: Template tag for getting CSS/scripts/images

2009-09-06 Thread Daniel Roseman
On Sep 6, 5:51 am, Wiiboy wrote: > I'm considering making a custom template tag that returns a url to a > css file or image file. > > In your opinion, is it a waste of time? Not at all. This is a great way to remove dependencies on hard-coded locations, and makes it easy to move from development

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Daniel Roseman
On Sep 6, 8:39 am, Joshua Partogi wrote: > Dear all, > > I have a model that has a foreign e.g > > class Foo(models.Model): >   bar = models.ForeignKey(Bar) > > class Bar(models.Model): >   name = models.CharField(max_length=50) > > This is my FooAdmin: > class FooAdmin(admin.ModelAdmin): >   lis

Re: Django remove value from field with attrs disabled="disabled"

2009-09-06 Thread V
instead of using disabled field, I wrote a "StaticField" it's value is supplied in the general clean method, for details see http://www.djangosnippets.org/snippets/1523/ I hope this might help. On Sep 5, 7:52 pm, eli wrote: > Hi, > > I have problem with Django Forms and field with set attrs to

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: > > On Sep 6, 8:39 am, Joshua Partogi wrote: > > Dear all, > > > > I have a model that has a foreign e.g > > > > class Foo(models.Model): > > bar = models.ForeignKey(Bar) > > > > class Bar(models.Model): > > name = models.CharField(max_len

raw_id_fields in admin

2009-09-06 Thread paulh
When using one of these fields in Add mode you make a choice of the object from a popup window and the js returns the id into the field. It would be very useful if it also tacked the unicode (that you see whilst making the choice) corresponding to that id onto the end of the field as it does when

Re: Django remove value from field with attrs disabled="disabled"

2009-09-06 Thread eli
Thanks for help. regards. --~--~-~--~~~---~--~~ 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 django

auto populating primary key

2009-09-06 Thread ThinRhino
Hello, This is my first post to the group and comparatively new to django. In my models, I have a primary key field. This primary key, will be used like a transaction id. I want to create it based on the data entered in the form and save it to the database by overloading the save() method. I am

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Karen Tracey
On Sun, Sep 6, 2009 at 6:21 AM, Joshua Partogi wrote: > > On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: > >> Define a custom method on the FooAdmin class which returns the HTML of >> a link to the Bar changelist with the relevant filter applied: >> >>def bar_link(self, obj): >>

Re: raw_id_fields in admin

2009-09-06 Thread Karen Tracey
On Sun, Sep 6, 2009 at 7:25 AM, paulh wrote: > > When using one of these fields in Add mode you make a choice of the > object from a popup window and the js returns the id into the field. > It would be very useful if it also tacked the unicode (that you see > whilst making the choice) correspondi

Re: Creating a link for Foreign key in Admin

2009-09-06 Thread Joshua Partogi
On Sun, Sep 6, 2009 at 10:46 PM, Karen Tracey wrote: > On Sun, Sep 6, 2009 at 6:21 AM, Joshua Partogi > wrote: > >> >> On Sun, Sep 6, 2009 at 6:20 PM, Daniel Roseman wrote: >> >>> Define a custom method on the FooAdmin class which returns the HTML of >>> a link to the Bar changelist with the rel

Re: ReST and path issues

2009-09-06 Thread wrong
Can you show the output of these commands below? (from django shell and from running under fastfcgi deamons) import sys print sys.executable for p in sys.path: print p On Sat, Sep 5, 2009 at 7:46 PM, TiNo wrote: > On Thu, Sep 3, 2009 at 00:38, TiNo wrote: > >> Hi, >> I am trying to set up a

QuerySet cache

2009-09-06 Thread Thierry
QuerySet cache is usually quite great. However when you are looping through a very large result set it would be great if I could turn it off. So here the question, how do I turn off the queryset cache? --~--~-~--~~~---~--~~ You received this message because you are

Re: QuerySet cache

2009-09-06 Thread Alex Gaynor
On Sun, Sep 6, 2009 at 10:14 AM, Thierry wrote: > > QuerySet cache is usually quite great. > However when you are looping through a very large result set it would > be great if I could turn it off. > So here the question, how do I turn off the queryset cache? > > > Just call .iterator() on the Qu

Re: raw_id_fields in admin

2009-09-06 Thread paulhide
Thanks very much Karen, I'll keep an eye on the ticket. Paul On Sep 6, 2:00 pm, Karen Tracey wrote: > On Sun, Sep 6, 2009 at 7:25 AM, paulh wrote: > > > When using one of these fields in Add mode you make a choice of the > > object from a popup window and the js returns the id into the field.

Re: auto populating primary key

2009-09-06 Thread Carlos A. Carnero Delgado
Hi, On Sun, Sep 6, 2009 at 6:53 AM, ThinRhino wrote: > This is my first post to the group and comparatively new to django. Welcome! > In my models, I have a primary key field. This primary key, will be used > like a transaction id. > > I want to create it based on the data entered in the form a

Problem in identifying (myself)

2009-09-06 Thread Jani Luukko
Hi, i'm using Django first time to actually make a web site. I have coded model for user profiles and view for users to change details in their profile. When i log in, i can see that i'm logged in at front page and i can use admin sites. But when i go to my view of changing user details, it thin

Django testing applications: using fixtures

2009-09-06 Thread Oleg Oltar
Django testing application: using fixtures Hi ! I came across strange problem while trying to use mixtures in my unittests For example, I created a fixture from the database: silver:jin oleg$ python manage.py dumpdata > datastored.json Strange, but when the fixture is loaded while the test ru

QuerySet method question

2009-09-06 Thread Larry
Hi everyone, I have the following three models: User, Item, User_Item, which are defined as follows def User(models.Model): id = models.CharField(primary_key=True) def Item(models.Model): id = models.CharField(primary_key=True) def User_Item(models.Model): user = models.ForeignKey(

Re: QuerySet method question

2009-09-06 Thread Daniel Roseman
On Sep 6, 7:08 pm, Larry wrote: > Hi everyone, > > I have the following three models: User, Item, User_Item, which are > defined as follows > > def User(models.Model): >     id = models.CharField(primary_key=True) > > def Item(models.Model): >     id = models.CharField(primary_key=True) > > def U

Re: QuerySet cache

2009-09-06 Thread Thierry
Awesome Right now im looping through the items as follows chunk_size = 1 start = 0 while True: end = start + chunk_size items= items_queryset[start:end]; start += chunk_size etc. Is there an option to specify the chunk size (actual value r

custom model field getting "may not be NULL" error on update

2009-09-06 Thread gatoatigrado
Hi all, I wrote a custom field which should get an object by a primary key value (chainId). The base storage type is an int. I have a call that does "obj.save(force_update=True)", and I get this "may not be NULL" error. I set a debug point in execute_sql(), and indeed, it seems to say "UPDATE

Basic 404.html template issue

2009-09-06 Thread moreeon
Hi everyone, I'm struggling with an issue my girlfriend says is "ironic". I can't get my custom 404 page to show. I've broken this down to the simplest possible case. Here's what I did: Create a new project called "experiment" in /home/me/experiment and add a directory to that called templates.

Django windows service

2009-09-06 Thread cootetom
Hi, I'm looking to try and run some python code that has complete access to the django framework and some existing app models that I have in a project as a windows service. I have an app that allows a user to set up an email that should send sometime in the future. I want a windows service to be

Re: custom model field getting "may not be NULL" error on update

2009-09-06 Thread gatoatigrado
I think I found the problem: if the target object has a prepare_database_save() field, which it did (because it was a Django model object), this function will be called, replacing the target object (in subqueries.py) NOTE - "target object" means the value of the field for a model instance, wh

Re: Basic 404.html template issue

2009-09-06 Thread cootetom
Have you tried this through a proper server? You've stated that your project isn't running in DEBUG but the django development server is still just that and may be causing this issue. I'm not sure but can't see any harm in seeing if you get the same result if you run through apache to see if it wo

Re: Parsing / Deserializing a JSON String

2009-09-06 Thread J. Clifford Dyer
On Sat, 2009-09-05 at 16:12 -0700, Eric wrote: > Thank you for your input. I tried what you suggested by first just > trying to loop through the data like so: > > " > test_output = 0 > for obj in serializers.deserialize('json', gantt_data)['ganttgroups']: > test_output = test_output + 1 >

Django Comments

2009-09-06 Thread Jason
Well, thanks to a old post on DjangoBot, I've got the new Django Comments framework installed w/o breaking my urls.py (had to go into django.contrib.comments & delete the "url" directory-- was that mentioned in any of the "migrating to 1.0" docs?) Now I'd like to test it out by simply having it s

Re: Having real problems with CSS

2009-09-06 Thread Ozymandias
Karen, Thanks. You're awesome. Andrew On Sep 2, 8:52 pm, Karen Tracey wrote: > On Wed, Sep 2, 2009 at 7:53 AM, Ozymandias wrote: > > > Karen, > > > Thank you.  I will give that a shot a little later this afternoon. > > > The MEDIA_ROOT change really does break the sites CSS though.  Not > >

Re: regex problem in urls.py in Django 1.1/mod_wsgi

2009-09-06 Thread Jim Myers
My noob error: I had extra "portal/" on my regex. Sorry and thanks for your attention. --~--~-~--~~~---~--~~ 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@googlegro

Need to replace Django User class

2009-09-06 Thread Jim Myers
I've look all over docs and Google to find a way to do this with no real luck. I'm using a legacy PostGreSQL database which already has user and permissions tables defined, and I don't want to have to create parallel Django User tables. It seems simple that I should just be able to completely re

Django for windows XP

2009-09-06 Thread vaidyanathan venkataraman
Hi, I am not able to locate a Django package to be downloaded for Windows XP. Can anyone please help me in this endeavour? --vaidya --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" grou

Re: Django for windows XP

2009-09-06 Thread Daniel Roseman
On Sep 7, 5:30 am, vaidyanathan venkataraman wrote: > Hi, > >         I am not able to locate  a Django package to be downloaded for > Windows XP. > > Can anyone please help me in this endeavour? > > --vaidya You don't need one - Django doesn't include any operating system specific code. Just fo

Re: Django windows service

2009-09-06 Thread Daniel Roseman
On Sep 6, 9:16 pm, cootetom wrote: > Hi, > > I'm looking to try and run some python code that has complete access > to the django framework and some existing app models that I have in a > project as a windows service. I have an app that allows a user to set > up an email that should send sometime