Re: Unsafe to continue Django session unencrypted? (i.e. login with HTTPS then drop to HTTP after that?)

2011-06-14 Thread Chris Seberino
On Jun 14, 10:47 am, Tom Evans wrote: > Yes, of course it is - HTTP is stateless, so how else would sessions > work if the session id is not transmitted back to the server by the > browser? I agree. Yet, eBay, Google Groups & Godaddy drop down to HTTP after login. Why

Moving Away from if/else Template Logic

2011-06-14 Thread Greg Corradini
Hello All, I'm try to get away from doing if/else in a template: {% if x.message|regtest == "True" %} do something cool {% else %} do something less cool {% endif %} given this template filter: @register.filter(name='regtest') def regtest(value): regex =

Re: How to catch and log exceptions?

2011-06-14 Thread Roy Smith
Exactly what I was looking for. Thanks! -- 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 unsubscribe from this group, send email to

import with django-batchimport and only insert if record doesn't exist else update based on foreignkey reference.

2011-06-14 Thread mongoose
I'm trying to run an import and in my identity fields I'm referencing a foreignkey field. The excel file holds the name of the brand and this field seems to be ignored when the import happens. My theory was that perhaps it's because it's not mapped and in fact it's probably matching the brand_name

Re: storing django object into javascript array

2011-06-14 Thread jay K.
Hello, I was given the following solution for storing a django object in a javascript variable //SOLUTION BEGINS HERE 1. Use a loop in the template: var map_schools = [{% for school in city.school_set.all %}"{{ school|escapejs }}"{% if not forloop.last %},{% endif %}{% endfor %}]; You'll

Re: Authentication in API (REST)

2011-06-14 Thread Malcolm Box
I think oauth solves this problem well. What do you see wrong with it? Malcolm Sent from my iPhone, please excuse any typos On 14 Jun 2011, at 16:35, Stuart MacKay wrote: > Neznez, > > The authentication problem is one that has never really been solved to any

Re: __unicode__() addition not working in basic poll application.

