What is in your opinion the best way to render a form

2009-05-25 Thread Joakim Hove
Hello, I have used ModelForm to create a form for a model class. In the template rendering the form I just have: form.as_table that is very neat, compared to writing out all the form elements in the template manually, but it is of course not as flexible. What is the common thing to do? Joa

Re: Iterate over MultipleChoiceList in Template

2009-05-25 Thread Retro486
Ok, well I took at look at the two links and they were pretty much the same thing; just access to the choice list as text, not the checkbox generator. I was able to generate the checkboxes manually, but they break the form system silently and just don't work (don't map to the usertype object for

Re: Canceling save

2009-05-25 Thread diogobaeder
OK... I'll manage to do this, then... Thanks a lot, Ankit! :-) Diogo On May 26, 2:39 am, Ankit wrote: > diogobaeder wrote: > > OK, but is it garanteed that I can delete the instance without raising > > an exception later, at the other methods, like "save" and "post_save" > > handler? For me,

Re: Canceling save

2009-05-25 Thread Ankit
diogobaeder wrote: > OK, but is it garanteed that I can delete the instance without raising > an exception later, at the other methods, like "save" and "post_save" > handler? For me, overriding the "save" method seems a bit too much > code to do a very simple thing... > > Thanks! > > Diogo > > On M

Re: Canceling save

2009-05-25 Thread diogobaeder
OK, but is it garanteed that I can delete the instance without raising an exception later, at the other methods, like "save" and "post_save" handler? For me, overriding the "save" method seems a bit too much code to do a very simple thing... Thanks! Diogo On May 26, 2:15 am, Ankit wrote: > Dio

Re: Canceling save

2009-05-25 Thread Ankit
Diogo Baeder wrote: > Hi there, > > How can I can cancel a model instance "save()" call from inside a > "pre_save" handler? Do I really have to reimplement the "save" method in > the model class to accomplish it? > > Thanks! > > > > Hi there, > > How can I can cancel a model instance "save()" ca

Canceling save

2009-05-25 Thread Diogo Baeder
Hi there, How can I can cancel a model instance "save()" call from inside a "pre_save" handler? Do I really have to reimplement the "save" method in the model class to accomplish it? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: Installing django

2009-05-25 Thread LeonTheCleaner
Thanks guys, I appreciated it all. It's just that I have tried a couple things mentioned here without any luck. It might not be very hard but I am not a unix programmer so it's harder for me, and I don't wanna invest lots of time in this. Thanks. On May 22, 11:06 am, Skylar Saveland wrote: > >

Re: Bad snafu with attempted field add to Postgres

2009-05-25 Thread Jason
Well, I fixed it. Downloaded the latest version of pgAdmin. Think I'll probably throw it away & buy Navicat for my home office ASAP however. My old beta of pgAdmin III (the only one that would work w/SSL tunneling) apparently *changed the name of the table* when I added the field-- from artists

Re: [Urgent]Accessing tables not created by django models using django APIs.

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 10:07 PM, ds99 wrote: > > Hi, > I am new to django.I have a requirement where in have to access tables > which are not created using django models, using django APIs. > > For eg: I already have tables "book_111" and "book_222" created in > sqlite db by some different proce

[Urgent]Accessing tables not created by django models using django APIs.

2009-05-25 Thread ds99
Hi, I am new to django.I have a requirement where in have to access tables which are not created using django models, using django APIs. For eg: I already have tables "book_111" and "book_222" created in sqlite db by some different process. Both having same schema.I want to access them to retriev

Re: oracle with us7ascii encode character lost

2009-05-25 Thread Ian Kelly
On May 25, 1:07 pm, Andrási László (g) wrote: > Hi, > > We have a problem with an Oracle DB version 10g Release 10.2.0.1.0., Django > latest svn version and cx_Oracle 5.0.1-2 > > "select * from nls_database_parameters where parameter='NLS_CHARACTERSET';" > returns  US7ASCII > > We tried to change

Bad snafu with attempted field add to Postgres

2009-05-25 Thread Jason
Hey folks-- hope someone can possibly provide some insight here. I needed to add a field to a model. Django (0.96)/mod_python (3.3.1)/ Python (2.5). Not sure which version of Postgres we're running. So I added the field to the model. Ran manage.py sqlall & got the (very simple) SQL to add the

