Re: conditional submit depending on ajax call

2012-08-22 Thread Tom Evans
Your JS looks decidedly incorrect. You say the aim is to prevent the form being submitted in certain scenarios, yet your form submit handler neither returns true nor false. You return truthiness from your anonymous AJAX handler, but that is not the same. Secondly, your check to see whether to

Re: authenticate=None mistery: can't authenticate from the web but it works from the command line

2012-08-22 Thread Tom Evans
In addition to the 'user'/'username' typo, this login view would not log a user in. In order to log a user in, you must verify their credentials by calling django.contrib.auth.authenticate(), which will either return an authenticated user or None. Once the credentials are verified, you must then

Re: Using sessions in Django

2012-08-17 Thread Tom Evans
On Fri, Aug 17, 2012 at 9:12 AM, Thomas Orozco wrote: > Session key is the session 's primary key. Not the session itself. > > What you want to assign to your field is a session, not its key. So use > request.session. > This would not work; request.session is a

Re: Get count using annotate

2012-07-19 Thread Tom Evans
On Thu, Jul 19, 2012 at 5:00 PM, karan wrote: > Hi, > > my models is- > > class Students(models.Model): > country = models.ManyToManyField( Country ) > > I want to calculate the total number of student objects for each of the > country objects. > > I need the

Re: [] Re: queryset caching - without caching middleware

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 4:08 PM, Henrik Genssen wrote: >>Could you show where and how you are executing the query? If the >>queryset is a global, and does not go out of scope at the end of the >>request, then reusing the queryset will not cause the queryset to be

Re: queryset caching - without caching middleware

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 3:49 PM, Melvyn Sopacua wrote: > On 5-7-2012 14:28, hinnack wrote: >> - can I disable or force a "refresh" of the cache? > > > Transactions/READ

Re: insert html into a form from Django code (not template)

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 3:35 PM, Melvyn Sopacua wrote: > Nice solution, but weren't formsets made for this type of thing? I'm > trying to figure out why formsets couldn't be used here and coming up > blank, unless the naming convention is somehow unchangeable. Possibly.

Re: queryset caching - without caching middleware

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 1:28 PM, hinnack wrote: > hmm, Ok, Queryset Caching happens alle the time... > > So here are some more questions on this: > - where is the data stored? > - can I ask a model, if its result is cached or a fresh one? > - can I disable or force a

Re: insert html into a form from Django code (not template)

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 1:15 PM, angelika wrote: > I've written a longer post here: > http://stackoverflow.com/questions/11341118/printing-repeated-django-form-fields-individually > explaining what I need. Either a way to individually print out the fields in > a loop or

Re: view didn't return an HttpResponse object....plz help

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 8:38 AM, manish girdhar wrote: > yes it was indentation error and i rectified that.thanks for the concern > friend.. > I would have thought that it was you refering to the undefined variable rollno here: cd = form.cleaned_data

Re: mysqldb help! Can't connect to MySQL server error...

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 2:59 PM, Sergiy Khohlov wrote: > Could you please connect to mysql from console. Is it OK ? > > Look like > mysql is not started > you connect to wrong port > connect from network is blocked > credentials are wrong > Seriously? WTF? This is a thread

Re: migration via south for inheritance change -> please help

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 2:33 PM, Tomas Neme wrote: > I wanted to chang the subject because I didn't want to spam someone's > plead for help into a design discussion, but then I thought, how am I > gonna make sure this is read by the right people? Also, context would > be

Re: mysqldb help! Can't connect to MySQL server error...

2012-07-05 Thread Tom Evans
On Thu, Jul 5, 2012 at 1:53 PM, Melvyn Sopacua wrote: > On 4-7-2012 21:31, Matthew Piatkowski wrote: >>> DATABASE_PORT = '3036' # Set to empty string for default. >>> Not used with sqlite3. >>> > Typo that should probably 3306. > I'm sure the guy from 2009 that

Re: Controlling access

2012-07-05 Thread Tom Evans
On Tue, Jul 3, 2012 at 6:39 PM, Larry Martell wrote: > I have a client that asked me to add some new functionality to their > app, and then they said 'This new functionality should be controlled > in Django admin so that only the admin user can see it.' Is there a > way

Re: Distributing Django apps

