Re: How to get the url for media_root?

2009-01-08 Thread itsnotvalid
Thanks a lot!! I completely missed the part regarding context processors... poor me... That means I am still not googlish enough... On Jan 9, 3:09 pm, Malcolm Tredinnick wrote: > On Thu, 2009-01-08 at 22:58 -0800, itsnotvalid wrote: > > Second question at the same

Re: How to get the url for media_root?

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 22:58 -0800, itsnotvalid wrote: > Second question at the same time > > Anyways, I encountered a problem that when I want to get an item from > my media directory, which is set correctly in settings.py, however I > couldn't find a template tag to get the url of the

Re: Your IDE of choice

2009-01-08 Thread Nikolay Panov
You may also try Rope. Theyr auto-completion is better than pysmell too. Have a nice day, Nikolay. On Fri, Jan 9, 2009 at 01:23, Marco Buttu wrote: > > On Wed, 2009-01-07 at 13:06 +, Adam Stein wrote: > >> I have omnicomplete working (haven't used it too much

How to get the url for media_root?

2009-01-08 Thread itsnotvalid
Second question at the same time Anyways, I encountered a problem that when I want to get an item from my media directory, which is set correctly in settings.py, however I couldn't find a template tag to get the url of the media. Looked into the code for djangoproject.com and found that they

How to customize admin interface to edit foreignkey objects on the same page?

2009-01-08 Thread itsnotvalid
I have two model, say CustomProfile and User. When I want to edit CustomProfile I also want to edit the required User object at the same time, which means that for the admin it would look like they are joined together on the add/edit page of CustomProfile. However since I have different profiles

Re: Django/Apache on Ubuntu - admin page looks weird

2009-01-08 Thread elithrar
Just in case you miss it - and this is the method I'd suggest, as it makes updating easy: > Create a symbolic link to the admin media files from within your document > root. This way, all of your Django-related files -- code and templates -- > stay in > one place, and you'll still be able to

Re: Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)

2009-01-08 Thread Kedare
Thank you, that work fine ! On 9 jan, 05:59, "Karen Tracey" wrote: > On Thu, Jan 8, 2009 at 11:41 PM, Kedare wrote: > > > Hi, i have made a Cache management Page for Django, but i have a > > problem, i need to expire single cache entries, so i made this