Re: When to use admin, and when not to.

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:25 PM, Sam Kuper wrote: > 2009/5/26 Alex Gaynor > >> On Mon, May 25, 2009 at 7:51 PM, Sam Kuper >> wrote: >> >>> Suppose you were re-writing Facebook in Django. >>> >>> Would you handle the complex profile and privacy settings pages by: >>> >>> A) exposing the relevant

Re: When to use admin, and when not to.

2009-05-25 Thread Sam Kuper
2009/5/26 Alex Gaynor > On Mon, May 25, 2009 at 7:51 PM, Sam Kuper > wrote: > >> Suppose you were re-writing Facebook in Django. >> >> Would you handle the complex profile and privacy settings pages by: >> >> A) exposing the relevant admin pages to users, with careful auth to stop >> users from

Re: When to use admin, and when not to.

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 7:51 PM, Sam Kuper wrote: > Suppose you were re-writing Facebook in Django. > > Would you handle the complex profile and privacy settings pages by: > > A) exposing the relevant admin pages to users, with careful auth to stop > users from being able to access admin pages the

When to use admin, and when not to.

2009-05-25 Thread Sam Kuper
Suppose you were re-writing Facebook in Django. Would you handle the complex profile and privacy settings pages by: A) exposing the relevant admin pages to users, with careful auth to stop users from being able to access admin pages they shouldn't be able to. Obviously this would require much cus

Re: Iterate over MultipleChoiceList in Template

2009-05-25 Thread Retro486
Thanks, Richard. I'll take a look at the links you sent and see if I can't work something out. In the meantime I've dropped back to a MultipleChoiceField. :( I'll post my findings. -R On May 25, 9:03 am, Richard wrote: > Hey Retro, I'm struggling with the same thing. I've found two > interesti

Re: FileBrowser: Installation Question

2009-05-25 Thread Daniel Hilton
Filebrowser uses a directory called uploads, in your media directory. You need to create it and allow the user running your wsgi instance to be able to write to it as you upload files. On a related note, has anyone ram into trouble installing filebrowser with tinymce? Have run usual install all f

Re: What, if any, Apache modules are required to implement Django authentication?

