Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Great :). Thanks... Wish i had read your post more thoroughly the first time. This takes care of my second problem, but what about the first one - why do password fields need to be filled? Because empty(or nonexisting data) fields cannot be compared in 2nd if ? Then what is the syntax for makin

Re: Some ForeignKeys show up as list_filters, some don't.

2009-06-07 Thread Rodrigo Cea
Found the answer here; http://groups.google.com/group/django-users/browse_thread/thread/89b4146892801ed4/17f2d26e10709ba0?lnk=gst&q=foreignkey+list_filter#17f2d26e10709ba0 Short version: "If you only have one record in the table related to your foreign key, then the filter list will not show up

how many levels allowed in models

2009-06-07 Thread jayvandal
I have four tables 1 Patient 2 has many doctors 3 doctor issues pills 4 order many pills when I run syncdb I get the 3 levels showing in adminstrative screen. I can't get it to show the order screen (4) I tried the admin.site.register (Patient, Doctor, Pill

Some ForeignKeys show up as list_filters, some don't.

2009-06-07 Thread Rodrigo Cea
I have a model with 4 ForeignKeys: 'autor','categoria','edicion' and 'dossier'. In admin.py, I am trying to assign them as "list_filter". However, only 2 of them actually show up within the filters, 'autor' and 'categoria'. All four show up as columns without any problems. Does anybody have any cl

Problems with view... not sure how to get the data to my template

2009-06-07 Thread Mitch Anderson
Below is what I have currently... it currently displays the numbers in the range its supposed to, but tying the products and displaying those where they should be in the number list has become the problem... One product can have multiple numbers associated, and I didn't want to fully populate ever

Storing related models in cache?

2009-06-07 Thread Thomas Hill
Hey all, I'm trying to save on db queries in an online game I'm making, so I'm trying to save as many things in memcached as possible, and invalidating whenever the game state changes. So upon the first call, or after a game state change, I pull in my game model instance, and all of the related mod

Re: ForeignKey/ManyToManyField translation via verbose_name does not work.

2009-06-07 Thread Liubomir.Petrov
Update: My mistake, seems that only ManyToManyField is not working. Also posted a ticket here: http://code.djangoproject.com/ticket/11279#comment:2 On Jun 8, 3:14 am, Lyubomir Petrov wrote: > Example: > class Product(models.Model): >         categories = models.ManyToManyField > (Category,verbo

Make a "save and preview" button in admin.

2009-06-07 Thread Rodrigo Cea
I have added a "preview" button to the admin, like so: # In "templates/admin/core/change_form.html" {% extends "admin/change_form.html" %} {% load i18n %} {% block object-tools %} {% if change %}{% if not is_popup %} Preview {{ form.data}} {% trans "History" %} {% if has_absolute_url %

Re: Validate image size in admin.

2009-06-07 Thread Rodrigo Cea
Beautiful, works like a charm. Also finally learned how to validate in the admin! Thanks, Rodrigo --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-use

Re: Validate image size in admin.

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 9:42 PM, Rodrigo Cea wrote: > > So if I followed this: > > > http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin > > and the field I was cleaning was called "image", would the validation > function be called "clean_image"? > > Thank

Re: Validate image size in admin.

2009-06-07 Thread Rodrigo Cea
So if I followed this: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adding-custom-validation-to-the-admin and the field I was cleaning was called "image", would the validation function be called "clean_image"? Thanks for the super quick response, Rodrigo On Jun 7, 9:38 pm, Alex Gay

Re: Validate image size in admin.

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 9:37 PM, Rodrigo Cea wrote: > > How can I validate, in the admin, that images uploaded by users have a > minimum size in pixels? > > > Use the form argument to provide a cusotm Form object with additional validation: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#d

Validate image size in admin.

2009-06-07 Thread Rodrigo Cea
How can I validate, in the admin, that images uploaded by users have a minimum size in pixels? --~--~-~--~~~---~--~~ 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@go

Re: image upload

2009-06-07 Thread Dhruv Adhia
It seems bit confusing for me. When I create image field for example question = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') #an image to displayed here logo = models.ImageField(upload_to="images/logos/", blank=True, help_text="Should be 50px wide

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 2:54 PM, zayatzz wrote: > > Line 43 - if form.is_valid(): > Line 44 - message = "form valid: " + form.cleaned_data['username'] > > Alan > On Jun 7, 9:45 pm, Alex Gaynor wrote: > > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz > wrote: > > > > > When the form does pass all t