Re: Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 11:41 PM, Kedare wrote: > > Hi, i have made a Cache management Page for Django, but i have a > problem, i need to expire single cache entries, so i made this : > > (the url is like that by example: "/admin/cache_management/? > >

Re: Django/Apache on Ubuntu - admin page looks weird

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 11:45 PM, djangofett wrote: > > Hi, I am trying to get Django running on an Ubuntu server with Apache. > Everything seems to be installed fine (mod_python, plus MySQL with > MySQLdb python bindings), and I am running the main tutorial on the > Django

Django/Apache on Ubuntu - admin page looks weird

2009-01-08 Thread djangofett
Hi, I am trying to get Django running on an Ubuntu server with Apache. Everything seems to be installed fine (mod_python, plus MySQL with MySQLdb python bindings), and I am running the main tutorial on the Django site. I am doing the second part of the tutorial, with the admin site, and noticed

Problem when using RAW SQL Query with Django (not all arguments converted during string formatting)

2009-01-08 Thread Kedare
Hi, i have made a Cache management Page for Django, but i have a problem, i need to expire single cache entries, so i made this : (the url is like that by example: "/admin/cache_management/? action=clear=views.decorators.cache.cache_page../.d41d8cd98f00b204e9800998ecf8427e") if

Re: get_profile not working (get_model returns None)

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 11:19 PM, Hans Fangohr wrote: > > You are right: using 'People.profile' works. To be clear (for others): the > application name should (in contrast to the documentation) NOT be converted > to lowercase. (But the actual model -- here 'Profile' --

Re: Change the url

2009-01-08 Thread Praveen
Thank you so much Briel. Really you gave me a nice explanation and the same think i was thinking but was not able to make understand to my senior. let me put your idea to my senior and lets see what they say.. but really i appreciate you and for your politeness. On Jan 8, 6:43 pm, Briel

Re: get_profile not working (get_model returns None)

2009-01-08 Thread Hans Fangohr
Dear Karen, On 9 Jan 2009, at 00:35, Karen Tracey wrote: > On Thu, Jan 8, 2009 at 6:24 PM, Hans Fangohr > wrote: > > > Dear all, > > I have difficulties with the get_profile to link my Profile class with > the inbuilt User object. > > The error message (which can be

Re: Extending Group for a GroupProfile

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 19:46 -0800, Cortland Klein wrote: > Hi. I'm planning on extending Group for a GroupProfile. I noticed that > the recommended way to extend User is to create a UserProfile with a > ForeignKey(User, unique=True) instead of a OneToOneField[a]. > > 1. Why is it recommended

Extending Group for a GroupProfile

2009-01-08 Thread Cortland Klein
Hi. I'm planning on extending Group for a GroupProfile. I noticed that the recommended way to extend User is to create a UserProfile with a ForeignKey(User, unique=True) instead of a OneToOneField[a]. 1. Why is it recommended to use a ForeignKey(unique=True) from a UserProfile to User

Re: Process file after upload

2009-01-08 Thread varikin
On Jan 7, 7:32 am, dmishe wrote: > Hey. > > I have FielField in my model for user to upload ZIP-archives. I want > to unpack that zip, place some files in some dirs and delete it just > after user uploaded it in admin. > > How can i do this? Model's save won't work because it

Re: defining form fieldsets in view (not in admin)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 18:43 -0800, adrian wrote: > > What would be the best way to do it so when django updates > I don't have to rewrite my extension? So that it might be reusable > by others? Should I > checkout a version or can I use the 1.0.2 I have? You should be able to write your

Re: defining form fieldsets in view (not in admin)

2009-01-08 Thread adrian
What would be the best way to do it so when django updates I don't have to rewrite my extension? So that it might be reusable by others? Should I checkout a version or can I use the 1.0.2 I have? Don't know if I have the depth of understanding of django to do this well, but I'm willing to

Re: upload_to not found

2009-01-08 Thread Kottiyath
Oops -- My bad. Thank you Karen. Regards K On Jan 9, 5:01 am, "Karen Tracey" wrote: > On Thu, Jan 8, 2009 at 3:16 PM, Kottiyath Nair wrote: > > > > > Hi, > >   I was trying out a form - with filefield. I used the option upload_to, > > and django

Re: Passing a form a user before validation

2009-01-08 Thread DragonSlayre
Thank you thank you thank you Cheers Malcolm, you're the best! On Jan 9, 2:31 pm, Malcolm Tredinnick wrote: > On Thu, 2009-01-08 at 17:09 -0800, DragonSlayre wrote: > > I'm trying to generate a form with a user's details, so that they can > > change the details

Re: defining form fieldsets in view (not in admin)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 17:32 -0800, adrian wrote: > > Is there a way to display a form with fields grouped using fieldsets, > without entering all the html manually in the view? The Form I have > in mind is generated directly from a Model. I see that the admin has > this feature but it isn't

defining form fieldsets in view (not in admin)

2009-01-08 Thread adrian
Is there a way to display a form with fields grouped using fieldsets, without entering all the html manually in the view? The Form I have in mind is generated directly from a Model. I see that the admin has this feature but it isn't mentioned anywhere else in the doc. This would have two

Re: Passing a form a user before validation

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 17:09 -0800, DragonSlayre wrote: > I'm trying to generate a form with a user's details, so that they can > change the details they've submitted. > > One of my forms is a ModelForm, which is the profile of the User > object. I also want to show the first name, last name and

Re: Session variables

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 05:12 -0800, bradders wrote: > I will try to put something together. I have a fairly detailed trace > that I have put in the session code that shows my session variables > are set when it calls one of my views, but the trace shows that the > next session save only a new

Re: orm: delete performance and queries optimization

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 04:54 -0800, drakkan wrote: > In my database I have some tables full of records, when I delete an > object django use the cascade behaviour and this is good, however > seems it make a query for every related object and after this django > seems to issue a delete where id in

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 7:48 PM, rabbi wrote: > > I get the same exception(s) > > The 1st time I try to import swenglish.admin I get: > ImproperlyConfigured: 'EntryAdmin.fieldsets[3][1]['fields']' refers to > field 'created_date' that is missing from the form. > > The 2nd

Re: ModelForm: exclude fields missing in request

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 07:08 -0800, Flo Ledermann wrote: > Hi all, > > I am trying to use a ModelForm in a "sparse" way to edit instances, > i.e. I only render one of its fields (plus a submit button) in the > template for editing the corresponding field in the model. I would > have expected that

Passing a form a user before validation

2009-01-08 Thread DragonSlayre
I'm trying to generate a form with a user's details, so that they can change the details they've submitted. One of my forms is a ModelForm, which is the profile of the User object. I also want to show the first name, last name and email from the User object, so I've created a form for that

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread rabbi
I've solved it. In case anyone has the same problem, I think it's because 'created_date' is set to auto_now, which means it's not editable and should be in fieldsets This link was helpful:

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread rabbi
I get the same exception(s) The 1st time I try to import swenglish.admin I get: ImproperlyConfigured: 'EntryAdmin.fieldsets[3][1]['fields']' refers to field 'created_date' that is missing from the form. The 2nd time I try to import swenglish.admin I get: AlreadyRegistered: The model User is

Re: Django Models + ManyToMany

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 7:08 PM, rabbi wrote: > > Thanks Karen, > I actually deleted the thread soon after posting it as I came across > what you have written above. > Somehow you still managed to reply to a deleted thread though...? > Impressive > I don't use the Google

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 6:33 PM, rabbi wrote: > > OK, thanks > I also tried deleting the db file and then calling syncdb again... it > didn't help > Do you have any suggestions? > Try importing your admin.py from a manage.py shell prompt, and see if that shows a more

Re: get_profile not working (get_model returns None)

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 6:24 PM, Hans Fangohr wrote: > > > Dear all, > > I have difficulties with the get_profile to link my Profile class with > the inbuilt User object. > > The error message (which can be obtained through the 'chatroom' view > shown below, or via the

How to change a TabularInline widget size

2009-01-08 Thread Luis Miguel Morillas
When I use a TabularInline class, type text inputs haven't a correct size, so I'm getting too large lines for input: How can I add a size attribute to this input?. I want size to have the maxlength value. This is my code: class BidonInline(admin.TabularInline): model = Bidon class

Re: bug in models.Model __str__ return and non-ascii characters !?

2009-01-08 Thread adrian
thank you very much. i am using version 1.0.2 right now. i think i started with django at version 0.95. that time they used __str__ (i just checked that in my local-copy-archive of the docs for 0.95/0.96) in the tutorial - and i kept that until now. so with __unicode__ instead of __str__ it

Re: bug in models.Model __str__ return and non-ascii characters !?

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 6:14 PM, adrian wrote: > > hi, > i am posting here to follow the "i found a bug" guide ... > > let's assume i have a model like this: > > --- > class Test(models.Model): >testname = models.CharField(max_length=60, null=False, > blank=False,

Re: Django Models + ManyToMany

2009-01-08 Thread rabbi
Thanks Karen, I actually deleted the thread soon after posting it as I came across what you have written above. Somehow you still managed to reply to a deleted thread though...? Impressive On Jan 9, 1:04 am, "Karen Tracey" wrote: > On Thu, Jan 8, 2009 at 12:06 PM, rabbi

Re: Django Models + ManyToMany

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 12:06 PM, rabbi wrote: > > Hi, > I have a question that is probably very simple to answer. > > class Example(models.Model): >value = models.CharField(max_length=200) >related_examples = models.ManyToMany >

Re: upload_to not found

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 3:16 PM, Kottiyath Nair wrote: > Hi, > I was trying out a form - with filefield. I used the option upload_to, > and django server erred out saying - upload_to not found. > I checked django code : > >>> import django > >>> django.VERSION > (1, 0,

Re: ModelForm: exclude fields missing in request

2009-01-08 Thread Karen Tracey
On Thu, Jan 8, 2009 at 11:34 AM, Flo Ledermann wrote: > > Hi all, > > after some more thinking, the workaround I came up with is now: > > if form.is_valid(): >for key in form.cleaned_data.keys(): >if not key in request.POST: del form.cleaned_data[key] >

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread rabbi
OK, thanks I also tried deleting the db file and then calling syncdb again... it didn't help Do you have any suggestions? On Jan 9, 12:17 am, adrian wrote: > syncdb does not modify already existing tables. > so if you modified a model - syncdb will not modify the tables

get_profile not working (get_model returns None)

2009-01-08 Thread Hans Fangohr
Dear all, I have difficulties with the get_profile to link my Profile class with the inbuilt User object. The error message (which can be obtained through the 'chatroom' view shown below, or via the shell) is: ---

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread adrian
syncdb does not modify already existing tables. so if you modified a model - syncdb will not modify the tables On Jan 9, 12:01 am, rabbi wrote: > Hi, > I've search around a bit and found a few references to this error, but > it seems that everyone else was getting

bug in models.Model __str__ return and non-ascii characters !?

2009-01-08 Thread adrian
hi, i am posting here to follow the "i found a bug" guide ... let's assume i have a model like this: --- class Test(models.Model): testname = models.CharField(max_length=60, null=False, blank=False, unique=True) [... some more fields ...] def __str__(self): return

Re: AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread rabbi
here's my admin.py from mysite.swenglish.models import User from mysite.swenglish.models import Entry from mysite.swenglish.models import Category from mysite.swenglish.models import Language from django.contrib import admin class UserAdmin(admin.ModelAdmin): list_display = ('name',

AlreadyRegistered at /admin/, The model #### is already registered

2009-01-08 Thread rabbi
Hi, I've search around a bit and found a few references to this error, but it seems that everyone else was getting this when they migrated to Django 1.0 and newforms... for me it's a different situation, as I started on 1.0 from the beginning Background: Went through tutorial, got a basic site

Re: Iterate over model database fields

2009-01-08 Thread Matias Surdi
Great!! I think that the _meta attribute will be enough. I think that if I define a method on the base model of all my models something like get_fields() it could then return a list of the fields by accessing self._meta.fields, and this get_fields should be accessible from

Re: django design methods

2009-01-08 Thread bruno desthuilliers
On 8 jan, 19:33, chiggsy wrote: > A meta question about django: how do people design dango apps? Like any other. Domain analysis to get the models (database schema, mostly), functional analysis to get the use cases (urls and views), and common sense to fill the gaps. > I

Re: Iterate over model database fields

2009-01-08 Thread bruno desthuilliers
On 8 jan, 16:22, Matias Surdi wrote: > Is there any way to iterate over all the fields in a model instance on a > template? Not directly. The fields names are accessible thru the model_instance._meta attribute, and you cannot access '_protected' attributes in a template.

Re: Your IDE of choice

2009-01-08 Thread Marco Buttu
On Wed, 2009-01-07 at 13:06 +, Adam Stein wrote: > I have omnicomplete working (haven't used it too much yet). I have > this > in my $HOME/.vimrc file: ... > Also, I have vim starting automatically importing the Django db. I > have > a little script (below) that will automatically find my

Re: Is Django best for modular extensible projects?

2009-01-08 Thread bruno desthuilliers
On 8 jan, 19:05, walterbyrd wrote: (nb: reinjecting the question in the post's body) > Is Django best for modular extensible projects? "best" compared to what ?-) > For example, let's suppose you wanted to create a application that > would be fairly easy to extend by

upload_to not found

2009-01-08 Thread Kottiyath Nair
Hi, I was trying out a form - with filefield. I used the option upload_to, and django server erred out saying - upload_to not found. I checked django code : >>> import django >>> django.VERSION (1, 0, 2, 'final', 0) class FileField(Field): widget = FileInput default_error_messages = {

django design methods

2009-01-08 Thread chiggsy
A meta question about django: how do people design dango apps? I understand that the urlconf really is a map of the application, and that works for me. As for applications, I think that they are pieces of functionality and i have few problems with that. However: when i try to mix and match

project for hire

2009-01-08 Thread Chad
Available for 6-30 hour django project? To find out more please contact c...@brattiss.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: best way to do tabs?

2009-01-08 Thread Margie
Yes, I agree, my main problem is figuring out how to avoid rewriting the css files. I will look at that link and the active class, that sounds like it's a good way to go. Thanks!! On Jan 8, 9:40 am, "Ariel Mauricio Nunez Gomez" wrote: > Since I think you are not

Is Django best for modular extensible projects?

2009-01-08 Thread walterbyrd
For example, let's suppose you wanted to create a application that would be fairly easy to extend by creating new modules. I don't really know django, but I get the idea that django would be a decent solution for a project like that. --~--~-~--~~~---~--~~ You

Re: best way to do tabs?

2009-01-08 Thread Ariel Mauricio Nunez Gomez
Since I think you are not (yet) using AJAX, all the logic you need should be available to the template already. Your main issue sems to be not having to rewrite any css files but only change the html item 'class' attribute. The last link and code snippet on my previous mail address that

Re: best way to do tabs?

2009-01-08 Thread Margie
I think the issue I have is that I seem to need to maintain "state". Let me use a contrived example. Suppose I have three tabs: books-tab, music-tab, and video-tab. When I click on books-tab, I get a subnav bar with three subnav tabs: "books about animals", "books about video", "books about

Django Models + ManyToMany

2009-01-08 Thread rabbi
Hi, I have a question that is probably very simple to answer. class Example(models.Model): value = models.CharField(max_length=200) related_examples = models.ManyToMany ('self',related_name='related_example_set') If I define a ManyToMany relationship like the one above and I want to

Re: Problems with locale of dates queryset

2009-01-08 Thread motard
I've been playing around with my settings file and have included a DATE_FORMAT and a DATETIME_FORMAT setting. DATETIME_FORMAT = 'j F Y H:i' DATE_FORMAT = 'j F Y' When using the date template filter on a date or datetime variable, I get my dates formatted in the format set in DATE_FORMAT. {{

Re: best way to do tabs?

2009-01-08 Thread phoebebright
I guess google has reached the status of hoover and tarmac! On Jan 8, 10:25 am, Matias Surdi wrote: >  > implement.  Just google YUI. > Shoudn't it have been "yahoo for YUI" ? > > :-D > > phoebebright escribió: > > > I'm a great fan of YUI and they have some nice tabs

Re: very basic beginners question

2009-01-08 Thread Adam Yee
On Jan 8, 7:49 am, Evan wrote: > This is probably the most basic question in the history of the group. > Still, I googled the error message both in this group and in google at > large and went through the first 5 pages, and didn't see anything. > > i installed django a

Re: ModelForm: exclude fields missing in request

2009-01-08 Thread Flo Ledermann
Hi all, after some more thinking, the workaround I came up with is now: if form.is_valid(): for key in form.cleaned_data.keys(): if not key in request.POST: del form.cleaned_data[key] form.save() This removes all values that are not found in the original request from the form

Re: best way to do tabs?

2009-01-08 Thread Ariel Mauricio Nunez Gomez
Margie, I agree the current metod for adding new tabs in Pinax is kind of cumbersome. I also think ther is no need for javascript for that kind of simle stuff (i.e. This would be an overkill http://blog.evaria.com/wp-content/themes/blogvaria/jquery/index-multi.php) Perhaps you may want to search

Re: subquery has too many columns

2009-01-08 Thread timc3
> > We'll need a bit more information here, since the devil's always in the > details. At a minimum, what is the output of > >         groupmembers.query.as_sql() > > There may be a problem with exclude and nested querysets. I just > realised I haven't explicitly tested those. > > Also, which

very basic beginners question

2009-01-08 Thread Evan
This is probably the most basic question in the history of the group. Still, I googled the error message both in this group and in google at large and went through the first 5 pages, and didn't see anything. i installed django a few weeks ago. i'm pretty sure it's installed correctly. i start

Iterate over model database fields

2009-01-08 Thread Matias Surdi
Is there any way to iterate over all the fields in a model instance on a template? I'd like to have a "default" template which iterates over whatever model yo give it and prints all its field on a table. Any help will be appreciated. --~--~-~--~~~---~--~~

ModelForm: exclude fields missing in request

2009-01-08 Thread Flo Ledermann
Hi all, I am trying to use a ModelForm in a "sparse" way to edit instances, i.e. I only render one of its fields (plus a submit button) in the template for editing the corresponding field in the model. I would have expected that fields not present in the POST data of the request would be omitted

Re: HttpResponse HTML links missing URL prefix when emailing

2009-01-08 Thread Eric Abrahamsen
On Jan 8, 2009, at 8:37 PM, Eki wrote: > > Hi guys, > > I'm implementing a view which sends a (nightly) status report email. > The code works mostly fine. I can both receive the email and see the > result rendered as I query the view. The HTML shown and emailed is > gotten from the same

Re: Shouldn't blank=True imply null=True?

2009-01-08 Thread tofergus
On 08.01-13:00, Malcolm Tredinnick wrote: [ ... ] > > a 'blank' value is essentially undefined in database terms and may be > > interpreted in various ways. > > Not, that's a NULL value. Blank has absolutely no technical meaning at > the database level and certainly not any kind of ambiguous

HttpResponse HTML links missing URL prefix when emailing

2009-01-08 Thread Eki
Hi guys, I'm implementing a view which sends a (nightly) status report email. The code works mostly fine. I can both receive the email and see the result rendered as I query the view. The HTML shown and emailed is gotten from the same response object. However, the links included in the report

Re: Django on Jython 2.5 alpha3 unicode characters in templates problem

2009-01-08 Thread naos
I found it works on Jython 2.5 beta0 On 8 Sty, 12:38, naos wrote: > Hi all, > > I'm recently playing with Django 1.0.2 on Jython 2.5 alpha3 build. > Besides missing os.getcwdu function (which I got over by assigning > os.getcwdu= os.getcwd at app init) I have

Re: Change the url

2009-01-08 Thread Briel
Hi Praveen I personally would prefer naming the urls rather than using the get_absolute_url. Both can accomplish your goal, but naming the urls is a more robust and in other ways a better solution. If you in a week decide that the url should not be /category/... but instead /whatever/... you

Re: Change the url

2009-01-08 Thread Kip Parker
You can use reverse() in your get_absolute_url method, it works the same as the url template tag in using your url patterns to generate the url. http://docs.djangoproject.com/en/dev/topics/http/urls/?from=olddocs#reverse On Jan 8, 12:58 pm, Praveen wrote: > Hi

Re: Session variables

2009-01-08 Thread bradders
I will try to put something together. I have a fairly detailed trace that I have put in the session code that shows my session variables are set when it calls one of my views, but the trace shows that the next session save only a new session variable set in that view exists all the other

Re: Change the url

2009-01-08 Thread Praveen
Hi Briel i am totally confused now. My senior told me to write get_absolute_url so i wrote get_absolute_url like this class Listing_channels(models.Model): list_channel = models.CharField(max_length = 20) visibility = models.BooleanField() def __unicode__(self): return

orm: delete performance and queries optimization

2009-01-08 Thread drakkan
In my database I have some tables full of records, when I delete an object django use the cascade behaviour and this is good, however seems it make a query for every related object and after this django seems to issue a delete where id in () for every 100 objects look at this, Oggetti returns

Re: Setting Bound Fields Programmatically

2009-01-08 Thread Keyton Weissinger
WAIT! Crap. If all else fails, RTFM. I'm sorry everyone. I just re-read the docs at http://docs.djangoproject.com/en/dev/topics/forms/modelforms/ on commit=False. I get it now. Thank you all! K On Jan 8, 7:47 am, Keyton Weissinger wrote: > Thank you both very much for taking

Re: Setting Bound Fields Programmatically

2009-01-08 Thread Keyton Weissinger
Thank you both very much for taking the time to respond... I got it to work using the following: if request.method == 'POST': my_data = {'type':user_type, 'school':current_school.id, 'title': request.POST['title'],

Re: Change the url

2009-01-08 Thread Briel
Using urls with names will solve your problem. Basically if you change your urls.py like this: url( r'^category/listing_view/(?P\w+)/$', 'mysite.library.views.listing_view', name = 'name_for_this_view' ), What I have done is to add a name to the url for

Newbie - Foreign Key Error

2009-01-08 Thread Tony
Dear List, I'm developing with 1.0.2 and am getting the following error: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`project/comment_comment`, CONSTRAINT `in_reply_to_id_refs_id_35b80077` FOREIGN KEY (`in_reply_to_id`) REFERENCES `comment_comment` (`id`))')

Re: Change the url

2009-01-08 Thread Praveen
Hi Malcolm i am very new bie of Django. i read through get_absolute_url but do not know how to use. What you have given the answer i tried with that and its working fine but my senior asked me what will happen if i change the site name then every where you will have to change url

Django on Jython 2.5 alpha3 unicode characters in templates problem

2009-01-08 Thread naos
Hi all, I'm recently playing with Django 1.0.2 on Jython 2.5 alpha3 build. Besides missing os.getcwdu function (which I got over by assigning os.getcwdu= os.getcwd at app init) I have problem with template rendering. When Jython string includes non-ASCII unicode characters (central europe

Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
One more comment: You would also want to make sure that the init method of SampleForm populates the non-model fields (ie. lastname) with the correct values. class SampleForm(forms.ModelForm): lastname = form.CharField... def __init__(self, *args, **kwargs): super(SampleForm,

Re: Using a model method in ModelAdmin fieldsets

2009-01-08 Thread Andy
The better approach would be to specify a custom form in your ModelAdmin. This way your fieldset definition could include anything that's specified in your custom form. For Example: class SampleModel(models.Model): email = models.EmailField... firstname = models.CharField... class

Re: Subprocess module in Python CGI

2009-01-08 Thread Anurag
Hello Kenneth, Thank you for your suggestion. This was helpful to remove a sort of redundancy in my program but removal of '\' still does not solve my problem as the Error displayed remains exactly the same. Any other suggestions? Once again thank you so much for your valuable time. Regards.

Re: Django too slow

2009-01-08 Thread bruno desthuilliers
On 8 jan, 07:04, Vicky wrote: > I using the django to generate xml and to fetch datas from database. > When i run it the response is too slow. it takes nearly 4sec to load > the page. So what can i do to make my program more efficient. Plse > tell me some things to avoid

Re: Change the url

2009-01-08 Thread Praveen
Thank you so much Malcolm. every one gives only the link and tell to read but your style of solving the problem is amazing. how you explained me in a nice way that i can never ever find in djangoproject.com. Thanks you so much malcom On Jan 8, 3:23 pm, Malcolm Tredinnick

Re: Session variables

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 02:30 -0800, bradders wrote: > Can anyone recommend a session system that works more reliably than > the built-in Django session handling? I am finding that after calling > 2 or 3 different views the session variables that were stored at login > time get cleared. I am using

Session variables

2009-01-08 Thread bradders
Can anyone recommend a session system that works more reliably than the built-in Django session handling? I am finding that after calling 2 or 3 different views the session variables that were stored at login time get cleared. I am using django 1.0, but I think the problem existed in earlier

Re: Change the url

2009-01-08 Thread Briel
Hi. Instead of manually writing the url, you can instead use the {% url %} tag, then Django would figure out what the correct url is. If you are using url tags you should considder using named urls. The link with url tag would end up something like this: {{n.list_channel}} read about the url tag

Re: best way to do tabs?

2009-01-08 Thread Matias Surdi
> implement. Just google YUI. Shoudn't it have been "yahoo for YUI" ? :-D phoebebright escribió: > I'm a great fan of YUI and they have some nice tabs that are easy to > implement. Just google YUI. > > > On Jan 8, 10:03 am, Matias Surdi wrote: >> JQuery UI? >> >>

Re: Change the url

2009-01-08 Thread Malcolm Tredinnick
I'm going to trim your code to what looks like the relevant portion of the HTML template, since that's where the easiest solution lies. On Thu, 2009-01-08 at 02:02 -0800, Praveen wrote: [...] > > list_listing.html > > > Sight Seeings > > {%if listing_result %} > {% for n in

Re: best way to do tabs?

2009-01-08 Thread phoebebright
I'm a great fan of YUI and they have some nice tabs that are easy to implement. Just google YUI. On Jan 8, 10:03 am, Matias Surdi wrote: > JQuery UI? > > Margie escribió: > > > Hi, > > > This is not a directly a django question, but since django is the only > > web

Re: Does using the IPython shell add "LIMIT" to Django ORM discussion (using SQLite)

2009-01-08 Thread Ramiro Morales
On Thu, Jan 8, 2009 at 7:58 AM, Christopher Mutel wrote: > > Hello all- > > I recently filed a bug about incorrect SQL generation, and Malcom > Tredinnick said that the example SQL I provided couldn't be correct, > because there was an extra LIMIT clause that shouldn't be

Re: Does using the IPython shell add "LIMIT" to Django ORM discussion (using SQLite)

2009-01-08 Thread Malcolm Tredinnick
On Thu, 2009-01-08 at 10:58 +0100, Christopher Mutel wrote: > Hello all- > > I recently filed a bug about incorrect SQL generation, and Malcom > Tredinnick said that the example SQL I provided couldn't be correct, > because there was an extra LIMIT clause that shouldn't be there. After > poking

Re: best way to do tabs?

2009-01-08 Thread Matias Surdi
JQuery UI? Margie escribió: > Hi, > > This is not a directly a django question, but since django is the only > web framework I know (and it's really cool, by the way!) I hope it's > ok to post this here. > > Could someone advise me on the "best" way to do tabs? IE, I'd like to > have a set

Change the url

2009-01-08 Thread Praveen
MODELS.py class Listing_channels(models.Model): list_channel = models.CharField(max_length = 20) visibility = models.BooleanField() def __unicode__(self): return self.list_channel class Listing(models.Model): name = models.CharField(max_length=20)

Does using the IPython shell add "LIMIT" to Django ORM discussion (using SQLite)

2009-01-08 Thread Christopher Mutel
Hello all- I recently filed a bug about incorrect SQL generation, and Malcom Tredinnick said that the example SQL I provided couldn't be correct, because there was an extra LIMIT clause that shouldn't be there. After poking around for a bit, I realized that everytime I was executing my query in

  1   2   >