2011-06-14 Thread Micky Hulse
On Tue, Jun 14, 2011 at 11:01 AM, Kyle Latham wrote: Poll.objects.all() > [] What do you get when you try: >>> p = Poll.objects.all()[0] >>> p >>> type(p) >>> dir(p) Try this too: >>> p = Poll.objects.all() >>> for x in p: . . .print x (indent this line four

Re: __unicode__() addition not working in basic poll application.

2011-06-14 Thread Kyle Latham
Hello, I am having the same problem while working through the tutorial. have searched these forums and tried everything that was recommended. My spacing is good also - I checked that. I am still getting the same output: >>> Poll.objects.all() [] Any ideas on how to fix my issue? On Jun 5,

Re: Problem in accepting values from a form in a template . How to debug this ?

2011-06-14 Thread vikalp sahni
Page Not Found or 404, basically doesn't have any relation with template of form. Just check if you have the URL that you are trying to hit in urls.py, as 404 happens when the URL you are trying to access is not configured or not available on your webapp. Regards //Vikalp On Tue, Jun 14, 2011

How to make databrowseadmin of django show all the objects of shape file and not one by one ?

2011-06-14 Thread Satyajit Sarangi
After I upload a shapefile , the databrowse admin allows to view the files in databrowse admin , but does not all the objects to be shown on one file , i.e it allows only one row of a table mapped onto a openlayers file . How to make all the data , (all the rows ) be displayed on one openlayers

Re: Test runner fails with Django 1.2.1 and psycopg2 2.4.2

2011-06-14 Thread Andrew Brookins
Looks like there's already a ticket (my search-fu failed me): https://code.djangoproject.com/ticket/16250 Andrew -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Test runner fails with Django 1.2.1 and psycopg2 2.4.2

2011-06-14 Thread Andrew Brookins
Hey, Yesterday I started seeing test runner failures with Django 1.2.1 and psycog2 2.4.2. Here's the traceback (where [project_dir] is the path to my virtualenv): Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File

Re: Integrity Error with generic relation using ContentType

2011-06-14 Thread Amit Sethi
On Tue, Jun 14, 2011 at 8:00 PM, christian.posta wrote: > Yes, it is. Any reason why you want the content-types to be part of > your fixtures? Why not let django build that up by itself? > Well essentially it was just a dumpdata from earlier that is being used. But why

Re: How to create a single data view from multiple data sources

2011-06-14 Thread Shawn Milochik
On 06/14/2011 12:20 PM, rohan wrote: Can you please be a bit more specific? The link you provided is for Django tutorials. It would be great if you could guide me to the specific page. Try searching Google. You'll probably get the answer faster. If you can ask a more specific question about

Re: Django admin report

2011-06-14 Thread Andre Terra
If all you need translating is README.rst, here goes: Django Admin Report Django Admin Report is a small django application that allows for easy exporting of PDF reports through the admin interface. Dependencies -Pisa (http://www.xhtml2pdf.com/) Installation 1. Download the application

Re: How to create a single data view from multiple data sources

2011-06-14 Thread rohan
Can you please be a bit more specific? The link you provided is for Django tutorials. It would be great if you could guide me to the specific page. On Jun 14, 10:16 am, Shawn Milochik wrote: > On 06/14/2011 10:42 AM, rohan wrote: > > > I have two tables in my database with

Re: Unsafe to continue Django session unencrypted? (i.e. login with HTTPS then drop to HTTP after that?)

2011-06-14 Thread Tom Evans
On Tue, Jun 14, 2011 at 4:39 PM, Chris Seberino wrote: > I have Apache in front of my Django app.  It forces login pages to use > HTTPS but then forces rest of pages to only use HTTP. > > Is client browser sending sensitive login or session info in the clear > when I am not

Unsafe to continue Django session unencrypted? (i.e. login with HTTPS then drop to HTTP after that?)

2011-06-14 Thread Chris Seberino
I have Apache in front of my Django app. It forces login pages to use HTTPS but then forces rest of pages to only use HTTP. Is client browser sending sensitive login or session info in the clear when I am not using HTTPS? My nonencrypted pages don't present or ask for sensitive info. The only

Re: Authentication in API (REST)

2011-06-14 Thread Stuart MacKay
Neznez, The authentication problem is one that has never really been solved to any general level of satisfaction for REST APIs, since the connection should be stateless. For HTTP authentication there is either HTTPS + Basic or Digest. HTTPS + Basic considered to be the easiest to implement

Re: How to catch and log exceptions?

2011-06-14 Thread Shawn Milochik
Yes, you can access the traceback from the middleware. Just call logger.exception() instead of something like logger.debug() and you'll get the output in your log. Here's my middleware: import logging logger = logging.getLogger(__name__) class RequestExceptionMiddleware(object): """

How to catch and log exceptions?

2011-06-14 Thread Roy Smith
I want to catch any exceptions thrown in my views (or anywhere else, I suppose) and log a full stack trace. I know I can write middleware which implements process_exception(), but that just gets me the naked exception object, not a full stack dump. I'm assuming that by the time my

Re: 2 projects based on the same codebase

2011-06-14 Thread Stuart MacKay
Benedict, One solution I tried was project franchising, http://www.huyng.com/archives/franchising-running-multiple-sites-from-one-django-codebase-2/394/ The idea was to have a core site that was customized for different deployments. The idea had a lot of appeal but I quickly ran into issues

Re: How to create a single data view from multiple data sources

2011-06-14 Thread Shawn Milochik
On 06/14/2011 10:42 AM, rohan wrote: I have two tables in my database with one common field. Is it possible to write a web app to create views using django? Any help would be greatly appreciated. Thank you Yes, it is. Do the tutorial and then re-do it using your own data.

Re: Userprofile, signal and admin inline edit.

2011-06-14 Thread Jon Biddle
The issue seems to come from the fact that the order of operations when you create the user looks like this: 1) Django admin saves the new User 2) post_save on User is triggered, and User's profile is created 3) Django admin saves the UserProfile... but it already exists, and an integrity error

How to create a single data view from multiple data sources

2011-06-14 Thread rohan
I have two tables in my database with one common field. Is it possible to write a web app to create views using django? Any help would be greatly appreciated. Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Integrity Error with generic relation using ContentType

2011-06-14 Thread christian.posta
Yes, it is. Any reason why you want the content-types to be part of your fixtures? Why not let django build that up by itself? On Jun 14, 1:21 am, Amit Sethi wrote: > On Tue, Jun 14, 2011 at 1:41 AM, christian.posta > wrote: > > Are you

Re: Get MAC from diferent fields

2011-06-14 Thread Jirka Vejrazka
Hi there, Django is just a Python package. Forget for a moment that you use Django for database connection and solve your "how do I recognize a MAC address?" problem just as you'd solve it in pure Python. There is nothing wrong with the MAC addresses in your example - why do you say these are in

Re: GET vs POST for read-only views

2011-06-14 Thread Kenneth Gonsalves
On Tue, 2011-06-14 at 15:36 +0200, Masklinn wrote: > >> that would mean, that none of your website was ever reachable by > >> entering the URL in a browser. Remember: all links you put on a > >> webpage will be GET requests made by the browser, when you click on > >> them. > > lets put it this way

Re: Error 'str' object has no attribute '_meta' . How to debug ?

2011-06-14 Thread Tom Evans
On Tue, Jun 14, 2011 at 1:53 PM, Satyajit Sarangi wrote: > I want to create a model that brings user_id of the user_auth table as > foreign key , layer_id from layer table(defined by me) as also a > foreign key . Combine both to form a primary key . and have another >

Re: GET vs POST for read-only views

2011-06-14 Thread Tom Evans
On Tue, Jun 14, 2011 at 2:03 PM, Kenneth Gonsalves wrote: > On Tue, 2011-06-14 at 08:51 -0400, Steven L Smith wrote: >> POST should only be used for things that change stuff on the server... >> a contact form, a form that creates something in a database, etc... > > thanks

Re: GET vs POST for read-only views

2011-06-14 Thread Masklinn
On 2011-06-14, at 15:26 , Kenneth Gonsalves wrote: > On Tue, 2011-06-14 at 15:10 +0200, Ivo Brodien wrote: >>> thanks - in 15 years of web programming I have never used get - >> maybe >>> time to start now. >> >> ?? >> >> that would mean, that none of your website was ever reachable by >>

Re: GET vs POST for read-only views

2011-06-14 Thread Kenneth Gonsalves
On Tue, 2011-06-14 at 15:10 +0200, Ivo Brodien wrote: > > thanks - in 15 years of web programming I have never used get - > maybe > > time to start now. > > ?? > > that would mean, that none of your website was ever reachable by > entering the URL in a browser. Remember: all links you put on a >

Re: GET vs POST for read-only views

2011-06-14 Thread Ivo Brodien
> thanks - in 15 years of web programming I have never used get - maybe > time to start now. ?? that would mean, that none of your website was ever reachable by entering the URL in a browser. Remember: all links you put on a webpage will be GET requests made by the browser, when you click on

Re: GET vs POST for read-only views

2011-06-14 Thread Kenneth Gonsalves
On Tue, 2011-06-14 at 08:51 -0400, Steven L Smith wrote: > For your use case, I would definitely use GET. The user may wish to > bookmark the report, for example, or send it to a colleague. Searches > and such should always use GET, unless there's a truly compelling > reason not to. > > POST

Re: Get MAC from diferent fields

2011-06-14 Thread Sil Westerveld
On Jun 14, 12:06 pm, rat attack wrote: > So I'm writing a new app, it fetches data from a MySQL db of other > software, I pick up these three models: > >    external_serial = models.CharField("Direccion Mac > 1",max_length=192, blank=True) >     mac_address =

Re: GET vs POST for read-only views

2011-06-14 Thread Steven L Smith
Hi Shawn- There is a consensus in the web development community at large -- the HTTP Spec itself touches on it, and the W3C has released a few supporting statements as well. http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html This is the HTTP 1.1 spec, section 9, which defines the difference

Error 'str' object has no attribute '_meta' . How to debug ?

2011-06-14 Thread Satyajit Sarangi
I want to create a model that brings user_id of the user_auth table as foreign key , layer_id from layer table(defined by me) as also a foreign key . Combine both to form a primary key . and have another integer called perm . My model looks like this from django.contrib.gis.db import models from

Re: poll problem

2011-06-14 Thread mattym
Scroll down to the second answer by Paolo. That should lead you in the right direction. http://stackoverflow.com/questions/625047/django-newbie-reverse-not-found On Jun 13, 11:04 pm, jaspreet wrote: > Hello everyone, > my polls application is completed. Admin part of the

Re: What should be a forms.py and views.py be like for a template that has radio buttons ?

2011-06-14 Thread Сергей Владимирович
Something like this: from django import forms class PermissionsChoiceForm(forms.Form): group1_ch = ( (0,' Any registered users'), (1, 'Only users that can edit ') ) group1 = forms.ChoiceField(

Get MAC from diferent fields

2011-06-14 Thread rat attack
So I'm writing a new app, it fetches data from a MySQL db of other software, I pick up these three models: external_serial = models.CharField("Direccion Mac 1",max_length=192, blank=True) mac_address = models.CharField("Direccion Mac 2",max_length=765, blank=True) computer_id =

multi-page, non-sequential, dynamic forms with serialization/deserialization

2011-06-14 Thread Michael Wayne Goodman
Hi all, I looked into Django for a specific task, but before I get too deep I want to make sure it is possible. We already have a site that does what we need (http://depts.washington.edu/uwcl/matrix/customize/ matrix.cgi), but it is written entirely in custom, proprietary code, and it is getting

Re: Integrity Error with generic relation using ContentType

2011-06-14 Thread Amit Sethi
On Tue, Jun 14, 2011 at 1:41 AM, christian.posta wrote: > Are you using your own fixtures (like initial_data.json)? > Is it possible that in your initial_data.json ( or whatever fixture > you're using) that you're including entries into the content_types [..] Well i do

Django Admin: Add text at runtime next to a field

2011-06-14 Thread Thomas Guettler
I want to add a text next to a field of the django admin interface. The warning needs to created at runtime inside a python method. I know python and the django ORM well, but I don't know how to get the text next the field. The text should be a warning. Raising ValidationError in clean() is not

Re: views without forms

2011-06-14 Thread bruno desthuilliers
On Jun 14, 4:27 am, Kenneth Gonsalves wrote: > On Mon, 2011-06-13 at 15:50 +0200, Masklinn wrote: > > You should check that it's not what's being done already, if the > > try/except > > blocks catch ValidationError it's possible you predecessor used that. > > this is the

Re: How Django render the various templates?

2011-06-14 Thread Derek
On Jun 13, 4:30 am, Nge wrote: > Hi Everyone! > > How can I create Django tablet site program? > How can decide Django redirect the web site or mobile site or tablet > site? > Does there has separately browser detection? > You're better off following modern practice and

Re: Django-based daily deals aggregator

2011-06-14 Thread dealshelve
We can certainly consider doing that once we moved out of beta. Part of Dealshelve framework is already an open source project itself, see Scrapy at http://scrapy.org On Jun 12, 10:17 am, Venkatraman S wrote: > On Fri, Jun 10, 2011 at 10:02 AM, Dealshelve (deals aggregator) <

poll problem

2011-06-14 Thread jaspreet
Hello everyone, my polls application is completed. Admin part of the polls application is running successfully but I am facing the following error in the User part at the last, after select a choice & click on the vote button. NoReverseMatch at /polls/3/vote/ Reverse for 'polls.views.results'