Re: Sample Auto Log Out Code

2010-11-04 Thread derek
Fred This seems not related to the original topic; please start a new thread. On Nov 3, 2:56 pm, "Sells, Fred" wrote: > I'm running on Windows 7, Python 2.4 and Django 1.2.1 > > I'm trying to change one table "facility" by dropping it and then > letting syncdb recreate it.  I thought syncdb was

Re: access an app on another server

2010-11-04 Thread Russell Keith-Magee
On Fri, Nov 5, 2010 at 6:28 AM, Cindy Moore wrote: > Hi, all.  I'm trying to figure out how to do this.  I have two django > projects, on different servers (though I have control over each). > > On one of the projects (call this the primary project), I would like > to *read* the info from the othe

Re: enable admin gives error

2010-11-04 Thread Russell Keith-Magee
On Fri, Nov 5, 2010 at 11:59 AM, jt wrote: > Hi, > I'm just starting out.  Things ran fine until I uncomment out: > (r'^admin/', include(admin.site.urls)) > in my urls.py file.  When I access my local site from the development > server. I get: > * Exception Type: TypeError > * Exception Value: 'tu

enable admin gives error

2010-11-04 Thread jt
Hi, I'm just starting out. Things ran fine until I uncomment out: (r'^admin/', include(admin.site.urls)) in my urls.py file. When I access my local site from the development server. I get: * Exception Type: TypeError * Exception Value: 'tuple' object is not callable. My urls.py file contains: fro

access an app on another server

2010-11-04 Thread Cindy Moore
Hi, all. I'm trying to figure out how to do this. I have two django projects, on different servers (though I have control over each). On one of the projects (call this the primary project), I would like to *read* the info from the other (secondary) project. No need to modify the secondary proje

Re: Django Environment Settings

2010-11-04 Thread Kenneth Gonsalves
On Thu, 2010-11-04 at 06:18 -0700, octopusgrabbus wrote: > What is the best way to set the Django command line environment for > testing in the python interpreter? 'python manage.py shell' -- regards Kenneth Gonsalves Senior Associate NRC-FOSS at AU-KBC -- You received this message because you

Re: How to aggregate values by month

2010-11-04 Thread David Zhou
FWIW, on Postgres DBs, I've done the following: qs = FooModel.objects.filter(date__gte=start_date, date__lt=end_date).extra(select={'datetrunc': "date_trunc('month', date)"}).values('datetrunc').annotate(total=Sum("value")) date_trunc in postgres also accepts "day" and "week" truncations. -- dz

Re: How to aggregate values by month

2010-11-04 Thread Mikhail Korobov
Hi Rogério! With django-qsstats-magic it would be something like this: stats = QuerySetStats(Sale.objects.all(), 'date_created') totals = stats.time_series(start, end, 'months', aggregate=Sum('total_value')) averages = stats.time_series(start, end, 'months', aggregate=Avg('total_value')) Great y

Re: Why Won't Form Elements Display?

2010-11-04 Thread Daniel Roseman
On Nov 4, 10:32 pm, octopusgrabbus wrote: > I have a forms class in forms.py > > from django import forms > > class ReadSnapForm(forms.Form): >     cycle = forms.CharField(max_length=1) >     message = forms.CharField(widget-forms.Textarea,required=False) > > Here is the form that uses the class >

Why Won't Form Elements Display?

2010-11-04 Thread octopusgrabbus
I have a forms class in forms.py from django import forms class ReadSnapForm(forms.Form): cycle = forms.CharField(max_length=1) message = forms.CharField(widget-forms.Textarea,required=False) Here is the form that uses the class {% extends "base.html" %} Enter Billing Cycle

Re: How create a simple "brochure" website in django?

2010-11-04 Thread Toby Champion
Karim, Unless you have to be using Django and/or Python I'd suggesting considering http://www.silverstripe.org/ for your site. Toby -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.

How do I associate a mime_type with a file?

2010-11-04 Thread Margie Roginski
Hi, I have an Attachment model that has a mime_type field. Here's my basic model: class Attachment(models.Model): id = models.AutoField(primary_key=True) comment=models.ForeignKey(Comment, null=True) file = models.FileField('File', upload_to=get_attachments_path) filename = models