Re: Logging to Database while using @transaction.commit_manually decorator

2009-06-07 Thread Chris Stoyles
Hi Karen, Yes it does look as though I am using them backwards. I am at a bit of a loss as to how to get around this problem, though it is Monday morning and my brain isn't fully into gear yet. Can anyone think of a way for me to bypass the transaction management? I believe that even if I execute

Re: URLPatterns and QueryStrings

2009-06-07 Thread The Devil's Programmer
Note that on the 6th line where I typed - def search_page(request, search="", page=1): I actually meant - def search_page(): Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To

ForeignKey/ManyToManyField translation via verbose_name does not work.

2009-06-07 Thread Lyubomir Petrov
Example: class Product(models.Model): categories = models.ManyToManyField (Category,verbose_name="xcategories", blank=True,null=True) Also tried with: class Category(models.Model): ... class Meta: verbose_name = _('xcategory') verbose_name_plural =

URLPatterns and QueryStrings

2009-06-07 Thread thedevilsprogram...@gmail.com
I wish to use a QueryString on my search page like so /search?s=jupiter&page=2 So I have set up a single url pattern (r'^search/$', 'mything.myapp.views.search_page.search_page'), And I am then able to grab the parameters in my view, like so - def search_page(request, search="", p

Re: Logging to Database while using @transaction.commit_manually decorator

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 7:44 PM, ChrisStoyles wrote: > > Hi All, > > I just wanted to quickly reach out to the group for ideas as to why I > cannot get this to work: > > @transaction.commit_manually > def some_view(request): ># some view logic goes here > >sid = transaction.savepoint() >

Logging to Database while using @transaction.commit_manually decorator

2009-06-07 Thread ChrisStoyles
Hi All, I just wanted to quickly reach out to the group for ideas as to why I cannot get this to work: @transaction.commit_manually def some_view(request): # some view logic goes here sid = transaction.savepoint() le = models.LogEntry() le.message = 'A test log message' le.s

Re: Type Error str is not callable in base.py

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 5:42 PM, grElement wrote: > > Alex > > Sorry I wasn't more clear, but I wasn't suggesting that the fact I'm > getting the error is a bug, but it seems as though this error message > results in an uncaught error and that is something they are working on > already - see this

Re: An ORM request returns the same object twice?

2009-06-07 Thread James
Ah, I somehow missed distinct() when reading the docs. Sorry, and thanks for your help. On Jun 7, 2:20 pm, Karen Tracey wrote: > On Sun, Jun 7, 2009 at 8:47 AM, James wrote: > > > So the models I am using are at > > >http://github.com/jarofgreen/TaggedWiki/blob/e45ede936ebc2e88c9b60de7... > >

is my DateTimeField in the past?

2009-06-07 Thread Mozey
Here is my two attempts at trying to test if my DateTimeField is in the past or the future. # first attempt def past(self): return self.scheduled_time < datetime.now() # It complained that i cannot compare a datetime to a string, hence my second attempt # second attempt def past(self):

Re: Type Error str is not callable in base.py

2009-06-07 Thread grElement
Alex Sorry I wasn't more clear, but I wasn't suggesting that the fact I'm getting the error is a bug, but it seems as though this error message results in an uncaught error and that is something they are working on already - see this http://code.djangoproject.com/ticket/6442 Here is the entire t

Re: Type Error str is not callable in base.py

2009-06-07 Thread grElement
Paul Actually this is what I already have in all my model definitions - as suggested in some of the documentation and it's been working so far on several different projects. def __unicode__(self): return u'%s' % (self.title) Please also note that no changes were made to

Re: Using Admin features on other applications

2009-06-07 Thread Advanced Technology®
Thanks guys for the explanation. 2009/6/7 creecode > > Hello Azarias, > > On Jun 7, 12:32 pm, Advanced Technology® wrote: > > > Let me see if I got ur point. > > You mean actualy is not possible to use some parts of admin like forms, > > models listings, etc? > > You can use forms and and gene

Re: Using Admin features on other applications

2009-06-07 Thread creecode
Hello Azarias, On Jun 7, 12:32 pm, Advanced Technology® wrote: > Let me see if I got ur point. > You mean actualy is not possible to use some parts of admin like forms, > models listings, etc? You can use forms and and generic views in your own custom apps if you want < http://docs.djangoproje

Re: Using Admin features on other applications

2009-06-07 Thread Advanced Technology®
Thanks Paul Let me see if I got ur point. You mean actualy is not possible to use some parts of admin like forms, models listings, etc? The only way is extending the admin site itself. 2009/6/7 pkenjora > > Hi, > > You can use just the models and Django admin by itself. So if you > just wan

Re: Primary key defined by two foreignkeys?

2009-06-07 Thread Jaime Casanova
On Sun, Jun 7, 2009 at 2:11 PM, akaariai wrote: > > Use unique_together: > http://docs.djangoproject.com/en/dev/ref/models/options/ > what's the difference about this and primary key? at the database level they are almost the same thing (just adding a not null constraint to the column and you hav

Re: Primary key defined by two foreignkeys?

2009-06-07 Thread Joakim Hove
> Use unique_together:http://docs.djangoproject.com/en/dev/ref/models/options/ > > class Table3(models.Model): >     ... >     class Meta: >         unique_together = ("table1_key", "table2_key") Beautiful - thank you very much :-) Joakim --~--~-~--~~~---~--~~ Yo

Re: Primary key defined by two foreignkeys?

2009-06-07 Thread akaariai
On 7 kesä, 22:02, Joakim Hove wrote: > Hello, > > I have the following (schematic) situation: > > Class Table1(models.model): >     >     > > Class Table2(models.model): >     >     > > class Table3(models.model): >       table1_key = models.ForeignKey( Table1 ) >       table2

Re: Using Admin features on other applications

2009-06-07 Thread pkenjora
Hi, You can use just the models and Django admin by itself. So if you just want back end support run Django on top of your existing DB and implement only the admin and models pieces. The development version of Django (svn) allows you to extend the Django admin if you need better integration

Re: Type Error str is not callable in base.py

2009-06-07 Thread pkenjora
Hi, I just got this error a few days back. It was resulting from a OnetoOne model referencing 'user' in one of the admin display_fields. I thought user would resolve to the __unicode__ value of the user model, for some reason (django bug?) it does not. THE FIX This is more like a patch,

changing site url

2009-06-07 Thread Kenneth Gonsalves
hi, I have an app which is being used to conduct an annual event. The app lives in the 'web' directory of the project and is named 'web'. I serve the app from root - that is, home is at: http://mysite.com/home/ http://mysite.com/web/home/ also works I now need to serve this from: http://mysi

how to override ordering in date-based generic views

2009-06-07 Thread josebrwn
Hi, I'm looking for a straightforward way to override the default ordering of the date-based generic view, in order to allow 'featured' entries to percolate to the top in a coltrane blog. So: info_dict = { 'queryset': Entry.objects.all(), 'date_field': 'pub_date', } urlpatterns = patte

Primary key defined by two foreignkeys?

2009-06-07 Thread Joakim Hove
Hello, I have the following (schematic) situation: Class Table1(models.model): Class Table2(models.model): class Table3(models.model): table1_key = models.ForeignKey( Table1 ) table2_key = models.ForeignKey( Table2 ) . Now, I want t

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Line 43 - if form.is_valid(): Line 44 - message = "form valid: " + form.cleaned_data['username'] Alan On Jun 7, 9:45 pm, Alex Gaynor wrote: > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > > When the form does pass all that validation i get this error in view : > > > Exception Type:    

Re: Seeing form validation errors

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 2:38 PM, zayatzz wrote: > > When the form does pass all that validation i get this error in view : > > Exception Type: TypeError > Exception Value: > 'NoneType' object is unsubscriptable > Exception Location: /home/projects/tst/profile/views.py in > profile_deta

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
When the form does pass all that validation i get this error in view : Exception Type: TypeError Exception Value: 'NoneType' object is unsubscriptable Exception Location: /home/projects/tst/profile/views.py in profile_detail, line 44 Line 44 is - message = "form valid: " + form.clean

Re: Seeing form validation errors

2009-06-07 Thread zayatzz
Thanks to both of you! I changed template form tag to {{ form.as_p }} I figured that since my posting view did not give form to context again, but did just redirect, that i had to change this. I also added custom messages to pass to the template from different parts of the view - if request is

Re: User getting inadvertently logged out

2009-06-07 Thread metametagirl
Hi Karen, THANK YOU! After much head-scratching and debugging late into the night, I indeed found that both sites were naming the sessionid cookie "sessionid", but I am glad that you have confirmed my suspicion! My temporary workaround was to always use "127.0.0.1" for site A, and "localhost" f

Re: Install PIL on a shared hosting

2009-06-07 Thread Phui Hock
On Jun 7, 11:55 pm, Alex Gaynor wrote: > On Sun, Jun 7, 2009 at 9:23 AM, simonecare...@gmail.com < > > > > simonecare...@gmail.com> wrote: > > > I'm on SITE5. > > > I've just created a symbolic link to PIL from my PYTHON PATH. > > > I can import PIL module, but now I get this error: > > > The _im

Re: Seeing form validation errors

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > [snip form def] > For some reason the view does not save the stuff i get with form and i > want to figure out why. > > Perhaps form does not validate for some reason... Where or how can i > see those validationerrors.. how

Re: Seeing form validation errors

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 12:57 PM, zayatzz wrote: > > I have this form: > > class AccountForm(forms.Form): >username = forms.CharField(max_length=100, help_text="Enter Username > of your account", label="Your username") >email = forms.EmailField(max_length=100, help_text="Enter your

Seeing form validation errors

2009-06-07 Thread zayatzz
I have this form: class AccountForm(forms.Form): username = forms.CharField(max_length=100, help_text="Enter Username of your account", label="Your username") email = forms.EmailField(max_length=100, help_text="Enter your e-mail address", label="Your e-mail address") first

Using Admin features on other applications

2009-06-07 Thread themu...@gmail.com
Hello, I'm new to Django, This is my first post on this group. How can I use admin features on other applications? I'm building an application that requires some CRUD operations and I don't want to extend the admin interface or reinvent the wheel on my application. Is there an easy way to do th

Re: Install PIL on a shared hosting

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 9:23 AM, simonecare...@gmail.com < simonecare...@gmail.com> wrote: > > I'm on SITE5. > > I've just created a symbolic link to PIL from my PYTHON PATH. > > I can import PIL module, but now I get this error: > > The _imaging C module is not installed > > On Jun 7, 2:11 pm, Ken

Re: How to delete a setting

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 7:51 AM, Julien Phalip wrote: > > Hi, > > In a unit test, I'd like to test the behaviour of a middleware in the > absence of a setting. To make sure the setting is not present, I try > to delete it: > > def test_middleware(self): >if hasattr(settings, 'BLAH'): >

Re: Type Error str is not callable in base.py

2009-06-07 Thread Alex Gaynor
On Sun, Jun 7, 2009 at 5:53 AM, Daniel Roseman < roseman.dan...@googlemail.com> wrote: > > On Jun 7, 9:33 am, grElement wrote: > > Yeah, I couldn't figure it out either since the error message is not > > so helpful and it seems that this is actually a django bug that they > > are currently workin

Re: The best hoster to install Django

2009-06-07 Thread Peter2108
I use Webfaction (I'm in UK) and think they are great. The sites are low traffic. Webfaction started out as a Python specialist company AFAICT. Peter On Jun 7, 12:44 am, Bro wrote: > Hi Everyone, > > I ask a question : What is the best hoster to install Django ? > Because Django is a very cool

Re: Admin Sites on Admin

2009-06-07 Thread Michael
On Sun, Jun 7, 2009 at 11:41 AM, Peter2108 wrote: > > On the Admin top-level page there is an app called 'Sites'. Where do I > find out what this for? > In the documentation: http://docs.djangoproject.com/en/dev/ref/contrib/sites/ --~--~-~--~~~---~--~~ You receiv

Admin Sites on Admin

2009-06-07 Thread Peter2108
On the Admin top-level page there is an app called 'Sites'. Where do I find out what this for? Thanks, Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: The best hoster to install Django

2009-06-07 Thread K.Berkhout
I forgot the "etc". :-) On 7 jun, 11:38, Kenneth Gonsalves wrote: > On Sunday 07 June 2009 14:53:17 K.Berkhout wrote: > > > Depends on what your location and the location of your (future) users > > is. > > Are you based in Europe or the USA? > > or in Asia, Africa, Australia, Antartica ... > --

Re: Install PIL on a shared hosting

2009-06-07 Thread simonecare...@gmail.com
I'm on SITE5. I've just created a symbolic link to PIL from my PYTHON PATH. I can import PIL module, but now I get this error: The _imaging C module is not installed On Jun 7, 2:11 pm, Kenneth Gonsalves wrote: > On Sunday 07 June 2009 17:22:26 simonecare...@gmail.com wrote: > > > I've noticed

Re: An ORM request returns the same object twice?

2009-06-07 Thread Karen Tracey
On Sun, Jun 7, 2009 at 8:47 AM, James wrote: > > So the models I am using are at > > http://github.com/jarofgreen/TaggedWiki/blob/e45ede936ebc2e88c9b60de7572b5048da43c0e6/taggedwikitest/taggedwiki/models.py > > Here is some test code to run on an empty DB: > > >>> from taggedwiki.models import *

An ORM request returns the same object twice?

2009-06-07 Thread James
So the models I am using are at http://github.com/jarofgreen/TaggedWiki/blob/e45ede936ebc2e88c9b60de7572b5048da43c0e6/taggedwikitest/taggedwiki/models.py Here is some test code to run on an empty DB: >>> from taggedwiki.models import * >>> s = Space.objects.create(Title='test') >>> p1 = Page.obj

Re: Install PIL on a shared hosting

2009-06-07 Thread Kenneth Gonsalves
On Sunday 07 June 2009 17:22:26 simonecare...@gmail.com wrote: > I've noticed PIL is not installed on my shared hosting. > > I tried to install it through setup.py but I got a permission error. > > Has someone ever installed it on a shared hosting plan? which shared hosting plan? If you are on a

Install PIL on a shared hosting

2009-06-07 Thread simonecare...@gmail.com
Hi to all. I've noticed PIL is not installed on my shared hosting. I tried to install it through setup.py but I got a permission error. Has someone ever installed it on a shared hosting plan? Thanks, Simone. --~--~-~--~~~---~--~~ You received this message becaus

How to delete a setting

2009-06-07 Thread Julien Phalip
Hi, In a unit test, I'd like to test the behaviour of a middleware in the absence of a setting. To make sure the setting is not present, I try to delete it: def test_middleware(self): if hasattr(settings, 'BLAH'): delattr(settings, 'BLAH') response = self.client.get('

Re: Type Error str is not callable in base.py

2009-06-07 Thread Daniel Roseman
On Jun 7, 9:33 am, grElement wrote: > Yeah, I couldn't figure it out either since the error message is not > so helpful and it seems that this is actually a django bug that they > are currently working on, but according to the documentation of the > error reporting bug it should be coming from my

Re: How to SEO adapt a I18N django web site..

2009-06-07 Thread jenlu
Hi, could not wait so started to get this done while at ARN airport. Two things (i) Swedish is 'sv' or 'swe' in ISO639 depending if you want to use the 2 or 3 char style - but nevermind... (ii) installed and have everything up and running but can not find or understand the connection the I18N cook

Re: The best hoster to install Django

2009-06-07 Thread Kenneth Gonsalves
On Sunday 07 June 2009 14:53:17 K.Berkhout wrote: > Depends on what your location and the location of your (future) users > is. > Are you based in Europe or the USA? or in Asia, Africa, Australia, Antartica ... -- regards kg http://lawgon.livejournal.com --~--~-~--~~~---

Re: The best hoster to install Django

2009-06-07 Thread K.Berkhout
Depends on what your location and the location of your (future) users is. Are you based in Europe or the USA? Kevin On 7 jun, 09:47, Bro wrote: > Thanks a lot to Kenneth Gonsalves and Dj Gilcrease :) > > Regards > Bro > > On 7 juin, 02:20, Kenneth Gonsalves wrote: > > > On Sunday 07 June 2009

Re: Type Error str is not callable in base.py

2009-06-07 Thread grElement
Yeah, I couldn't figure it out either since the error message is not so helpful and it seems that this is actually a django bug that they are currently working on, but according to the documentation of the error reporting bug it should be coming from my view file. Weird thing is I've used this sam

Re: The best hoster to install Django

2009-06-07 Thread Bro
Thanks a lot to Kenneth Gonsalves and Dj Gilcrease :) Regards Bro On 7 juin, 02:20, Kenneth Gonsalves wrote: > On Sunday 07 June 2009 05:14:20 Bro wrote: > > > I ask a question : What is the best hoster to install Django ? > > http://djangofriendly.com/hosts/  < study them all and remember