2012-05-17 Thread Tom Evans
On Tue, May 15, 2012 at 12:31 PM, Steve Kilbane wrote: > I had a look at fagungis, but it didn't seem to be addressing the > issue. I didn't give much detail before, so that's not a surprise. :-) > > So: > > Stage 1: person X develops an open source Django app. > >

Re: Django for the first time

2012-05-16 Thread Tom Evans
On Wed, May 16, 2012 at 12:02 PM, MEL wrote: > Can anyone help me ? > Can't even create my first site  in the tutorial :-( > > Python 2.7.3 (default, Apr 20 2012, 22:39:59) > [GCC 4.6.3] on linux2 > Type "copyright", "credits" or "license()" for more information.

Re: IndentationError

2012-05-16 Thread Tom Evans
On Wed, May 16, 2012 at 12:43 PM, ahmad wrote: > hi > I have a URL: > >> url(r'^airline/ticket/ajax/add$', airline_ticket_ajax_add, >> name='airline_ticket_ajax_add' ), > > > and when I try to reverse this URL I get: > >>> Exception Type: IndentationError at /sell/ >>>

Re: Help - Which IDE is best to use.

2012-05-16 Thread Tom Evans
On Tue, May 15, 2012 at 8:52 PM, knowledge_seeker wrote: > For people used to using Vim in Unix, there is an Eclipse plug-in called > Vwrapper. > > - knowledge_seeker > For people used to using vim there is vim. http://pragmatictips.com/22 No amount of point and

Re: Django models and different types

2012-05-11 Thread Tom Evans
On Fri, May 11, 2012 at 12:39 PM, Michael da Silva Pereira wrote: > > Hi, > > Looking for some ideas around a type / conversion matching > issue I'm having with a big django model. > The model has tons of variables, and all being of different types > (int, nullbool, date,

Re: Filter by retirement age?

2012-05-09 Thread Tom Evans
On Wed, May 9, 2012 at 12:12 AM, Lachlan Musicman wrote: > Hola, > > I have a model Person with a dob = models.DateField() > > I would like to filter by age - in particular only include people less than > 60 years old. > > I am having no luck getting the syntax right and was

Re: Django Pagination Not Working!

2012-05-08 Thread Tom Evans
On Sun, May 6, 2012 at 10:56 PM, coded kid wrote: > I'm trying to paginate a page in order to display five statuses per > page. After inputting these codes, it fails to paginate. Below are the > codes for pagination and updating of status in my django app. > > > Views: > >

Re: Hooking into Django Sessions

2012-05-08 Thread Tom Evans
On Mon, May 7, 2012 at 7:48 AM, M Oklah wrote: > > Hello, > > Is it possible to hook into Django so that a user defined callback method is > executed each time a session expires? > > > Thanks, > > -Moe > Yes/no/maybe. Depends what you want to do. First of all, nothing