Re: 2D map application: performance and design question

2010-11-04 Thread Lars Ruoff
Excellent advice! With this I'm down to less than 0.02 secs for the 13x13 map rendering! Regards, Lars On Nov 2, 9:45 pm, Knut Ivar Nesheim wrote: > I would suggest rewriting the loop in your template as a templatetag. > Something like this > > @register.simple_tag > def render_locations(locati

Multi-table Inheritance: How to add child to parent model?

2010-11-04 Thread ringemup
I have an existing model that I want to extend using multi-table inheritance. I need to create a child instance for each parent instance in the database, but I can't figure out how. I've scoured google and haven't come up with anything other than Ticket #7623[1]. Here are some of the things I've

Multiple classes in tasks.py?

2010-11-04 Thread wawa wawawa
Hi All, I'm sure this is a very stupid question. But, here we go. I am using celery / rabbitmq. It's all working great. Until I try to move more of my code into my asynchronous tasks to be handled by celery. I think my problem is because my classes are subclasses of Task... It's confusing me (no

Re: django-cms error: no module named simplesite.urls

2010-11-04 Thread Karim Gorjux
On Thu, Nov 4, 2010 at 19:35, Karim Gorjux wrote: > Hi all, I'm just taking a look to the django-cms. I followed all the > instruction, but when I try to connect to the site I get this error my mistake. Was the settings.py wrong! :-| -- K. Blog Personale: http://www.karimblog.net -- You recei

Re: How to aggregate values by month

2010-11-04 Thread Rogério Carrasqueira
Hello Folks! I've got the solution, putting here for future searchs: sales = Sale.objects.extra(select={'month':'month(date_created)','year':'year(date_created)'}).values('year','month').annotate(total_month=Sum('total_value'), average_month=Avg('total_value')) This query works only using MySQL,

Re: Django Environment Settings

2010-11-04 Thread Mathias Kretschek
If you want to run doctests or testcases you may be looking for: from django.test.utils import setup_test_environment setup_test_environment() http://docs.djangoproject.com/en/1.2/topics/testing/#running-tests-outside-the-test-runner Mathias On Nov 4, 11:18 am, octopusgrabbus wrote: > What is

Re: Caught in CSRF verification failed. Catch 22