2009-05-25 Thread Graham Dumpleton
On May 26, 5:20 am, Ben Welsh wrote: > Sorry to have been too brief. > > My objective is to rely as completely as possible on the Django > authentication methods. The only auth I need is > > 1) admin login for CMS managment > 2) staff_member_required protections for certain pages (for example c

FileBrowser: Installation Question

2009-05-25 Thread Bob N.
I've followed the instructions properly, but I get the error: OSError (2, 'No such file or directory') at line 52 in Views.py: dir_list = os.listdir(os.path.join (PATH_SERVER, path)) PATH_SERVER is not defined in my Settings, so I'm sure it's because I can't figure out what to do for Basic Inst

Announcing Django-ROA, dealing with remote resources

2009-05-25 Thread David Larlet
Hello, I had just open-sourced Django-ROA[1] (which stands for Resource Oriented Architecture). Basically it turns your models into remote resources that you can access through Django's ORM. See the documentation for a lovely schema[2]. What problems does it solve? Here are some ideas:

Re: "if settings.DEBUG" -- good design?

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 3:19 PM, tom wrote: > > Hi, > > I want to add some logging for debugging reasons in some views and > therefore I think about to add something like this in my views: > if settings.DEBUG: >logger.debug("some text") > > Would you recommend that? Is that good design? To be

Re: clean_ method not getting called

2009-05-25 Thread googletorp
Hi. I dont see anything wrong with the form code, could be the cod in your views that is causing the problem. Try posting that part aswell. ~Jakob On May 25, 11:27 pm, marstein wrote: > I have a ModelForm like this: > > > class PlanForm(forms.ModelForm): >     funds  = forms.ChoiceField(widget

Re: Selecting only published Articles

2009-05-25 Thread googletorp
Article.objects.filter(pub_status=1) You should look at the queryset api on docs.djangoproject.com ~Jakob On May 25, 10:48 pm, Alex Jonsson wrote: > Hey! > > In my Article model I have a pub_status which can be either 0 (draft) > or 1 (published). How can I make sure that every time I try to f

clean_ method not getting called

2009-05-25 Thread marstein
I have a ModelForm like this: class PlanForm(forms.ModelForm): funds = forms.ChoiceField(widget=forms.Select) # This does get called but does not see 'funds' field! def clean(self): logging.debug("clean: cleaning data: %s" % self.cleaned_data) return self.cleaned_da

Selecting only published Articles

2009-05-25 Thread Alex Jonsson
Hey! In my Article model I have a pub_status which can be either 0 (draft) or 1 (published). How can I make sure that every time I try to fetch some Articles, no Articles with pub_status 0 comes along? I'm currently using a custom manager to enable Article.objects.published.all(), but that's not

Re: abstract model with save method

2009-05-25 Thread V
thanks, this was the problem V On May 25, 9:51 pm, Sam Chuparkoff wrote: > On Mon, 2009-05-25 at 09:42 -0700, Viktor wrote: > >         super(self.__class__, self).save(force_insert, force_update) > > This line at least is bad. You want: > >   super(AcceptedRoleAbstract, self).save(force_insert

Re: FileField - Forms - upload to not available

2009-05-25 Thread tom
just to let you know. I am working with an additonal model now. this model simply holds the file itself without any meta data. This file is than used to get some tags out of the mp3 tags and with this information i create than the actual meta data filled Track model. Attached to that is than the f

"if settings.DEBUG" -- good design?

2009-05-25 Thread tom
Hi, I want to add some logging for debugging reasons in some views and therefore I think about to add something like this in my views: if settings.DEBUG: logger.debug("some text") Would you recommend that? Is that good design? To be honest, I am asking not about performance, just about how y

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Brian Neal
On May 25, 3:41 am, Andy wrote: > > But how do I stop user A from trying to edit the profile of user B? You don't let them. You control which profile you get from and save to the database, right? You look at the request.user object and only manipulate the data associated with the user specified

Re: validation and the ORM layer

2009-05-25 Thread googletorp
Django 1.1 is im pure bigfix and stabalization mode, to get it out asap, so they probably wont fix this issue for version 1.1 ~Jakob On May 25, 8:32 pm, martin f krafft wrote: > also sprach Alex Gaynor [2009.05.25.1945 +0200]: > > > Django does not currently support model-validation, there is

Re: abstract model with save method

2009-05-25 Thread V
On May 25, 9:19 pm, Karen Tracey wrote: > On Mon, May 25, 2009 at 12:42 PM, Viktor wrote: > > > Hi, > > > I have the following abstract model, but it's child models fail saving > > with RuntimeError: maximum recursion depth exceeded > > When you get that error, it comes with a stack trace.  Does

Re: Need help with URL rewrites

2009-05-25 Thread Kevin Audleman
Hi Alex, I did exactly as you suggested with no luck. Any other suggestions? Kevin On May 25, 12:27 pm, Alex Koshelev wrote: > Hi, Kevin. > > You can try to set FORCE_SCRIPT_NAME = '/directory' [1] settings > variable. Or setup your web server to provide valid SCRIPT_NAME > environment variabl

Re: use of HttpResponseForbidden(), etc.

2009-05-25 Thread Karen Tracey
On Mon, May 25, 2009 at 1:32 PM, notcourage wrote: > > @require_GET > def forbiddenView(request): >return HttpResponseForbidden() > So the login requirement isn't directly decorating the view. It's still there somewhere, based on your curl results. Given this view: from django.views.decor

Re: abstract model with save method

2009-05-25 Thread Sam Chuparkoff
On Mon, 2009-05-25 at 09:42 -0700, Viktor wrote: > super(self.__class__, self).save(force_insert, force_update) This line at least is bad. You want: super(AcceptedRoleAbstract, self).save(force_insert, force_update) Do post again as per Karen's request if you're still having trouble.

Re: Need help with URL rewrites

2009-05-25 Thread Alex Koshelev
Hi, Kevin. You can try to set FORCE_SCRIPT_NAME = '/directory' [1] settings variable. Or setup your web server to provide valid SCRIPT_NAME environment variable. [1]: http://docs.djangoproject.com/en/dev/ref/settings/#force-script-name --- Alex Koshelev On Mon, May 25, 2009 at 10:52 PM, Kevi

Re: oracle with us7ascii encode character lost

2009-05-25 Thread Petite Abeille
On May 25, 2009, at 9:07 PM, Andrási László (g) wrote: > US7ASCII > How could we convert the data without loosing letters? Hmmm... you can't. Your database is set to store US-ASCII characters only. Read on about Oracle "globalization": http://www.oracle.com/technology/pub/columns/trute_unic

Re: What, if any, Apache modules are required to implement Django authentication?

2009-05-25 Thread Ben Welsh
Sorry to have been too brief. My objective is to rely as completely as possible on the Django authentication methods. The only auth I need is 1) admin login for CMS managment 2) staff_member_required protections for certain pages (for example content preview pages that link out of the admin) The

Re: abstract model with save method

2009-05-25 Thread Karen Tracey
On Mon, May 25, 2009 at 12:42 PM, Viktor wrote: > > Hi, > > I have the following abstract model, but it's child models fail saving > with RuntimeError: maximum recursion depth exceeded > When you get that error, it comes with a stack trace. Does that not make it clear how the code is getting in

Setting the label on selection widget

2009-05-25 Thread Joakim Hove
Hello, I am implementing a simple 'shop'. The (simplified) model consists of these classes: class Product(models.Model): name = models.CharField(max_length = 100) class Country(models.Model): currency = models.CharField(max_length = 3) class Price(models.Model):

Re: de-facto tagging (was: When do snippets get into Django?)

2009-05-25 Thread martin f krafft
also sprach James Bennett [2009.05.25.2047 +0200]: > And, really, this is the sort of thing that leads me to say it > shouldn't be in contrib right now. We do need to have some sort of > document outlining criteria, but I'd like to think that commitment to > a stable API (e.g., the author is willi

oracle with us7ascii encode character lost

2009-05-25 Thread g
Hi, We have a problem with an Oracle DB version 10g Release 10.2.0.1.0., Django latest svn version and cx_Oracle 5.0.1-2 "select * from nls_database_parameters where parameter='NLS_CHARACTERSET';" returns US7ASCII We tried to change the NLS_LANG enviroment setting to US7ASCII so we got a good

Need help with URL rewrites

2009-05-25 Thread Kevin Audleman
My web host set up a django instance for me that can be accessed at http://www.mysite.com/directory/. They've set up an Apache rule (or something) that strips out the /directory/ before passing it on to django, so as a result that url gets resolved by my url pattern "^$". This is nice, the only p

Re: de-facto tagging (was: When do snippets get into Django?)

2009-05-25 Thread James Bennett
On Mon, May 25, 2009 at 12:43 PM, martin f krafft wrote: > Look what I found! Check out the fifth point, labeled #1, top-most > annoyance with Python, in And? While I like it as much as the next guy, django-tagging, to take your example, is currently sitting at version 0.2.1, released in Januar

Re: validation and the ORM layer

2009-05-25 Thread martin f krafft
also sprach Alex Gaynor [2009.05.25.1945 +0200]: > Django does not currently support model-validation, there is > a google summer of code project being done by Honza Kral to add > support for this. Good to know, thanks. This means that the feature won't be in 1.1 though, right? -- martin | htt

Re: Iterate over MultipleChoiceList in Template

2009-05-25 Thread Richard
Hey Retro, I'm struggling with the same thing. I've found two interesting links which take two different approaches although I can't get either to quite work (I think the template is just not seeing the actual control but it's not complaining loudly). But it's quite possible that you'll be able to

Sort order ascending/descending

2009-05-25 Thread janedenone
Hi, I just wrote the following to switch between ascending and descending sort order in a table view: view: columns = [ {'ABC' : u'abc'}, {'DEF' : u'def'}, {'GHI' : u'ghi'}, {'JKL' : u'jkl'} ] for column in columns: for column_title in column: if column[column_title] ==

Get the user inside a form class

2009-05-25 Thread Oliver Zheng
I have a ModelForm that has a field of User. I'd like this to be automatically set to whichever user is logged in. I can think of only one solution, passing request.user into the constructor of the form and have save() set it, but it *does not work* for generic views, since they need a form class

Re: validation and the ORM layer

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 12:35 PM, martin f krafft wrote: > Hey folks, > > while playing around with the DB API last night, we discovered that > the ORM layer does not enforce content validation. > > Since the blank field option defaults to False, we expected to be > unable to save ORM objects with

Re: de-facto tagging (was: When do snippets get into Django?)

2009-05-25 Thread martin f krafft
also sprach Dougal Matthews [2009.05.23.1823 +0200]: > Fair enough. I don't really have an issue with the idea, could be > quite handy. > > I can just imagine them saying no :) so thought I would question > it as a move/idea. Look what I found! Check out the fifth point, labeled #1, top-most ann

validation and the ORM layer

2009-05-25 Thread martin f krafft
Hey folks, while playing around with the DB API last night, we discovered that the ORM layer does not enforce content validation. Since the blank field option defaults to False, we expected to be unable to save ORM objects with empty fields, but the DB API will let us do just that: class Beers

Re: use of HttpResponseForbidden(), etc.

2009-05-25 Thread notcourage
@require_GET def forbiddenView(request): return HttpResponseForbidden() --~--~-~--~~~---~--~~ 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: ifequal tag within nested for: html forms

2009-05-25 Thread Daniel Roseman
On May 25, 2:29 pm, Pablo López wrote: >                         {% ifequal str(problemImpact.description) > (impact.0) %} This is not valid Django template syntax - I am surprised it works at all. You can't call functions with parameters within Django templates. -- DR. --~--~-~--~~

Re: How to count objects for each date in django.views.generic.date_based.archive_index?

2009-05-25 Thread Laurent Meunier
On Fri, 22 May 2009 18:28:57 -0700 (PDT) Don Spaulding wrote: > > > > On May 22, 8:16 pm, Don Spaulding wrote: > > On May 22, 1:13 pm, Laurent Meunier wrote: > > > > > > > > > Hi list! > > > > > I'm looking for a way to have the number of objects for each date > > > in the date_list object

Best practice regarding sessions

2009-05-25 Thread vishy
Hi, Are there any best practice regarding sessions in Django? Do yu normally use db based sessions? What about using hidden element for some scenarios, to maintain session? regards vishy --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: Help with some models inheritance and the use of default

2009-05-25 Thread V
On May 6, 3:56 pm, Felix wrote: > I have the next models: > > class Place(models.Model): >     currency = models.CharField(_('currency'), max_length=128, > blank=True, null=True) >     language = models.CharField(_('official language'), > max_length=128, blank=True, null=True) >     class Meta: >

abstract model with save method

2009-05-25 Thread Viktor
Hi, I have the following abstract model, but it's child models fail saving with RuntimeError: maximum recursion depth exceeded class AcceptedRoleAbstract(models.Model): ''' Represents a User that should accept a role E.g.: Discutant, Reviewer ''' user = models.OneToOneField(

ImageField form validation doesn't work.

2009-05-25 Thread [CPR]-AL.exe
Hello. I have a simple form with only ImageField declared in it and I've got the following problem: when I am trying to upload something that is not am image, i get no errors at all. Form.is_valid() returns True. What should I do to validate the imagedata? --~--~-~--~~

ModelChoiceField choice_cache

2009-05-25 Thread robin
I was trying to find a way to get ModelChoiceFields to use an already cached Model, and I came across in django/forms/models.py , under class ModelChoiceField, a variable called: self.choice_cache=None class ModelChoiceIterator seems to be the only thing that plays with it, but with or without c

Any way to get a left outer join when following foreign key relationships?

2009-05-25 Thread zinckiwi
Hi folks, I have a seemingly straightforward problem but can't figure out a way to do it natively in the ORM. I have two models: class Puzzle(models.Model): name = models.CharField(max_length=50) class Result(models.Model): user = models.ForeignKey(User) puzzle = models.

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:30 AM, Bobby Roberts wrote: > > > For a case like this they probably result in roughly the same (if not > > identical) SQL. In general it's better to use Q objects since django > > doens't have to piece together 2 seperate cases and then munge them > > together, which c

ifequal tag within nested for: html forms

2009-05-25 Thread Pablo López
Hi everyone, I am having problems with a string comparison in a django template and I'd very much appreciate some help here! This template is rendered from a view and gets to variables: - HTproblemImpact, a dictionary with strings as keys (the "problems") and Impact objects as values. The Impact

Re: efficiency question on filters

2009-05-25 Thread Bobby Roberts
> For a case like this they probably result in roughly the same (if not > identical) SQL.  In general it's better to use Q objects since django > doens't have to piece together 2 seperate cases and then munge them > together, which can get difficult with complicated aliasing and probably can > pro

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:19 AM, Bobby Roberts wrote: > > > If you take a look at Q objects they allow you to do just that: > http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-looku... > > > > Alex > > Hi Alex... that might take some reading up on and time is short at the > moment.

Re: efficiency question on filters

2009-05-25 Thread Bobby Roberts
> If you take a look at Q objects they allow you to do just > that:http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-looku... > > Alex Hi Alex... that might take some reading up on and time is short at the moment. I just found the pipe delimiter in filters so: pg=WebPage.obje

Re: efficiency question on filters

2009-05-25 Thread Alex Gaynor
On Mon, May 25, 2009 at 8:04 AM, Bobby Roberts wrote: > >pagelist=[] > >pg=WebPage.objects.filter(body__icontains=delurl) >if pg.count()>0: >for id in pg: >pagelist.append(id.url_slug) > >pg2=WebPage.objects.filter(blurb__icontains=delurl) >if pg2.count()>0

efficiency question on filters

2009-05-25 Thread Bobby Roberts
pagelist=[] pg=WebPage.objects.filter(body__icontains=delurl) if pg.count()>0: for id in pg: pagelist.append(id.url_slug) pg2=WebPage.objects.filter(blurb__icontains=delurl) if pg2.count()>0: for id in pg2: pagelist.append(id.url_slug)

Re: Field xyz that is missing from the form

2009-05-25 Thread Karen Tracey
On Mon, May 25, 2009 at 6:57 AM, adelaide_mike wrote: > > Hi > Be gentle with me. I am on my 7th day with Django. I have completed > the tutorial for 1.0.2 and have started building an app that has three > models in a hierarchy, Suburb, Street and Property. All are available > in the basic Admi

Re: Obfuscate HTML..?

2009-05-25 Thread Chris Czub
What reason do you have for this? Security through obfuscation isn't a good strategy, especially with something as intrinsically open as HTML. If your site can be hacked just by being able to view the HTML then you have bigger problems to worry about than obfuscating it. On Mon, May 25, 2009 at 4

Re: Using forms to display multi-column table for input

2009-05-25 Thread V
On May 25, 1:46 pm, vishy wrote: > Hi, > My requirement is to display a 2-column table (moves to be entered by > user for white and black of a chess game) with 10 rows for  input > (textbox).How can I use forms module to achieve this? Is it possible? > thanks I think the easiest way to do this w

Re: runserver fails

2009-05-25 Thread Karen Tracey
On Sun, May 24, 2009 at 11:36 PM, Chris DPS wrote: > > No. I get the same error. > I tried that on 3 versions of python with the same result. > Which means there is something fundamentally broken with Python's ability to access the network on this machine, and until that is fixed, Django isn't g

Using forms to display multi-column table for input

2009-05-25 Thread vishy
Hi, My requirement is to display a 2-column table (moves to be entered by user for white and black of a chess game) with 10 rows for input (textbox).How can I use forms module to achieve this? Is it possible? thanks --~--~-~--~~~---~--~~ You received this message b

setting choices on choice field dynamically according to objects current state

2009-05-25 Thread Simon Davies
I have a choices field called status in my model form which can be set to a number of values, however the options available will be based on its current state something like this, so it needs to refer to itself: class ContractForm(ModelForm): def getStatusChoices() if status == 'r':

Re: Revisit Django trunk and Python 2.6

2009-05-25 Thread wongobongo
I had no prob. running trunk on Py2.6. I ended up going back to Py 2.5 because the Google App Engine environment is still running 2.5 (that's where my latest app is going). See... http://code.google.com/p/googleappengine/issues/detail?id=1159 K On May 24, 12:21 am, Kegan wrote: > I am always

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Sieker Adi Jörg
Hi, On 25.05.2009, at 10:59, Mike Ramirez wrote: > On Monday 25 May 2009 01:41:31 am Andy wrote: > >> But how do I stop user A from trying to edit the profile of user B? > > in urls.py > > url(r'profile/(P)/', 'up.views.profile', name='profile') you don't need the user name in the url for edit

Re: IOError: request data read error (revisited)

2009-05-25 Thread Graham Dumpleton
On May 25, 4:53 am, Jeff FW wrote: > Thanks for your response. Sorry I didn't respond earlier--been quite > busy. > > I don't know for certain that anyone's seeing a 500 response--I get an > e-mail from Django (traceback below) and an error in the Apache logs > (below).  I've never received an

Field xyz that is missing from the form

2009-05-25 Thread adelaide_mike
Hi Be gentle with me. I am on my 7th day with Django. I have completed the tutorial for 1.0.2 and have started building an app that has three models in a hierarchy, Suburb, Street and Property. All are available in the basic Admin, working very well. Now I emulated the tutorial by building a S

quote_plus

2009-05-25 Thread Aldo
I want to use quote_plus in my django templates to display a url. Can anyone tell me how I call it in my template? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: reset button question

2009-05-25 Thread Jani Tiainen
Bobby Roberts kirjoitti: > i'm trying to put a simple reset button on a form but it's not > working Why wouldn't a standard html reset button be working? No reason but you definitely shouldn't put reset button on a form in a first place [1]. [1] http://www.useit.com/alertbox/2416.html --

How to pass variables from a different file to via a view to a template?

2009-05-25 Thread jon michaels
Hi list, In an attempt to follow the DRY principle and keep environment specific variables separate from my application code, i decided to put a number of application specific variables in a different file. So i have a file like this: --- u...@host:~/program$ more appenv.py ## # app environ

prev/next links

2009-05-25 Thread Brian May
Hello, I have a photo gallery application, where it is possible to list photos in order, from different search requests (e.g. search by Album, Category, Person, etc). In the photo_detail page I want to provide prev/next links that take the user forward or backword to the last photo. ie. so what

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Eric Abrahamsen
On May 25, 2009, at 4:41 PM, Andy wrote: > > > > On May 24, 9:54 pm, Brian Neal wrote: >> On May 24, 6:50 pm, Continuation wrote: >> >>> For example, I have a view edit_profile that edits a user's profile. >>> Obviously I want to make sure that each user can edit his own >>> profile >>> only

Re: Email error reporting not working

2009-05-25 Thread r.
Is the EMAIL_HOST (and related variables) set in the settings.py file? On May 25, 9:19 am, Rex wrote: > Hi, > > I am having trouble getting error reporting via email to work (as > described herehttp://docs.djangoproject.com/en/dev/howto/error-reporting/ > ). When I hit a 500 error, no email reac

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Mike Ramirez
On Monday 25 May 2009 01:41:31 am Andy wrote: > But how do I stop user A from trying to edit the profile of user B? in urls.py url(r'profile/(P)/', 'up.views.profile', name='profile') in views.py def edit(request, username): profile = UserProfile.objects.get(username__exact=username) for

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Andy
On May 24, 9:54 pm, Brian Neal wrote: > On May 24, 6:50 pm, Continuation wrote: > > > For example, I have a view edit_profile that edits a user's profile. > > Obviously I want to make sure that each user can edit his own profile > > only. > > > So before the profile of user A is being edited b

Re: Obfuscate HTML..?

2009-05-25 Thread Andy Mikhailenko
Built-in template tag {% spaceless %) can do a part of work for you (namely, remove the extra whitespace), but to actually obfuscate the code you should either use middleware or make extensive use of JavaScript (e.g. open GMail and try to read the source). However, the idea in general sounds stran

Re: Email error reporting not working

2009-05-25 Thread Christian Joergensen
Rex wrote: > Hi, > > I am having trouble getting error reporting via email to work (as > described here http://docs.djangoproject.com/en/dev/howto/error-reporting/ > ). When I hit a 500 error, no email reaches the admin's inbox. > > Here is what I have done: > - I set DEBUG to False > - I define

Email error reporting not working

2009-05-25 Thread Rex
Hi, I am having trouble getting error reporting via email to work (as described here http://docs.djangoproject.com/en/dev/howto/error-reporting/ ). When I hit a 500 error, no email reaches the admin's inbox. Here is what I have done: - I set DEBUG to False - I defined an Admin user and entered m

Re: How to use filtering

2009-05-25 Thread Daniel Roseman
On May 25, 8:08 am, Oleg Oltar wrote: > Hi! > > I am trying to understand how to use filters in django. > > I have following models: > > class Section(models.Model): >     section = models.CharField(max_length=200, unique=True) >     name = models.CharField(max_length=200, blank = True) >     cat

How to use filtering

2009-05-25 Thread Oleg Oltar
Hi! I am trying to understand how to use filters in django. I have following models: class Section(models.Model): section = models.CharField(max_length=200, unique=True) name = models.CharField(max_length=200, blank = True) category = models.ForeignKey(Category, blank=True) pub

mass entering data into django: ignoring errors

2009-05-25 Thread nbv4
I have about 42,000 lines in a database that I need imported into my Django database. I made a PHP script that outputs the data like o: Base.objects.get_or_create(identifier="92NC", local="92NC", type=5, elevation="1178", iata="", name="Grace Hospital Heliport",country="United States", region="No