Re: Dajaxice is not defined!!! please heelpppp!! :(

2012-05-04 Thread Tom Evans
On Fri, May 4, 2012 at 4:06 PM, doniyor wrote: > if i call the dajaxice.core.js directly from address bar, it shows an error > saying: ValueError at /dajaxice/dajaxice.core.js The view home.views.index > didn't return an HttpResponse object. > > so it means, i am

Re: Displaying markdown in html

2012-05-04 Thread Tom Evans
On Fri, May 4, 2012 at 1:55 PM, Emily Namugaanyi wrote: > I am trying to display markdown in my html but it is returning a body > with html tags: > This is what is happening... > > code in the > > > > > > >  {% for guideline in guidelines %} >                    {% load

Re: 404 Issues

2012-05-04 Thread Tom Evans
On Thu, May 3, 2012 at 10:54 AM, James Hargreaves wrote: > Hello, > > I have created a website using Django CMS: > > http://www.trailer-traders.co.uk > > When I visit a URL on this site that does not exist in Django CMS I get a > 500 error - eg: > >

Re: How to get caller function from a function

2012-05-04 Thread Tom Evans
On Fri, May 4, 2012 at 4:30 AM, cj wrote: > Hi to all, > > Just wan't to ask if its possible. > > at helper.py > > def myfunc(): >    blah blah blah > > and then in views.py > > def myview1(): >    myfunc() > > def myview2(): >   myfunc() > > my question is how can i get

Re: Why does django use mysqldb over mysql-connector?

2012-05-04 Thread Tom Evans
On Fri, May 4, 2012 at 2:18 AM, john2095 wrote: > I've just been through a slice of hell simply because I did not want to > install mysql-server on my (osx) django development machine - my app > connects to a remote mysql database.  It turns out that python's "mysqldb" >

Re: Error: 'module' object is not callable

2012-04-27 Thread Tom Evans
On Fri, Apr 27, 2012 at 4:03 PM, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On Apr 27, 2:30 pm, Tom Evans <tevans...@googlemail.com> wrote: >> >> The datetime class lives inside the datetime module. > > So far so good but! > >> You m

Re: Error: 'module' object is not callable

2012-04-27 Thread Tom Evans
On Fri, Apr 27, 2012 at 6:46 AM, Gopi Kirupanithi wrote: > Actually I am using datetime object for comparing two date inputs. > > if datetime(fromdtpart[2],fromdtpart[1],fromdtpart[0]) < > datetime(todtpart[2], todtpart[1], todtpart[0]): > > while execute the above line, I

Re: Web services.

2012-04-27 Thread Tom Evans
On Thu, Apr 26, 2012 at 4:20 PM, Sherif Shehab Aldin wrote: > Hi All, > > I am developing some django apps, mostly they are adds to the django admin > interface... What I need to do a lot is adding some Ajax calls, but I am a > bit confused about weather It's better to

Re: why django document does not specify how to use non-global middleware

2012-04-26 Thread Tom Evans
On Thu, Apr 26, 2012 at 12:20 PM, Marcin Tustin <marcin.tus...@gmail.com> wrote: > On Thu, Apr 26, 2012 at 09:34, Tom Evans <tevans...@googlemail.com> wrote: >> >> What one framework may call something may not be what another >> framework does, and users mov

Re: Left Join

2012-04-26 Thread Tom Evans
On Thu, Apr 26, 2012 at 12:12 PM, David wrote: > I have models similar to this: > > class Person(models.Model): >     first_name = models.CharField(max_length=255) >     last_name = models.CharField(max_length=255) > > class PersonAttendance(models.Model): >  

Re: why django document does not specify how to use non-global middleware

2012-04-26 Thread Tom Evans
On Wed, Apr 25, 2012 at 5:50 PM, Marcin Tustin wrote: > Just because you used to do it in Struts, it does not mean that it is the > best, or even a good, way to do it in django. > That's not true, certainly not in this case. A commonly used feature in Django is the

Re: form doing a query for each element of foreign key in select

2012-04-25 Thread Tom Evans
On Wed, Apr 25, 2012 at 4:43 PM, Lee Hinde <leehi...@gmail.com> wrote: > > On Apr 25, 2012, at 2:16 AM, Tom Evans wrote: > >> On Wed, Apr 25, 2012 at 5:58 AM, Lee Hinde <leehi...@gmail.com> wrote: >>> I have a table with four or five foreign keys. Using the def

Re: Ignoring empty forms in a formset

2012-04-25 Thread Tom Evans
roject.internal.forms:54] Saving PayOrderForm > > So both forms have empty_permitted == True. Management form in time of > submit looks so: > > name="form-TOTAL_FORMS"> > name="form-INITIAL_FORMS"> > > > Thanks, Martin > > On Wednesday, April 25, 2

Re: buildout development vs. deployment

2012-04-25 Thread Tom Evans
On Wed, Apr 25, 2012 at 11:21 AM, Reikje wrote: > Hi, I am looking into buildout to deploy a django webapp and all it's > dependencies. I find it quite useful even during development because it > forces you to keep track of your dependencies. A question regarding some >

Re: form doing a query for each element of foreign key in select

2012-04-25 Thread Tom Evans
On Wed, Apr 25, 2012 at 5:58 AM, Lee Hinde wrote: > I have a table with four or five foreign keys. Using the default form > widgets, a foreign key is represented by a single value select. > > I noticed, with debug_tool_bar, that a query is being made for each > element of each 

Re: Ignoring empty forms in a formset

2012-04-25 Thread Tom Evans
On Sun, Apr 22, 2012 at 5:44 PM, Martin Tiršel wrote: > Hello, > > I have a formset and some JavaScript to add more forms into this formset. In > a view, I iterate through the formset saving (not a ModelForm just Form with > save method) each form: > > for form in

Re: Where are the women?

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 3:20 PM, Marcin Tustin wrote: > My experience is that there are very few women working in shops that > primarily use open source technology. When I've encountered them, it's been > in Microsoft shops, and very large technology organisations which

Re: Multi object form

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 3:02 PM, David wrote: >  Thank you both for your replies. > > Having created a modelform and used: > > ArticleFormSet = formset_factory(ArticleForm, extra=2) > > I have a queryset that produces the objects I want to edit in my formset.

Re: Multi object form

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 2:47 PM, David wrote: > Hello > > I need to produce a form that will contain a series of rows. Each row will > be a specific object. Columns for each row will have data that will need > editting. > > ie: > > Person1  EditA  EditB  

Re: Server push ajax

2012-04-24 Thread Tom Evans
On Tue, Apr 24, 2012 at 12:14 PM, psychok7 wrote: > hi, i have to implement  a Server push with django for a school project. my > friend said that its very hard to make it work, that the software around is > still buggy and all. > > it that true? can you guide me to a easy way

Re: urls with/without implicit views import

2012-04-20 Thread Tom Evans
2012/4/20 Alexey Luchko : > Hi! > > I wonder what are pros and cons of explicit import views in urls.py. > There are at least 2 ways of defining urlpatterns. > * explicit import > from . import views > urlspatterns = patterns('', >  ('а/', views.a), > ) > > * lazy import >

Re: Bus Error: 10 (Intro Tutorial)

2012-04-20 Thread Tom Evans
On Thu, Apr 19, 2012 at 5:11 PM, Harald Sigh Andertun wrote: > I'm sorry. Actually that was not the solution. It works sometimes now, which > it didn't before. I'll attach a screenshot. > > I'm on mac (OS X Lion). > A bus error occurs due to unaligned memory access, or

Re: Missing manage.py

2012-04-18 Thread Tom Evans
On Wed, Apr 18, 2012 at 11:54 AM, Faeez Abd Rahman wrote: > Hi, > > I will try to remove and install django as you suggest, but before that I > like to look for that stub directory. Where is the location of that stub > directory? > > thanks. > I don't know the

Re: Missing manage.py

2012-04-18 Thread Tom Evans
On Wed, Apr 18, 2012 at 11:35 AM, Faeez Abd Rahman wrote: > Hi Buddy, > > Nope it's not there, I have tried to create another project, still not > there. > > mysite/ > mysite/ > __init__.py > settings.py > urls.py > wsgi.py > > > I

Re: How to release the caching of QuerySet

2012-04-18 Thread Tom Evans
On Wed, Apr 18, 2012 at 11:05 AM, Kejun He wrote: > Hi, > >   I met a problem about memory overflow on a Django project. > I spent much of time finding the reason and I got some question about how > the > django release the caching of QuerySet. > > Exp: > I build a Model

Re: ModelForm Validation Error

2012-04-18 Thread Tom Evans
On Tue, Apr 17, 2012 at 8:07 PM, coded kid wrote: > I want to make sure users fill all the fields before they are > redirected to the next page. And if they don’t fill the fields it > should raise an error telling them to fill the fields before they > proceed. So to do

Re: row level permissions - why?

2012-04-17 Thread Tom Evans
On Tue, Apr 17, 2012 at 12:42 PM, Mike wrote: > One problem I see is that if User 1 somehow obtains a url to a view that > displays an object owned by User 2.  User 1 will be able to view User 2's > object.  I'll have to write code in every view function that displays >

Re: High Traffic

2012-04-17 Thread Tom Evans
On Mon, Apr 16, 2012 at 9:49 PM, Yarden Sachs wrote: > Sure, > > I experienced unknown performance issues(slow responses) when high traffic > would hit that site. > > so, started to test what happens if i hit the web site with a big > calculation, like len function on an 9k

Re: Passing parameters to class Meta:

2012-04-16 Thread Tom Evans
On Mon, Apr 16, 2012 at 4:50 PM, Mario Gudelj wrote: > Hi Tom, > > Thanks for chiming in, mate. > > What I'm doing here is I'm getting the subdomain from the request and > matching it to the business when paypal PDT notification gets posted with > GET to my app. > > I then

Re: Problems extracting valid form data lately

2012-04-16 Thread Tom Evans
On Mon, Apr 16, 2012 at 4:39 PM, Chris Seberino wrote: >        def clean_username(self): > > """ >                custom validation > code >                """ > >                if "username" in self.cleaned_data: >                        username =

Re: Passing parameters to class Meta:

2012-04-16 Thread Tom Evans
On Mon, Apr 16, 2012 at 4:11 PM, Mario Gudelj wrote: > Hi Djangoers, > > I have an issue I can't work out. This is the situation: > > I have a model called payment, which has a custom constructor which takes a > parameter. This is the code: > > class Payment(models.Model):

Re: Passing additional variables to flatpage template

2012-04-16 Thread Tom Evans
On Sat, Apr 14, 2012 at 9:27 PM, Swaroop Shankar V wrote: > Hi All, > > Am using flatpage app in my application. I want to send > few additional variables that can be accessible from the flatpage templates. > So how can i accomplish the same? > You cannot. The only way to

Re: Form Validation and unique_together on update a model

2012-04-13 Thread Tom Evans
On Fri, Apr 13, 2012 at 1:08 PM, Massimo Barbierato wrote: > Hi all, i'm new. I searched  in the group for answers to my problem, but i > didn't find anything :( > > My problem is this: > > i have a model with two fields in unique_together, the related ModelForm and >

Re: cache decorators in urls.py error

2012-04-13 Thread Tom Evans
On Fri, Apr 13, 2012 at 1:51 PM, Phang Mulianto wrote: > Hi , > > i already try Randomly trying things is unlikely to fix anything. cache_page decorates a function. Therefore, if this doesn't work: > (r'^$',cache_page(index), { 'template_name': > 'blog/public_list.html'},

Re: [JOB] Urgent - PHP/Python Developer needed

2012-04-13 Thread Tom Evans
On Fri, Apr 13, 2012 at 1:23 PM, Mario Gudelj wrote: > Is this anywhere near a standard rate in UK? > For a junior developer outside of London, yes. For a junior developer outside of London working remotely, definitely. Cheers Tom -- You received this message because

Re: cache decorators in urls.py error

2012-04-10 Thread Tom Evans
On Sat, Apr 7, 2012 at 3:53 PM, Phang Mulianto wrote: > Hi, > > i have my apps and try to use cache decorator in url.py but got error. > > Here are the urls.py > > from django.views.decorators.cache import cache_page > > urlpatterns = patterns('article.views', >    

Re: Hosting Django website

2012-04-10 Thread Tom Evans
On Sun, Apr 8, 2012 at 2:59 PM, KasunLak wrote: > Hi all, > > I have created a website using django. I want to host it now. Can you > suggest me a best way to host it? I have noticed it is possible to > host in tomcat on top of jython, is this recommended or have any >

Re: Django 1.4: TypeError: get_db_prep_value() got an unexpected keyword argument 'connection'

2012-04-10 Thread Tom Evans
On Sun, Apr 8, 2012 at 4:25 PM, shacker wrote: > Russell's response is correct, but speaking of stale *.pyc files that > may occasionally bite you, try putting this in your bash aliases: > > alias delpyc='find . -name "*.pyc" -print0 | xargs -0 rm -rf' > > Then you safely

Re: HttpResponse_is_string is removed Django 1.4

2012-04-10 Thread Tom Evans
On Fri, Apr 6, 2012 at 3:56 PM, Ian Clelland wrote: > > > On Thu, Apr 5, 2012 at 6:07 PM, Rajat Jain wrote: >> >> Hi, >> >> I have noticed that the class variable HttpReponse._is_string (in >> django/http/__init__.py) is removed in Django 1.4. I was

Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 4:20 PM, bruno desthuilliers <bruno.desthuilli...@gmail.com> wrote: > On Apr 5, 3:11 pm, Tom Evans <tevans...@googlemail.com> wrote: >> >> OP: I have a couple of solutions. One of the first things the server >> does is import your settin

Re: List Users

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 3:00 PM, coded kid wrote: > I’m trying to iterate through user list member in tweepy. When I tried > it out, it’s not displaying any user objects! The webpage is just > blank. Below are my codes: Have you tried spamming the tweepy mailing list

Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 2:45 PM, Lars Ruoff wrote: > Thanks a lot, Tom. > That magnificantly answers my question. :-) > > One last thing: > > "... a function which loads, parses and returns > the data, and memoize the result." > > That (and the first option also) means that

Re: Where/how to load global static data?

2012-04-05 Thread Tom Evans
On Thu, Apr 5, 2012 at 1:31 PM, kenneth gonsalves wrote: > On Thu, 2012-04-05 at 05:25 -0700, Lars Ruoff wrote: >> the question is not about serving static data (like HTML, images >> etc.), but having global python variables initialized once, for all >> instances of the

Re: calculate default values for fields based on the content of other fields

2012-04-04 Thread Tom Evans
On Wed, Apr 4, 2012 at 4:51 PM, Jaroslav Dobrek wrote: >> You could override Model.save() on the model you wish to calculate >> fields for. This could populate the fields if they are not already >> populated and the instance has a base adjective. >> > > I had thought of

Re: calculate default values for fields based on the content of other fields

2012-04-04 Thread Tom Evans
On Wed, Apr 4, 2012 at 2:09 PM, Jaroslav Dobrek wrote: > Hello, > > is there a way to calculate default values for certain fields based > on the content of other fields? > > […] > > Any ideas how to realize this? > > Jaroslav Three ways immediately spring to mind. You

Re: Profiling Django (WAS Django database-api)

2012-04-04 Thread Tom Evans
On Tue, Apr 3, 2012 at 11:25 PM, Andre Terra wrote: > Hey Javier, > > Thanks for the reply. My problem with the logs in the past was that they > tended to make the task even slower (due to recursion) but I guess that's > probably because I didn't call the logging from the

Re: Django: 404 page not found

2012-04-03 Thread Tom Evans
On Tue, Apr 3, 2012 at 1:14 AM, Homer wrote: > I met "404" page not found when I try to enter 127.0.0.1:8000/cn/bedroom . > It says on the webpage that "C:/Django/final/media/bedroom" does not exist". > Why would this happen? > > urls.py: > > from django.conf.urls.defaults

Re: custom manager to control access

2012-04-03 Thread Tom Evans
On Tue, Apr 3, 2012 at 9:43 AM, Mike Dewhirst wrote: > I'm trying to make a custom manager for a few models. The objective is to > limit user access to information in the database belonging to the company of > which they are a member. > > I think I want to say: > > class

Re: int() argument must be a string or a number, not 'Model in Form Submit

2012-04-02 Thread Tom Evans
2012/4/2 Daniel França > > Hello there, > I'm trying to create an instance for a model after fill a form, but then I > got this error message when I click in submit: > > int() argument must be a string or a number, not 'Job' > > I've tried to debug this, the instance

Re: Mapping SSL certificates to django users

2012-04-02 Thread Tom Evans
On Mon, Apr 2, 2012 at 2:03 PM, Tomas Kouba wrote: > Hello, > > how can I map a DN (or any other part of X509 certificate) to a django user? > > I have found a documentation article about django middleware using > REMOTE_USER > transferred from apache, but I am not sure if this is

Re: django-admin change form page validation

2012-04-02 Thread Tom Evans
On Sat, Mar 31, 2012 at 4:55 AM, Nikhil Verma wrote: > Hi All > > How can i apply validation in admin on various fields when they are > dependent on each other ? > There is good advice laid out in the docs for when you need to clean and validate fields that depend on

Re: URL encoding, templates and apps: are apps not portlets?

2012-04-02 Thread Tom Evans
On Sun, Apr 1, 2012 at 9:20 PM, Alexandros Karypidis wrote: > Hi, > > My fondness of Python (while scripting things for work) grew to the point > where I decided to try web development with it. Having (apparently) nothing > better to do on a Sunday afternoon, I went through the

Re: Template file not recognized for some strange reason

2012-03-30 Thread Tom Evans
2012/3/30 Juan Pablo Martínez : > Try > TEMPLATE_DIRS = ("C:/Users/Documents/Music\ App/redlab/ > templates",) > Unlikely to work on OS X. Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Doing something silly, I'm sure

2012-03-30 Thread Tom Evans
On Fri, Mar 30, 2012 at 1:11 PM, vanderkerkoff wrote: > Sorry everyone, but this is driving me crazy > > https://docs.djangoproject.com/en/1.2/topics/auth/ FYI to others, the stacktrace indicates OP is using 1.3 beta 1. > > urls.py > (r'^accounts/login/$',

Re: comparing custom template tag within if tag

2012-03-30 Thread Tom Evans
On Thu, Mar 29, 2012 at 5:42 PM, Nikhil Verma wrote: > Hi All > > I am still not able to solve this problem .Any more suggestions ? > > Thanks > Because there is no solution. You must rewrite the custom tag to set a variable in the context, which you can then test in

Re: comparing custom template tag within if tag

2012-03-29 Thread Tom Evans
On Thu, Mar 29, 2012 at 5:22 PM, Josh Cartmell wrote: > I think something like this would work: > {% with price_for_pax service pax '' as pfp %} It won't. The {% with %} tag cannot arbitrarily call custom tags. Cheers Tom -- You received this message because you are

Re: Can I POST edit form to detail view, and redirect back if invalid?

2012-03-29 Thread Tom Evans
On Thu, Mar 29, 2012 at 12:49 PM, Hemebond wrote: > I don't see anything on there that deals with transferring an > redirecting with POST data. Is there a particular section that covers > this? > > To be honest, I'm not sure if HTTP really supports what I'm trying to > do, let

Re: How Admin can be able to configure Model fields

2012-03-29 Thread Tom Evans
On Thu, Mar 29, 2012 at 2:24 PM, Deepak RK wrote: > Ok , I will follow these guidelines , > Thanks > > I am a newbie in django. > Again I want to come on question : > I did some investigation around  Django admin inbuilt  functionality > for my requirement but I have not found

Re: comparing custom template tag within if tag

2012-03-29 Thread Tom Evans
On Wed, Mar 28, 2012 at 4:59 PM, Nikhil Verma wrote: > Hi all > > i have a custom template tag that takes some argument and calculates the > result. > I want to compare that value obtained from that custom tag with another > variable. > > Custom template tag > {%

Re: Tweepy Not Displaying

2012-03-29 Thread Tom Evans
On Wed, Mar 28, 2012 at 11:56 PM, coded kid wrote: > Hi guys, I want to display user’s timeline in my django app but it’s > not working. It only display a white blank page! I’m using Tweepy. > Below are my codes: > > Views.py > > import tweepy > > def tweetstream(request):

Re: locale UTF-8 error

2012-03-27 Thread Tom Evans
On Tue, Mar 27, 2012 at 5:51 PM, HMA wrote: > I am following the tutorial part 2 and when creating a superuser once the > login prompt is showing (after executed python manage.py run server ).  I am > using python 2.7.2 for Mac OS 10.7.3, Django 1.4 and I get the following >

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 3:45 PM, darwin_tech wrote: > Thanks for the reply. > > I guess not directly related to Django, though this virtualenv is very much > for the purpose of a Django project and I hoped other Django users had come > across this particular problem. > >

Re: Pip install matplotlib error with virtualenv

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 3:06 PM, darwin_tech wrote: > I am trying to install matplotlib in a new virtualenv. > > When I do: > > pip install matplotlib > > or > > pip install >

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 12:11 PM, Brett Parker wrote: > *if* they wanted all the photos, then spidering the site isn't exactly > difficult, see wget -m. You assume that all the content is indexed on the website. Consider a press release model; you may have a

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 12:00 PM, Brett Parker wrote: > On 23 Mar 04:38, Bastien wrote: >> Sorry maybe my post was not very clear, I am talking about public content >> here, that should be accessed by anyone, even anonymous users not logged in. >> For instance if we

Re: Is it secure to have IDs show up in URLs?

2012-03-23 Thread Tom Evans
On Fri, Mar 23, 2012 at 11:38 AM, Bastien wrote: > Sorry maybe my post was not very clear, I am talking about public content > here, that should be accessed by anyone, even anonymous users not logged in. > For instance if we talk about photos, publicly available, the

Re: Using “Schemas” with MySQL

2012-03-22 Thread Tom Evans
On Thu, Mar 22, 2012 at 1:29 PM, Peter of the Norse wrote: > In our legacy system at work, we're using different different databases on > the same sever at the same time. It looks like ”Select * From client_a.user > Inner Join common.table On…”. I know that ticket 6148 

Re: Accessing MEDIA_ROOT in templates, always blank/missing

2012-03-22 Thread Tom Evans
On Thu, Mar 22, 2012 at 12:25 PM, Stodge wrote: > No I need MEDIA_ROOT, I want to experiment with: > > > > Thanks > MEDIA_ROOT is a file-system location, not a URL-space location, and should not be exposed in templates. It is nonsense to use media root as a prefix to the

Re: Caching and model import question

2012-03-21 Thread Tom Evans
On Wed, Mar 21, 2012 at 4:19 PM, Jeff Heard wrote: > Question 1: Would this work with views, or for that matter, anything > else in Django, assuming you're using a WSGI server like gunicorn? > http://code.activestate.com/recipes/578078/  Specifically, will it > cache

Re: using forloop.counter to access data

2012-03-21 Thread Tom Evans
On Wed, Mar 21, 2012 at 2:58 PM, Larry Martell wrote: > OK, but is there some reason {{ headers.0.forloop.counter } does not > work when forloop.counter has a value of 2, yet {{ headers.0.2 }} > does work? Django never does variable interpolation when resolving dot

Re: using forloop.counter to access data

2012-03-21 Thread Tom Evans
On Wed, Mar 21, 2012 at 12:47 PM, Larry Martell wrote: > This is probably a stupid newbie question > > I want to access a column of data in a row using forloop.counter, but > I cannot get it to work. > > In my test code, if I display {{ forloop.counter }} I get 2 >

Re: database router raises TypeError: expecting router class instance as first argument

2012-03-21 Thread Tom Evans
On Wed, Mar 21, 2012 at 2:55 AM, Chris Ghormley wrote: > I'm having trouble with database routers in a Django 1.3.1 project. > I'm by no means a Django or Python expert, but I've been using Django > for a few years now. When I enable any kind of router in my project, >

Re: This field is required error if enctype="multipart/form-data" is not set

2012-03-21 Thread Tom Evans
On Tue, Mar 20, 2012 at 8:24 PM, Sachin Gupta wrote: > In a file upload form if the enctype attribute is not set then, django > throws the error > > This field is required > > In case null=True and blank = True is set for the file field then nothing > happens at all.

Re: Question about threading a view[REPOSTED]

2012-03-20 Thread Tom Evans
On Tue, Mar 20, 2012 at 2:52 PM, Arruda wrote: > Thanks every one, I've manage to work this around. > The solution might not be the best, but it's working: > In the view I call the do_something_slow() in a new thread, and in the end > of it(after the role process

Re: Ajax/jquery .load() unresponsive via django html templating, or FF/chrome

2012-03-20 Thread Tom Evans
On Mon, Mar 19, 2012 at 6:52 AM, Eli_West wrote: > 2 potential issues I've been trying solve: > > 1) Django csrf or other mechanism is blocking ajax and jquery .load() > > […] Are you following the advice laid out in the Django manual on AJAX And CSRF? Cheers Tom -- You

Re: Problem with tuncated Admin pages in apache + mod_fcgid

2012-03-20 Thread Tom Evans
On Mon, Mar 19, 2012 at 5:24 PM, Jani Tiainen wrote: > Hi, > > Since we use same setup except one part: we use mod_wsgi instead of > mod_fcgi. > > (Since wsgi is considered to be defacto protocol). Could you try to use it? > WSGI is the de-facto for hosting python in web

Re: get().delete() does not work, filter().delete() works?

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 6:33 PM, Rainy wrote: > Hi, I have a function that accepts a pk and deletes an object: > > Item.objects.filter(pk=pk).delete() > > If I change it to: > > Item.objects.get(pk=pk).delete() > > it no longer works, without any errors. I tried it using

Re: Djano if statement help

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 1:01 PM, HarryBoy wrote: >> Hi, thanks for the reply. > > > I printed the value and its actually 0 every time. > > Why is it 0 when I set it to EnableLogUpload == "Enabled"?? > > Thanks > '==' tests equality '=' assigns a rvalue Cheers Tom -- You

<    3   4   5   6   7   8   9   10   11   12   >