2010-11-04 Thread Tom Evans
On Thu, Nov 4, 2010 at 5:31 PM, octopusgrabbus wrote: > Thanks. > I did both what you said (modified form to have csrf tag) > >  {% csrf_token %} > > and made sure the csrf includes were correct. I was missing one. > > MIDDLEWARE_CLASSES = ( >    'django.middleware.common.CommonMiddleware', >    '

Re: Update itens using Dajax

2010-11-04 Thread Mathias Kretschek
Hi. I'm not familiar with Dajax, but I think your response could include the required HTML markup and you would just append it to the list of items. Doing so you will always use the same template snippet you've used for the initial set of items (makes it easier to maintain, since you don't need to

django-cms error: no module named simplesite.urls

2010-11-04 Thread Karim Gorjux
Hi all, I'm just taking a look to the django-cms. I followed all the instruction, but when I try to connect to the site I get this error - log - File "/home/karim/Projects/e_dcms/lib/python2.6/site-packages/django/core/ser

Re: Caught in CSRF verification failed. Catch 22

2010-11-04 Thread octopusgrabbus
Thanks. I did both what you said (modified form to have csrf tag) {% csrf_token %} and made sure the csrf includes were correct. I was missing one. MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.mid

Re: How create a simple "brochure" website in django?

2010-11-04 Thread Karim Gorjux
Now I'm trying django-cms, but I would like to find some really essential to study on. -- K. Blog Personale: http://www.karimblog.net -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroup

Re: How create a simple "brochure" website in django?

2010-11-04 Thread Karim Gorjux
On Thu, Nov 4, 2010 at 18:26, James wrote: > Yes, there is. > > You should take a look at "Practical Django Projects" (be sure to get > the 2nd edition)  by James Bennett. In the book he creates a > simple-cms with a tinymce editor. > > He has the source code published here: > http://bitbucket.org

Re: How create a simple "brochure" website in django?

2010-11-04 Thread James
On Thu, Nov 4, 2010 at 10:37 AM, Karim Gorjux wrote: > On Thu, Nov 4, 2010 at 15:06, bruno desthuilliers > wrote: >> You may not realize that what you're describing here is a full blown >> CMS, and as such is a tad more complex than simple thing like a blog >> or wiki or dumbed-down twitter clone

Django apps and models

2010-11-04 Thread andy
Hi guys, Say I have a CUSTOMER, BRANCH and a SALES table for my project design. Question, should is it wise to create a customer, branch and sales app. I like this idea of doing this but I have a few issues. 1. If I create a customer app and create a Customer model class that has a ForeignKey re

Re: Reverse Query Name Clash?

2010-11-04 Thread r_f_d
This is actually pretty well documented in the django docs. I suggest you look there for a complete explanation, but briefly: with your model definition, the way you would access a minister's church would be: person_object.church and the way you would access the church a person attends would also

Re: How create a simple "brochure" website in django?

2010-11-04 Thread Karim Gorjux
On Thu, Nov 4, 2010 at 15:06, bruno desthuilliers wrote: > You may not realize that what you're describing here is a full blown > CMS, and as such is a tad more complex than simple thing like a blog > or wiki or dumbed-down twitter clone. I strongly suggest you try some > existing CMS like django-

Re: feature request - suppression of newlines from tags

2010-11-04 Thread Russell Keith-Magee
On Thu, Nov 4, 2010 at 10:46 PM, Michael P. Soulier wrote: > Hi, > > I'm templating some javascript which is at times rather picky in parsing > depending on one's browser. It would be nice in some cases to suppress the > newline caused by the insertion of a template tag, like in jsp and erb. > Per

Re: feature request - suppression of newlines from tags

2010-11-04 Thread Tom Evans
On Thu, Nov 4, 2010 at 2:46 PM, Michael P. Soulier wrote: > Hi, > > I'm templating some javascript which is at times rather picky in parsing > depending on one's browser. It would be nice in some cases to suppress the > newline caused by the insertion of a template tag, like in jsp and erb. > Perh

feature request - suppression of newlines from tags

2010-11-04 Thread Michael P. Soulier
Hi, I'm templating some javascript which is at times rather picky in parsing depending on one's browser. It would be nice in some cases to suppress the newline caused by the insertion of a template tag, like in jsp and erb. Perhaps something like {% if foo %} newline present {%- if foo %} newlin

Re: Caught in CSRF verification failed. Catch 22

2010-11-04 Thread Russell Keith-Magee
On Thu, Nov 4, 2010 at 10:32 PM, octopusgrabbus wrote: > I have a simple form: > > {% extends "base.html" %} > {% block title %}Take Snapshot of Billing Reads{% endblock %} > {% block head %}Take Snapshot of Billing Read{% endblock %} > > {% block content %} >    {% if user.username %} >         >

Caught in CSRF verification failed. Catch 22

2010-11-04 Thread octopusgrabbus
I have a simple form: {% extends "base.html" %} {% block title %}Take Snapshot of Billing Reads{% endblock %} {% block head %}Take Snapshot of Billing Read{% endblock %} {% block content %} {% if user.username %} {{ form.as_p }} Section Number:

Re: How create a simple "brochure" website in django?

2010-11-04 Thread bruno desthuilliers
On 4 nov, 14:52, meitham wrote: > > existing CMS like django-cms or LFC > > Has anyone tried LFC? it seems like its a djangoy version of plone. > I am interested to hear any reviews about it. Looks very plone-ish indeed - hoping it's only keeping the right features from Plone -, not tried it so

Re: How create a simple "brochure" website in django?

2010-11-04 Thread Thomas Rega
another example for a django based CMS: http://www.feinheit.ch/labs/feincms-django-cms/ good luck, TR 2010/11/4 bruno desthuilliers : > On 4 nov, 13:15, Karim Gorjux wrote: >> Hi all! I'm a relative newbie in Django and I spending a lot of time >> study it in these days. I read many tutorials

Annotate, Sum and ForeignKey

2010-11-04 Thread Сергей Бачурин
I have 2 models connected with ForeignKey. For example: class pidpr(models.Model): pidpr = models.TextField() suma_oplat = models.DecimalField(max_digits=10, decimal_places=3) class obj(models.Model): product = models.TextField() pidpr = models.ForeignKey("pidpr", related_name="ob

Re: How create a simple "brochure" website in django?

2010-11-04 Thread meitham
> existing CMS like django-cms or LFC Has anyone tried LFC? it seems like its a djangoy version of plone. I am interested to hear any reviews about it. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-u

Re: Django Environment Settings

2010-11-04 Thread Daniel Roseman
On Nov 4, 1:18 pm, octopusgrabbus wrote: > What is the best way to set the Django command line environment for > testing in the python interpreter? ./manage.py shell -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: csrf_token not enclosed in hidden element

2010-11-04 Thread Erik Cederstrand
Ah, I see. Thanks! Erik Den 04/11/2010 kl. 11.17 skrev Menno Luiten: > That's because you have to use {% csrf_token %} instead of {{ ... }} in your > template code. Confusing, perhaps, but have encountered it several times > myself. > > Regards, > Menno > > On 11/04/2010 11:10 AM, Erik Ceder

Django Environment Settings

2010-11-04 Thread octopusgrabbus
What is the best way to set the Django command line environment for testing in the python interpreter? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this g

Re: How to get hold of a (database) connection from within a thread

2010-11-04 Thread Joseph Wayodi
On Thu, Nov 4, 2010 at 3:12 PM, Jirka Vejrazka wrote: > > How can I get hold of the connection used to create the object, from > within > > each thread, so that each thread closes the connection that it has just > > used? Alternatively, how can I get a list of all the open connections > that > > D

Re: How create a simple "brochure" website in django?

2010-11-04 Thread bruno desthuilliers
On 4 nov, 13:15, Karim Gorjux wrote: > Hi all! I'm a relative newbie in Django and I spending a lot of time > study it in these days. I read many tutorials and books and I'm > surprised to found very interesting resource to how create a wiki, a > blog, app like twitter even a social bookmarking we

Update itens using Dajax

2010-11-04 Thread Daniel França
Hi, I'm trying to create a twitter-like effect on my page to show more items when necessary ("More items" button) Like when in the twitter you click to see more tweets (the old twitter page) I'm trying to create this effect using Dajax, the best solution I thought was that: I do load the page with

Re: SERIALIZING

2010-11-04 Thread Jani Tiainen
Hi, Using capitals nor crossposting doesn't get you far. You need to do your homework [1]. Can you tell what you have tried and how to resolve your problem? Hint: This all is documented in Django documentation. If you have some more specific problems applying techniques described in documenta

Re: How to aggregate values by month

2010-11-04 Thread Rogério Carrasqueira
Hi Sebastien! Thanks for you reply. I'm a newbie on Django and I must confess unfortunately I don't know everything yet ;-). So I saw that you made a snippet regarding about the use of Django Cube. So, where do I put this snippet: at my views.py? Or should I do another class at my models.py? Than

How create a simple "brochure" website in django?

2010-11-04 Thread Karim Gorjux
Hi all! I'm a relative newbie in Django and I spending a lot of time study it in these days. I read many tutorials and books and I'm surprised to found very interesting resource to how create a wiki, a blog, app like twitter even a social bookmarking website but I never found a simple tutorial to e

Re: How to get hold of a (database) connection from within a thread

2010-11-04 Thread Jirka Vejrazka
> How can I get hold of the connection used to create the object, from within > each thread, so that each thread closes the connection that it has just > used? Alternatively, how can I get a list of all the open connections that > Django is using at any one time. I am using the "standard" model que

How to get hold of a (database) connection from within a thread

2010-11-04 Thread Joseph Wayodi
Hi people, I am running some Django code that creates objects in the database. I am using PostgreSQL via psycopg2. However, I am running this code from the Django shell, and not as part of a request. I therefore have to handle a few things manually, for example, closing connections to the database

Re: csrf_token not enclosed in hidden element

2010-11-04 Thread Menno Luiten
That's because you have to use {% csrf_token %} instead of {{ ... }} in your template code. Confusing, perhaps, but have encountered it several times myself. Regards, Menno On 11/04/2010 11:10 AM, Erik Cederstrand wrote: Hi, I have a view that creates a login page. I use the @csrf_protect de

Re: Forking a background process on request

2010-11-04 Thread Brian Bouterse
I would look into django-celery to do asynchronous tasks. It can also be executed as a webhooks style, see here . Brian On Thu, Nov 4, 2010 at 3:31 AM, Elver Loho wrote: > Hi, > > I am working on a

Re: BrightonPy event: The Why and How of Automated Testing with Python and Django

2010-11-04 Thread Jim Purbrick
The video and slides for this talk are now online here: http://jimpurbrick.com/2010/11/04/why-and-how-automated-testing-python-and-django/ Cheers, Jim -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-

csrf_token not enclosed in hidden element

2010-11-04 Thread Erik Cederstrand
Hi, I have a view that creates a login page. I use the @csrf_protect decorator on my view and {{csrf_token}} tag in the template, and the generated response contains the csrf token. The problem is that the token is printed as-is instead of being enclosed i a hidden element, as I understand it's

Re: Why my model doesn't get saved?

2010-11-04 Thread Marc Aymerich
2010/11/4 Łukasz Rekucki > > On 3 November 2010 22:17, Marc Aymerich wrote: > > Hi, > > I have 2 abstract classes with an overrided save function, class BaseA and > > class BaseB. BaseA trigger the models.Model save function, the other > > doesn't. > > class BaseA(models.Model): > >     class Met

Re: Why my model doesn't get saved?

2010-11-04 Thread Marc Aymerich
On Wed, Nov 3, 2010 at 11:50 PM, Michael wrote: > nevermind my previous email, I see now you are talking about the test1 > class, which isn't abstract. > > In that case I assume the problem is Python's multiple inheritance, > where the first parent it finds with a save() method gets called, and no

Freelance Django dude wanted in London

2010-11-04 Thread adamalton
Greetings Djangoers, The company I'm working for are currently looking for a Django ninja to come and, well, write some code. The position would be freelance, based in Victoria, London, UK. We have some great clients, and an infinite supply of biscuits. If you think you might be interested then

Re: Problem displaying images using a development server

2010-11-04 Thread Abhas
I just resolved the issue. the line MEDIA_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)),'multimedia') was the problem and pointing to the wrong path. so the photos were stored in "/home/.../cs142/multimedia/photos/xyz.jpg" but due to the MEDIA_ROOT problem it pointed to "/home/...

Re: Forking a background process on request

2010-11-04 Thread Kenneth Gonsalves
On Thu, 2010-11-04 at 00:31 -0700, Elver Loho wrote: > My question is - what is the best way of forking a separate process in > step 2 to start the actual background report generation while also > returning an "ok" message to the calling Javascript? Or do I even need > a separate process? What sort

Forking a background process on request

2010-11-04 Thread Elver Loho
Hi, I am working on a web app that creates reports that may take up to a minute to generate. (Or longer under heavy loads.) Ideally I would like something like this to happen: 1. User presses a button on the website. Javascript sends a begin- report-creation message to the server. 2. Report creat

Extending UserManager and PAM-based authentication

2010-11-04 Thread Bryan Bishop
Hey all, I am trying to implement PAM-based authentication in django. I am using the dpam (django-pam) module which provides an entry for AUTHENTICATION_BACKENDS in settings.py, but I don't have to be using this. Anyway, I would like to fix django.contrib.auth.models.User so that create_user & fri

Problem displaying images using a development server

2010-11-04 Thread Abhas
Hi everyone, I am having trouble displaying images stored on my laptop using Django templates.To highlight the problem I am using a view called test which renders a template called test.html. code for them is as follows: def test(request): return render_to_response('test.html',context_instance=R