Re: filter chaining question

2011-06-15 Thread Jani Tiainen
On Wed, 2011-06-15 at 20:28 -0700, Bobby Roberts wrote:
> consider  this:
> 
> findit = inventory.objects.filter(Barcode = self.Barcode,
> Condition__name = "good")
> 
> How could i make this filter say "good" or "acceptable"

.filter(Q(Condition__name='good') | Q(Condition__name='acceptable'))

> or IN ('good','acceptable')

.filter(Condition__name__in=('good', 'acceptable', ))

hth.

-- 

Jani Tiainen


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



filter chaining question

2011-06-15 Thread Bobby Roberts
consider  this:

findit = inventory.objects.filter(Barcode = self.Barcode,
Condition__name = "good")

How could i make this filter say "good" or "acceptable"

or IN ('good','acceptable')

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: sorl thumbnail

2011-06-15 Thread Kenneth Gonsalves
On Wed, 2011-06-15 at 10:39 -0700, Greg Donald wrote:
> So what does one use for thumbnails when sorl thumbnail works great
> in 
> development but fails on two different production servers?
> 
> 

easy-thumbnail
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Kenneth Gonsalves
On Wed, 2011-06-15 at 11:01 -0300, Rodrigo Gomes wrote:
> But I think that I'm missing something. Is it so hard to write a
> simple
> custom select box, for example? I need to write a parser, a render and
> put
> in the html in another file? Or there is a easer way to do that?
> 
> 

as mentioned, django philosophy is against generating code.
-- 
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tim Shaffer
The link was just an example. It could be a more complex block of HTML. 
Point being if the tag just massaging data into HTML, you can accomplish it 
with another template without creating a tag.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/FcULkyqW-8EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do I link one template with another template ?

2011-06-15 Thread Satyajit Sarangi
Ok . I am getting this error
Exception Type:GEOSIndexError

I will show you the code .
This is my maps.html



  
{{ form.media }}
  
  

  {% csrf_token %}
  {{ form.as_p }}
{% block content %}
{% for entry in data %}
{{ data }}

{% endfor %}

{% endblock %}
  

  



This is my views.py

def map_page(request):
 lcount = Open_Layers.objects.all().count()

 if request.method == 'POST':
form = GeoForm(request.POST)
if form.is_valid():
data = form.cleaned_data
val=form.cleaned_data['AddLayer']
val1=val[0]
val2=val[2]
val3=val[3]
a=Open_Layers()
a.geom_poly=GeometryCollection(val[0],val[1],val[3])
 LName = form.cleaned_data['LayerName']
LDes = form.cleaned_data['LayerDescription']
a.Layer_name=LName
a.Layer_desc=LDes
a.save()


return HttpResponseRedirect('/map_view/')

 return render_to_response('maps.html', {'data':val3})
else:
form = GeoForm()
 else:
form = GeoForm()
return render_to_response('maps.html', {'form':form})
def map_view(request):
return render_to_response('mapsaved.html',{})


And this my urls.py
url(r'^openmaps/','openmaps.views.map_page',name='maps'),
url(r'^openmaps/','openmaps.views.map_view',name='mapsaved'),

Where have I gone wrong ?

Thank you for all the help till now


On Thu, Jun 16, 2011 at 3:21 AM, Shawn Milochik  wrote:

> On 06/15/2011 05:48 PM, Satyajit Sarangi wrote:
>
>> Can you show it in an html tag ? As in in a template , on click of the url
>>
>> Thanks for the help
>>
>
> Sure.
>
> Example from docs:
>{% url arch-summary 1945 %}
>
> In an HTML tag:
>
> Summary for 1945
>
>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
*Satyajit Sarangi*

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



GeoDjango issue with pysqlite

2011-06-15 Thread Ed
Hi,

I have followed the installation guide to the letter but am still
having issues when trying to syncdb.

I get the following error  "The pysqlite library does not support C
extension".

I have installed pysqlite with the following setup.cfg

[build_ext]
#define=
include_dirs=/Library/Frameworks/SQLite3.framework/unix/include
library_dirs=/Library/Frameworks/SQLite3.framework/unix/lib
libraries=sqlite3
#define=SQLITE_OMIT_LOAD_EXTENSION

Operating System : Mac OS X 10.6 (Snow Leopard)

I really dont know what else to try.

Not sure if the following helps, but some version output information

>>> import sqlite3
>>> sqlite3.version_info
(2, 4, 1)
>>> sqlite3.sqlite_version_info
(3, 6, 12)
>>> from pysqlite2 import dbapi2 as sqlite3
>>> sqlite3.version_info
(2, 6, 0)
>>> sqlite3.sqlite_version_info
(3, 7, 4)



-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do I link one template with another template ?

2011-06-15 Thread Shawn Milochik

On 06/15/2011 05:48 PM, Satyajit Sarangi wrote:
Can you show it in an html tag ? As in in a template , on click of the 
url


Thanks for the help


Sure.

Example from docs:
{% url arch-summary 1945 %}

In an HTML tag:

Summary for 1945


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do I link one template with another template ?

2011-06-15 Thread Satyajit Sarangi
Can you show it in an html tag ? As in in a template , on click of the url

Thanks for the help

On Thu, Jun 16, 2011 at 3:14 AM, Shawn Milochik  wrote:

> Use a named URL, then the {% url %} template tag.
>
> https://docs.djangoproject.com/en/1.3/topics/http/urls/#naming-url-patterns
>
> See the example and explanation in the docs.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
*Satyajit Sarangi*

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: How do I link one template with another template ?

2011-06-15 Thread Shawn Milochik

Use a named URL, then the {% url %} template tag.

https://docs.djangoproject.com/en/1.3/topics/http/urls/#naming-url-patterns

See the example and explanation in the docs.

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How do I link one template with another template ?

2011-06-15 Thread Satyajit Sarangi
I have a template , in which I want to display a link , which when
clicked takes the user to another template of another app . How to do
it ?

I understand its a basic django question , but still any help would be
usefull .

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



django.db.utils.IntegrityError: null value in column “layer_id_id” violates not-null constraint . How to debug ?

2011-06-15 Thread Satyajit Sarangi
his is my models.py

from django.db import models

class Sdr_Layer(models.Model): layer_name =
models.CharField(max_length = 100)
layer_attribute_name=models.CharField(max_length=100)

# This is an auto-generated Django model module created by ogrinspect.
from django.contrib.gis.db import models








# This is an auto-generated Django model module created by ogrinspect.
from django.contrib.gis.db import models

class Test(models.Model):
layer_id= models.ForeignKey(Sdr_Layer)
name = models.CharField(max_length=80)
descriptio = models.CharField(max_length=80)
geom = models.PolygonField(srid=4326)
objects = models.GeoManager()
S = Sdr_Layer(layer_name="Test")

# Auto-generated `LayerMapping` dictionary for Test model
test_mapping = {
'name' : 'Name',
'descriptio' : 'Descriptio',
'geom' : 'POLYGON25D',
}
S.layer_attribute_name=test_mapping
S.save();

When I am trying to load data to Test model , it throws me a not_null
error on layer_id which is the foreign key here . I basically want the
primary key of Sdr_Layer to act as a foreign key here . Sdr_Layer
table does have values . So , why such an error ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Strip_tags and non english char issue

2011-06-15 Thread ydjango

I have rich text (in utf8) which I want to show in standard browser
tooltip.

I strip html tags using strip_tags as they show as html tags in
tooltip.

Issue is that it seems strip_tags is stripping or converting certain
turkish characters like ü   into weird special chars?

I am unable to use django template's safe tag as data goes from django
view to xml to javascript.

We are using UTF8 encoding in DB.

Any ideas on how to solve?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread bruno desthuilliers
On 15 juin, 20:48, Tim Shaffer  wrote:
> Another option, if your use-case doesn't require anything terribly complex,
> is to just include another template and pass your variables to it:
>
> {% include "link_to.html" with url="google.com" text="check out google" %}
>
> In link_to.html:
>
> {{ text }}


Quite a lot of processing for something as simple as link...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to make geodjango databrowse admin view GeometryCollection Field data ?

2011-06-15 Thread Satyajit Sarangi
The present databrowse doesnt load if the model has anything apart
from point . How to make it load for polygon , line string and
GeometryCollectionField ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tim Shaffer
Another option, if your use-case doesn't require anything terribly complex, 
is to just include another template and pass your variables to it:

{% include "link_to.html" with url="google.com" text="check out google" %}

In link_to.html:

{{ text }}

https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#include

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/V9WZUcMGarYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread jay K.
Actually i had my code like this

for(var i = 0; i < city_schools.length; i++){ . }

But somehow i missed the .length when I posted my message... sorry if it
caused any confusions

I think the problem is that the data is not being stored in the array
properly, or at least I'm not doing it right



On Wed, Jun 15, 2011 at 1:36 PM, John Finlay  wrote:

>  On 6/15/11 8:59 AM, jay K. wrote:
>
> Hello,
>
> I apologize for seeming too impatient or rude, actually I'm a bit in a
> hurry because I was given a project
> and was told that it was urgent. I miscalculated how much time it was going
> to take me to learn django
>
> Anyway, what I want to do is to use the variables variables city_schools,
> city_latitudes and city_longitudes
> as javascript arrays in a separate js file
>
> For instance, like this
>
> //INSIDE JAVASCRIPT FILE
>
> 
>
> for(var i = 0; i < city_schools; i++){
>
>
> shouldn't this be:
>
> for(var i = 0; i < city_schools.length; i++){
>
>
>
> var lat = city_latitude[i];
> var long = city_longitude[i];
>
> googlemap.addmarker(lat, long);
>
> ..
> }
>
> 
> //END
>
> The whole point here is to add markers to an existing google map. Somehow
> the variables store the data from django into the js arrays, but
> I am unable to access them they way I want, so I was wondering if I need to
> do anything extra before manipulating the js arrays.
>
> Any suggestions would be welcomed
>
> Thanks, and again sorry for seeming rude/desperate, it was all my fault
>
>
>
>
> On Wed, Jun 15, 2011 at 10:45 AM, Ian Clelland  wrote:
>
>> On Wed, Jun 15, 2011 at 7:27 AM, jay K. wrote:
>>
>>> Hello,
>>>
>>> I've posted my question before, but I believe I didn't provide enough
>>> detail. I intend to present my issue again, this time with more
>>> detail.
>>>
>>> Let me tell you that I am not a django developer, so I have very
>>> limited exposure to django. I just know html, css, javascript, jquery,
>>> php (also java and c++, so I'm familiar with object-oriented
>>> programming).
>>
>>
>>  ...
>>
>>
>>>
>>> Now, I manage to see the output of the javascript written above
>>> through Firefox's "View - Page Source" and it comes up like this
>>>
>>> //BEGINNING
>>> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>>>
>>> var city_latitudes = ["58","88","25"];
>>>
>>> var city_longtitudes = ["7","99","100"];
>>>
>>> //END
>>>
>>>
>>> I have a separate javascript file where I add the code for the google
>>> map. What I want to do is to be able to access each of the
>>> city_schools, city_latitudes, and city_longitudes and use its data to
>>> I can mark the schools inside a google map. It would be ideal if I
>>> could retrieve the info as if it was a js array, but any method that
>>> works is more than welcome
>>>
>>
>>  What you have is very clearly a JavaScript array, as you asked for the
>> first time you posed this question. In fact, by copying the code, you have
>> produced three JavaScript arrays.
>>
>>  What you haven't done, in this newest version of your question, is show
>> exactly what it is you want. We now have a rough idea of what your models
>> look like, but no idea at all why the JavaScript output you have pasted is
>> insufficient.
>>
>>  You say that you know JavaScript, so what you're going to have to do is
>> come up with a sample of what you'd *like* to see as the template output,
>> and hopefully we can help you with the Django template code to produce that
>> output.
>>
>>  [Also, it really doesn't help to be posting and reposting the same
>> question, just hours apart -- it just looks very impatient]
>>
>> --
>> Regards,
>> Ian Clelland
>> 
>>   --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to 

Re: sorl thumbnail

2011-06-15 Thread Greg Donald

So what does one use for thumbnails when sorl thumbnail works great in 
development but fails on two different production servers?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/tzu988epqmcJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread John Finlay

On 6/15/11 8:59 AM, jay K. wrote:

Hello,

I apologize for seeming too impatient or rude, actually I'm a bit in a 
hurry because I was given a project
and was told that it was urgent. I miscalculated how much time it was 
going to take me to learn django


Anyway, what I want to do is to use the variables variables 
city_schools, city_latitudes and city_longitudes

as javascript arrays in a separate js file

For instance, like this

//INSIDE JAVASCRIPT FILE



for(var i = 0; i < city_schools; i++){


shouldn't this be:

for(var i = 0; i < city_schools.length; i++){



var lat = city_latitude[i];
var long = city_longitude[i];

googlemap.addmarker(lat, long);

..
}


//END

The whole point here is to add markers to an existing google map. 
Somehow the variables store the data from django into the js arrays, but
I am unable to access them they way I want, so I was wondering if I 
need to do anything extra before manipulating the js arrays.


Any suggestions would be welcomed

Thanks, and again sorry for seeming rude/desperate, it was all my fault




On Wed, Jun 15, 2011 at 10:45 AM, Ian Clelland > wrote:


On Wed, Jun 15, 2011 at 7:27 AM, jay K.
>
wrote:

Hello,

I've posted my question before, but I believe I didn't provide
enough
detail. I intend to present my issue again, this time with more
detail.

Let me tell you that I am not a django developer, so I have very
limited exposure to django. I just know html, css, javascript,
jquery,
php (also java and c++, so I'm familiar with object-oriented
programming).


...


Now, I manage to see the output of the javascript written above
through Firefox's "View - Page Source" and it comes up like this

//BEGINNING
var city_schools = ["EC","St. Giles Central","St. Giles
Highgate"];

var city_latitudes = ["58","88","25"];

var city_longtitudes = ["7","99","100"];

//END


I have a separate javascript file where I add the code for the
google
map. What I want to do is to be able to access each of the
city_schools, city_latitudes, and city_longitudes and use its
data to
I can mark the schools inside a google map. It would be ideal if I
could retrieve the info as if it was a js array, but any
method that
works is more than welcome


What you have is very clearly a JavaScript array, as you asked for
the first time you posed this question. In fact, by copying the
code, you have produced three JavaScript arrays.

What you haven't done, in this newest version of your question, is
show exactly what it is you want. We now have a rough idea of what
your models look like, but no idea at all why the JavaScript
output you have pasted is insufficient.

You say that you know JavaScript, so what you're going to have to
do is come up with a sample of what you'd *like* to see as the
template output, and hopefully we can help you with the Django
template code to produce that output.

[Also, it really doesn't help to be posting and reposting the same
question, just hours apart -- it just looks very impatient]

-- 
Regards,

Ian Clelland
>
-- 
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
django-users+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Rodrigo Gomes
Hi Tom, thanks for your reply.

Inclusion tag seems to be better (to write) than the other kinds of tags.
But I think that it is still too many things to do just to write a tag.

But it works, and I'm doing this way right now :)

Thanks,
Rodrigo Gomes


On Wed, Jun 15, 2011 at 11:11 AM, Tom Evans wrote:

> On Wed, Jun 15, 2011 at 3:01 PM, Rodrigo Gomes  wrote:
> > Hi,
> > I was looking for some 'html helpers' in django as we have on rails or
> java
> > (with tagfiles or taglibs), but I saw that it doesn't exist, according to
> > this stackoverflow response:
> > http://stackoverflow.com/questions/61451/does-django-have-html-helpers
> > The guy suggested to write custom template tags, and pointed to this
> > page https://docs.djangoproject.com/en/1.2/howto/custom-template-tags/
> > But I think that I'm missing something. Is it so hard to write a simple
> > custom select box, for example? I need to write a parser, a render and
> put
> > in the html in another file? Or there is a easer way to do that?
> > What I want is just write some custom html components (inputs) with
> specific
> > behavior.
> > Any tips?
> > Thanks,
> > Rodrigo Gomes
> >
>
> The original advice stands - template inclusion tags are just a few
> lines of code + the HTML file.
>
>
> https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/#inclusion-tags
>
> Cheers
>
> Tom
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with tutorial

2011-06-15 Thread Kyle Latham
Wow. I feel like a dumbass haha. That worked! Thank you so much for
your help!

On Jun 15, 11:15 am, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> No problem.
>
> You need to use __unicode__, not _unicode_ :)
>
> Cal
>
>
>
>
>
>
>
> On Wed, Jun 15, 2011 at 6:02 PM, Kyle Latham  wrote:
> > I understand your frustration. I'm sorry for not posting my code with
> > my first post.
>
> > my settings.py file (only up to the part I changed) is below:
>
> > # Django settings for mysite project.
>
> > DEBUG = True
> > TEMPLATE_DEBUG = DEBUG
>
> > ADMINS = (
> >    # ('Name', 'n...@email.com'),
> > )
>
> > MANAGERS = ADMINS
>
> > DATABASES = {
> >    'default': {
> >        'ENGINE': 'django.db.backends.sqlite3', # Add
> > 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
> >        'NAME': 'C:/Django/django/bin/mysite/
> > database.db',                      # Or path to database file if using
> > sqlite3.
> >        'USER': '',                      # Not used with sqlite3.
> >        'PASSWORD': '',                  # Not used with sqlite3.
> >        'HOST': '',                      # Set to empty string for
> > localhost. Not used with sqlite3.
> >        'PORT': '',                      # Set to empty string for
> > default. Not used with sqlite3.
> >    }
> > }
>
> > My models.py file is:
>
> > from django.db import models
> > import datetime
>
> > # Create your models here.
> > class Poll(models.Model):
> >    question = models.CharField(max_length=200)
> >    pub_date = models.DateTimeField('date published')
>
> >    def _unicode_(self):
> >        return self.question
>
> >    def was_published_today(self):
> >        return self.pub_date.date() == datetime.date.today()
>
> > class Choice(models.Model):
> >    poll = models.ForeignKey(Poll)
> >    choice = models.CharField(max_length=200)
> >    votes = models.IntegerField()
>
> >    def _unicode_(self):
> >        return self.choice
>
> > Thanks for your help.
>
> > On Jun 15, 10:55 am, "Cal Leeming [Simplicity Media Ltd]"
> >  wrote:
> > > Please please please please PLEASE, always post the code you are having
> > > trouble with. I've lost track on the amount of times people have to be
> > told
> > > this :/ It's like saying "I made a change to this file, but it didn't
> > work,
> > > why not?" Come on man.
>
> > > On Wed, Jun 15, 2011 at 5:48 PM, Kyle Latham 
> > wrote:
> > > > I'm trying to work my way through the tutorial 1 but am getting stuck.
> > > > I am using python 2.7 and am using SQLite3 like the tutorial
> > > > recommended for beginners
>
> > > > I am at the step where I am changing the models.py file to add the
> > > > _unicode_ methods to display the Poll Object
>
> > > > I believe I have the NAME in the settings.py file set up correctly. I
> > > > first set did
> > > > 'NAME': 'database.db',
> > > > to create my database file, then I changed it to the path to that
> > > > file.
>
> > > > Anyways, after I modified the models.py file to display the
> > > > question...
> > > > >>> Poll.objects.all()
> > > > []
>
> > > > I am still getting
>
> > > > >>> Poll.objects.all()
> > > > []
>
> > > > as the output.
>
> > > > Any help would be greatly appreciated.
>
> > > > Thanks,
>
> > > > Kyle
>
> > > > --
> > > > 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
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with tutorial

2011-06-15 Thread Tim Shaffer
There should be two underscores before and after the "unicode" in the method 
name:

"__unicode__" instead of "_unicode_"

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/9KsXDNSb5PIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with tutorial

2011-06-15 Thread Cal Leeming [Simplicity Media Ltd]
No problem.

You need to use __unicode__, not _unicode_ :)

Cal

On Wed, Jun 15, 2011 at 6:02 PM, Kyle Latham  wrote:

> I understand your frustration. I'm sorry for not posting my code with
> my first post.
>
> my settings.py file (only up to the part I changed) is below:
>
> # Django settings for mysite project.
>
> DEBUG = True
> TEMPLATE_DEBUG = DEBUG
>
> ADMINS = (
># ('Name', 'n...@email.com'),
> )
>
> MANAGERS = ADMINS
>
> DATABASES = {
>'default': {
>'ENGINE': 'django.db.backends.sqlite3', # Add
> 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
>'NAME': 'C:/Django/django/bin/mysite/
> database.db',  # Or path to database file if using
> sqlite3.
>'USER': '',  # Not used with sqlite3.
>'PASSWORD': '',  # Not used with sqlite3.
>'HOST': '',  # Set to empty string for
> localhost. Not used with sqlite3.
>'PORT': '',  # Set to empty string for
> default. Not used with sqlite3.
>}
> }
>
>
> My models.py file is:
>
> from django.db import models
> import datetime
>
> # Create your models here.
> class Poll(models.Model):
>question = models.CharField(max_length=200)
>pub_date = models.DateTimeField('date published')
>
>def _unicode_(self):
>return self.question
>
>def was_published_today(self):
>return self.pub_date.date() == datetime.date.today()
>
> class Choice(models.Model):
>poll = models.ForeignKey(Poll)
>choice = models.CharField(max_length=200)
>votes = models.IntegerField()
>
>def _unicode_(self):
>return self.choice
>
>
>
> Thanks for your help.
>
>
>
> On Jun 15, 10:55 am, "Cal Leeming [Simplicity Media Ltd]"
>  wrote:
> > Please please please please PLEASE, always post the code you are having
> > trouble with. I've lost track on the amount of times people have to be
> told
> > this :/ It's like saying "I made a change to this file, but it didn't
> work,
> > why not?" Come on man.
> >
> >
> >
> >
> >
> >
> >
> > On Wed, Jun 15, 2011 at 5:48 PM, Kyle Latham 
> wrote:
> > > I'm trying to work my way through the tutorial 1 but am getting stuck.
> > > I am using python 2.7 and am using SQLite3 like the tutorial
> > > recommended for beginners
> >
> > > I am at the step where I am changing the models.py file to add the
> > > _unicode_ methods to display the Poll Object
> >
> > > I believe I have the NAME in the settings.py file set up correctly. I
> > > first set did
> > > 'NAME': 'database.db',
> > > to create my database file, then I changed it to the path to that
> > > file.
> >
> > > Anyways, after I modified the models.py file to display the
> > > question...
> > > >>> Poll.objects.all()
> > > []
> >
> > > I am still getting
> >
> > > >>> Poll.objects.all()
> > > []
> >
> > > as the output.
> >
> > > Any help would be greatly appreciated.
> >
> > > Thanks,
> >
> > > Kyle
> >
> > > --
> > > 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
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with tutorial

2011-06-15 Thread Kyle Latham
I understand your frustration. I'm sorry for not posting my code with
my first post.

my settings.py file (only up to the part I changed) is below:

# Django settings for mysite project.

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
# ('Name', 'n...@email.com'),
)

MANAGERS = ADMINS

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add
'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'C:/Django/django/bin/mysite/
database.db',  # Or path to database file if using
sqlite3.
'USER': '',  # Not used with sqlite3.
'PASSWORD': '',  # Not used with sqlite3.
'HOST': '',  # Set to empty string for
localhost. Not used with sqlite3.
'PORT': '',  # Set to empty string for
default. Not used with sqlite3.
}
}


My models.py file is:

from django.db import models
import datetime

# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')

def _unicode_(self):
return self.question

def was_published_today(self):
return self.pub_date.date() == datetime.date.today()

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice = models.CharField(max_length=200)
votes = models.IntegerField()

def _unicode_(self):
return self.choice



Thanks for your help.



On Jun 15, 10:55 am, "Cal Leeming [Simplicity Media Ltd]"
 wrote:
> Please please please please PLEASE, always post the code you are having
> trouble with. I've lost track on the amount of times people have to be told
> this :/ It's like saying "I made a change to this file, but it didn't work,
> why not?" Come on man.
>
>
>
>
>
>
>
> On Wed, Jun 15, 2011 at 5:48 PM, Kyle Latham  wrote:
> > I'm trying to work my way through the tutorial 1 but am getting stuck.
> > I am using python 2.7 and am using SQLite3 like the tutorial
> > recommended for beginners
>
> > I am at the step where I am changing the models.py file to add the
> > _unicode_ methods to display the Poll Object
>
> > I believe I have the NAME in the settings.py file set up correctly. I
> > first set did
> > 'NAME': 'database.db',
> > to create my database file, then I changed it to the path to that
> > file.
>
> > Anyways, after I modified the models.py file to display the
> > question...
> > >>> Poll.objects.all()
> > []
>
> > I am still getting
>
> > >>> Poll.objects.all()
> > []
>
> > as the output.
>
> > Any help would be greatly appreciated.
>
> > Thanks,
>
> > Kyle
>
> > --
> > 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
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Need help with tutorial

2011-06-15 Thread Cal Leeming [Simplicity Media Ltd]
Please please please please PLEASE, always post the code you are having
trouble with. I've lost track on the amount of times people have to be told
this :/ It's like saying "I made a change to this file, but it didn't work,
why not?" Come on man.

On Wed, Jun 15, 2011 at 5:48 PM, Kyle Latham  wrote:

> I'm trying to work my way through the tutorial 1 but am getting stuck.
> I am using python 2.7 and am using SQLite3 like the tutorial
> recommended for beginners
>
> I am at the step where I am changing the models.py file to add the
> _unicode_ methods to display the Poll Object
>
> I believe I have the NAME in the settings.py file set up correctly. I
> first set did
> 'NAME': 'database.db',
> to create my database file, then I changed it to the path to that
> file.
>
> Anyways, after I modified the models.py file to display the
> question...
> >>> Poll.objects.all()
> []
>
> I am still getting
>
> >>> Poll.objects.all()
> []
>
> as the output.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Kyle
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Need help with tutorial

2011-06-15 Thread Kyle Latham
I'm trying to work my way through the tutorial 1 but am getting stuck.
I am using python 2.7 and am using SQLite3 like the tutorial
recommended for beginners

I am at the step where I am changing the models.py file to add the
_unicode_ methods to display the Poll Object

I believe I have the NAME in the settings.py file set up correctly. I
first set did
'NAME': 'database.db',
to create my database file, then I changed it to the path to that
file.

Anyways, after I modified the models.py file to display the
question...
>>> Poll.objects.all()
[]

I am still getting

>>> Poll.objects.all()
[]

as the output.

Any help would be greatly appreciated.

Thanks,

Kyle

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread Tom Evans
On Wed, Jun 15, 2011 at 4:59 PM, jay K.  wrote:
> Hello,
>
> I apologize for seeming too impatient or rude, actually I'm a bit in a hurry
> because I was given a project
> and was told that it was urgent. I miscalculated how much time it was going
> to take me to learn django
>
> Anyway, what I want to do is to use the variables variables city_schools,
> city_latitudes and city_longitudes
> as javascript arrays in a separate js file
>

http://stackoverflow.com/questions/2932782/global-variables-in-javascript-across-multiple-files

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread Tim Sawyer
This might help:

http://drumcoder.co.uk/blog/2009/nov/26/google-maps-django/

Tim.

> Hello,
>
> I apologize for seeming too impatient or rude, actually I'm a bit in a
> hurry
> because I was given a project
> and was told that it was urgent. I miscalculated how much time it was
> going
> to take me to learn django
>
> Anyway, what I want to do is to use the variables variables city_schools,
> city_latitudes and city_longitudes
> as javascript arrays in a separate js file
>
> For instance, like this
>
> //INSIDE JAVASCRIPT FILE
>
> 
>
> for(var i = 0; i < city_schools; i++){
>
> var lat = city_latitude[i];
> var long = city_longitude[i];
>
> googlemap.addmarker(lat, long);
>
> ..
> }
>
> 
> //END
>
> The whole point here is to add markers to an existing google map. Somehow
> the variables store the data from django into the js arrays, but
> I am unable to access them they way I want, so I was wondering if I need
> to
> do anything extra before manipulating the js arrays.
>
> Any suggestions would be welcomed
>
> Thanks, and again sorry for seeming rude/desperate, it was all my fault
>
>
>
>
> On Wed, Jun 15, 2011 at 10:45 AM, Ian Clelland  wrote:
>
>> On Wed, Jun 15, 2011 at 7:27 AM, jay K.
>> wrote:
>>
>>> Hello,
>>>
>>> I've posted my question before, but I believe I didn't provide enough
>>> detail. I intend to present my issue again, this time with more
>>> detail.
>>>
>>> Let me tell you that I am not a django developer, so I have very
>>> limited exposure to django. I just know html, css, javascript, jquery,
>>> php (also java and c++, so I'm familiar with object-oriented
>>> programming).
>>
>>
>> ...
>>
>>
>>>
>>> Now, I manage to see the output of the javascript written above
>>> through Firefox's "View - Page Source" and it comes up like this
>>>
>>> //BEGINNING
>>> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>>>
>>> var city_latitudes = ["58","88","25"];
>>>
>>> var city_longtitudes = ["7","99","100"];
>>>
>>> //END
>>>
>>>
>>> I have a separate javascript file where I add the code for the google
>>> map. What I want to do is to be able to access each of the
>>> city_schools, city_latitudes, and city_longitudes and use its data to
>>> I can mark the schools inside a google map. It would be ideal if I
>>> could retrieve the info as if it was a js array, but any method that
>>> works is more than welcome
>>>
>>
>> What you have is very clearly a JavaScript array, as you asked for the
>> first time you posed this question. In fact, by copying the code, you
>> have
>> produced three JavaScript arrays.
>>
>> What you haven't done, in this newest version of your question, is show
>> exactly what it is you want. We now have a rough idea of what your
>> models
>> look like, but no idea at all why the JavaScript output you have pasted
>> is
>> insufficient.
>>
>> You say that you know JavaScript, so what you're going to have to do is
>> come up with a sample of what you'd *like* to see as the template
>> output,
>> and hopefully we can help you with the Django template code to produce
>> that
>> output.
>>
>> [Also, it really doesn't help to be posting and reposting the same
>> question, just hours apart -- it just looks very impatient]
>>
>> --
>> Regards,
>> Ian Clelland
>> 
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread jay K.
Hello,

I apologize for seeming too impatient or rude, actually I'm a bit in a hurry
because I was given a project
and was told that it was urgent. I miscalculated how much time it was going
to take me to learn django

Anyway, what I want to do is to use the variables variables city_schools,
city_latitudes and city_longitudes
as javascript arrays in a separate js file

For instance, like this

//INSIDE JAVASCRIPT FILE



for(var i = 0; i < city_schools; i++){

var lat = city_latitude[i];
var long = city_longitude[i];

googlemap.addmarker(lat, long);

..
}


//END

The whole point here is to add markers to an existing google map. Somehow
the variables store the data from django into the js arrays, but
I am unable to access them they way I want, so I was wondering if I need to
do anything extra before manipulating the js arrays.

Any suggestions would be welcomed

Thanks, and again sorry for seeming rude/desperate, it was all my fault




On Wed, Jun 15, 2011 at 10:45 AM, Ian Clelland  wrote:

> On Wed, Jun 15, 2011 at 7:27 AM, jay K. wrote:
>
>> Hello,
>>
>> I've posted my question before, but I believe I didn't provide enough
>> detail. I intend to present my issue again, this time with more
>> detail.
>>
>> Let me tell you that I am not a django developer, so I have very
>> limited exposure to django. I just know html, css, javascript, jquery,
>> php (also java and c++, so I'm familiar with object-oriented
>> programming).
>
>
> ...
>
>
>>
>> Now, I manage to see the output of the javascript written above
>> through Firefox's "View - Page Source" and it comes up like this
>>
>> //BEGINNING
>> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>>
>> var city_latitudes = ["58","88","25"];
>>
>> var city_longtitudes = ["7","99","100"];
>>
>> //END
>>
>>
>> I have a separate javascript file where I add the code for the google
>> map. What I want to do is to be able to access each of the
>> city_schools, city_latitudes, and city_longitudes and use its data to
>> I can mark the schools inside a google map. It would be ideal if I
>> could retrieve the info as if it was a js array, but any method that
>> works is more than welcome
>>
>
> What you have is very clearly a JavaScript array, as you asked for the
> first time you posed this question. In fact, by copying the code, you have
> produced three JavaScript arrays.
>
> What you haven't done, in this newest version of your question, is show
> exactly what it is you want. We now have a rough idea of what your models
> look like, but no idea at all why the JavaScript output you have pasted is
> insufficient.
>
> You say that you know JavaScript, so what you're going to have to do is
> come up with a sample of what you'd *like* to see as the template output,
> and hopefully we can help you with the Django template code to produce that
> output.
>
> [Also, it really doesn't help to be posting and reposting the same
> question, just hours apart -- it just looks very impatient]
>
> --
> Regards,
> Ian Clelland
> 
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Djungo on Microsoft IIS

2011-06-15 Thread Yaroslav Govorunov
Pete,

We have developed our own FastCGI module and Django (WSGI) wrapper,
that is why it should work now.

Yes, it is intended to work with existing project, but note it is beta
and we are asking to help us to beta-test it. I cannot suggest to
install it in production environment until beta testing is finished.
After you install "Blank Django Project" application, which will
install all dependencies, you can overwrite files inside this project
with existing Django project. In fact only web.config file is needed
form this "blank project". Then you can even start Django in any other
web site or directory inside IIS just by adding few lines to
web.config file. Documentation will be available soon.

Yaroslav.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread Tom Evans
On Wed, Jun 15, 2011 at 3:27 PM, jay K.  wrote:
> Hello,
>
> I've posted my question before, but I believe I didn't provide enough
> detail. I intend to present my issue again, this time with more
> detail.
>
>...
>
> Now, I manage to see the output of the javascript written above
> through Firefox's "View - Page Source" and it comes up like this
>
> //BEGINNING
> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>
> var city_latitudes = ["58","88","25"];
>
> var city_longtitudes = ["7","99","100"];
>
> //END
>
>
> I have a separate javascript file where I add the code for the google
> map. What I want to do is to be able to access each of the
> city_schools, city_latitudes, and city_longitudes and use its data to
> I can mark the schools inside a google map. It would be ideal if I
> could retrieve the info as if it was a js array, but any method that
> works is more than welcome

Probably no-one answered because your question is still vague. I've
read it twice and I can't see what you are asking. You have generated
JS data in arrays, so access it?

Are you really asking 'how do I set JS variables in the HTML source,
and access them from a separate JS file?'?

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: storing django object into javascript variable/array

2011-06-15 Thread Ian Clelland
On Wed, Jun 15, 2011 at 7:27 AM, jay K.  wrote:

> Hello,
>
> I've posted my question before, but I believe I didn't provide enough
> detail. I intend to present my issue again, this time with more
> detail.
>
> Let me tell you that I am not a django developer, so I have very
> limited exposure to django. I just know html, css, javascript, jquery,
> php (also java and c++, so I'm familiar with object-oriented
> programming).


...


>
> Now, I manage to see the output of the javascript written above
> through Firefox's "View - Page Source" and it comes up like this
>
> //BEGINNING
> var city_schools = ["EC","St. Giles Central","St. Giles Highgate"];
>
> var city_latitudes = ["58","88","25"];
>
> var city_longtitudes = ["7","99","100"];
>
> //END
>
>
> I have a separate javascript file where I add the code for the google
> map. What I want to do is to be able to access each of the
> city_schools, city_latitudes, and city_longitudes and use its data to
> I can mark the schools inside a google map. It would be ideal if I
> could retrieve the info as if it was a js array, but any method that
> works is more than welcome
>

What you have is very clearly a JavaScript array, as you asked for the first
time you posed this question. In fact, by copying the code, you have
produced three JavaScript arrays.

What you haven't done, in this newest version of your question, is show
exactly what it is you want. We now have a rough idea of what your models
look like, but no idea at all why the JavaScript output you have pasted is
insufficient.

You say that you know JavaScript, so what you're going to have to do is come
up with a sample of what you'd *like* to see as the template output, and
hopefully we can help you with the Django template code to produce that
output.

[Also, it really doesn't help to be posting and reposting the same question,
just hours apart -- it just looks very impatient]

-- 
Regards,
Ian Clelland


-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Integrity Error with generic relation using ContentType

2011-06-15 Thread christian.posta
Well, there are some ways around it if you use dumpdata/loaddata
statements. But for initial fixtures, it causes trouble.
When the DB is created, django will dynamically try to populate the
content-types table. But if you are already putting data into that
table, the primary keys will clash.

When doing your dumpdata, you can try excluding the contenttypes app
and see if that resolves your issues. (it might cause other issues if
you have models that depend specifically on the primary keys of the
contenttypes).

./manage.py dumpdata --exclude contenttypes > initial_fixture.json



On Jun 14, 10:06 am, Amit Sethi  wrote:
> 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 should I not have it as part of fixtures ?
>
> --
> A-M-I-T S|S

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django admin report

2011-06-15 Thread Leonardo da Costa Santos
Thanks very much!

Atenciosamente,

Leonardo da Costa Santos
Desenvolvedor na e-Tick
Graduando em Sistemas de Informação - FIP


2011/6/15 Derek 

> On Jun 14, 6:28 pm, Andre Terra  wrote:
> > 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
> >2. Add the package "report" to your path.
> >
> > Usage
> >
> > - In your application's admin.py, import the following 'action' like so:
> >
> > from report.actions import report_generic
> >
> > - Also in admin.py, in your model's ModelAdmin specify a variable called
> > "list_report" that should contain an iterable with the model attributes
> that
> > should appear on the report, e.g.
> >
> >  list_report = ('some_attribute', 'other_attribute', )
> >
> > - Finally, make sure you also add the aforementioned 'action' to your
> > ModelAdmin's list of actions, like so:
> >
> > actions = [report_generic, ]
> >
> > ---
> >
> > I should add that some screenshots would go a long way!
> >
> > Cheers,
> >
> > André Terra
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Jun 13, 2011 at 5:59 AM, Derek  wrote:
> > > On Jun 9, 9:13 pm, Leonardo da Costa Santos
> > >  wrote:
> > > > Good morning guys!
> >
> > > > I came to share with you the Django Admin Report ... she is a little
> > > Django
> > > > app that makes it easy to export reports in PDF using the
> administration
> > > > interface of django.
> >
> > > > The idea is to just tell the class of directors which is the list of
> > > template
> > > > fields to be exported (list_report) and add a generic action
> > > (report_generic
> > > > ), which he does the rest alone. With this you use the filters bassta
> > > > administration and research and select the lines that go to the
> report by
> > > > clicking on the action (Generating report net) PDF will appear in
> your
> > > > browser to be downloaded!
> >
> > > > You can encortrar the sources here:
> > >https://github.com/leonardocsantoss/django-admin-report
> >
> > > > Today in list_report attributes can be passed either as methods ...
> Yet
> > > he can
> > > > not print an attribute of a foreign key ... This will be the next
> step
> > > > would the
> > > > project!
> >
> > > Leonardo
> >
> > > This looks to be useful; can you please translate the Git page into
> > > English?
> >
> > > Thanks!
>
> Andre -it would be great if you could contribute this back to the
> project; and maybe offer to translate the other pages too.  I think he
> would get more traction if the docs were in English.
>
> Derek
>
> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Moving Away from if/else Template Logic

2011-06-15 Thread francescortiz
you could try something like

{% with x.message|regtest as value %}
{% include "messages/"|add:value|add:".html" %}
{% endwith %}


On 15 Juny, 05:04, Greg Corradini  wrote:
> 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.compile(r'^\*\*(?P.*)\*\*')
>     m = regex.match(value)
>     if m != None:
>         return "True"
>     return "False"
>
> I would like to move to something like this in the template:
>
> {{ x.message|regtest }}
>
> given this template filter:
>
> def regtest(value):
>     regex = re.compile(r'^\*\*(?P.*)\*\*')
>     m = regex.match(value)
>     if m != None: return "%s"%value
>     else: return value
>
> However, the html tags returned from the filter becomes part of the
> element's text value instead of tags. So that's not working.
>
> I'm sure there's way better ways to side-step ugly if/else logic in
> the templates. What types of things can people recommend for a Django
> new guy.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django admin report

2011-06-15 Thread Derek
On Jun 14, 6:28 pm, Andre Terra  wrote:
> 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
>    2. Add the package "report" to your path.
>
> Usage
>
> - In your application's admin.py, import the following 'action' like so:
>
> from report.actions import report_generic
>
> - Also in admin.py, in your model's ModelAdmin specify a variable called
> "list_report" that should contain an iterable with the model attributes that
> should appear on the report, e.g.
>
>  list_report = ('some_attribute', 'other_attribute', )
>
> - Finally, make sure you also add the aforementioned 'action' to your
> ModelAdmin's list of actions, like so:
>
> actions = [report_generic, ]
>
> ---
>
> I should add that some screenshots would go a long way!
>
> Cheers,
>
> André Terra
>
>
>
>
>
>
>
> On Mon, Jun 13, 2011 at 5:59 AM, Derek  wrote:
> > On Jun 9, 9:13 pm, Leonardo da Costa Santos
> >  wrote:
> > > Good morning guys!
>
> > > I came to share with you the Django Admin Report ... she is a little
> > Django
> > > app that makes it easy to export reports in PDF using the administration
> > > interface of django.
>
> > > The idea is to just tell the class of directors which is the list of
> > template
> > > fields to be exported (list_report) and add a generic action
> > (report_generic
> > > ), which he does the rest alone. With this you use the filters bassta
> > > administration and research and select the lines that go to the report by
> > > clicking on the action (Generating report net) PDF will appear in your
> > > browser to be downloaded!
>
> > > You can encortrar the sources here:
> >https://github.com/leonardocsantoss/django-admin-report
>
> > > Today in list_report attributes can be passed either as methods ... Yet
> > he can
> > > not print an attribute of a foreign key ... This will be the next step
> > > would the
> > > project!
>
> > Leonardo
>
> > This looks to be useful; can you please translate the Git page into
> > English?
>
> > Thanks!

Andre -it would be great if you could contribute this back to the
project; and maybe offer to translate the other pages too.  I think he
would get more traction if the docs were in English.

Derek

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Djungo on Microsoft IIS

2011-06-15 Thread CrabbyPete
Yaroslav,

I tried and tried to get Django to work with IIS on my Windows Server,
but could not get it to work. I would love to know how you did it. I
finally gave up and installed Apache on Windows. Will this work with
an existing Django project?

Pete

On Jun 15, 2:52 am, Yaroslav Govorunov  wrote:
> Hello!
>
> We have recently developed a solution to install and run Django
> applications on Microsoft IIS. Here is the link:  
> http://www.helicontech.com/zoo/
>
> Currently IIS 7, 7.5 and IIS Express are supported.  We expect to
> demonstrate production level performance in this environment on
> release. To use the solution you will need to install Web Platform
> Installer, as shown on the page, then click on "Blank Django Project"
> and after installation is completed overwrite this blank project with
> a real one or start development from this point.
>
> Please help us to beta-test our solution. We need to collect some
> statistic on how real Django application is operating in IIS
> environment.  Please direct either success or fail reports to
> supp...@helicontech.com or tweet using #heliconzoo 
> hashtag:http://twitter.com/?status=%23heliconzoo
>
> Thanks in advance!
>
> Yaroslav Govorunov
> Helicon Techhttp://www.helicontech.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Tom Evans
On Wed, Jun 15, 2011 at 3:01 PM, Rodrigo Gomes  wrote:
> Hi,
> I was looking for some 'html helpers' in django as we have on rails or java
> (with tagfiles or taglibs), but I saw that it doesn't exist, according to
> this stackoverflow response:
> http://stackoverflow.com/questions/61451/does-django-have-html-helpers
> The guy suggested to write custom template tags, and pointed to this
> page https://docs.djangoproject.com/en/1.2/howto/custom-template-tags/
> But I think that I'm missing something. Is it so hard to write a simple
> custom select box, for example? I need to write a parser, a render and put
> in the html in another file? Or there is a easer way to do that?
> What I want is just write some custom html components (inputs) with specific
> behavior.
> Any tips?
> Thanks,
> Rodrigo Gomes
>

The original advice stands - template inclusion tags are just a few
lines of code + the HTML file.

https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/#inclusion-tags

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Helper methods like rails or taglibs/tagfiles like java

2011-06-15 Thread Rodrigo Gomes
Hi,

I was looking for some 'html helpers' in django as we have on rails or java
(with tagfiles or taglibs), but I saw that it doesn't exist, according to
this stackoverflow response:
http://stackoverflow.com/questions/61451/does-django-have-html-helpers

The guy suggested to write custom template tags, and pointed to this page
https://docs.djangoproject.com/en/1.2/howto/custom-template-tags/

But I think that I'm missing something. Is it so hard to write a simple
custom select box, for example? I need to write a parser, a render and put
in the html in another file? Or there is a easer way to do that?

What I want is just write some custom html components (inputs) with specific
behavior.

Any tips?

Thanks,
Rodrigo Gomes

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Multiple forms into one form/trouble accessing form fields

2011-06-15 Thread Alasdair Nicol

https://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms

Regards,
Alasdair

On 15/06/11 14:09, Thomas Weholt wrote:

I got several forms I need to display in one page and post to one
site. Actually, what I want to do is take all the fields from all the
forms and display them as one form and post all input to one view. To
avoid collision between the form fields I want to prefix the fields
somehow.

Say I got three forms:

class UserInputForm1(forms.Form):
 username = forms.CharField()
 password = forms.CharField()

class UserInputForm2(forms.Form):
 comment = forms.CharField()

class UserInputForm3(forms.Form):
 like = forms.BooleanField()

I want to put all fields, from all three forms, into one new form and
prefix each field so I know what form the field came from. How can I
do that? When I access the fields after creation it appears to be a
string.

An alternative to this is a FormWizard, but that makes the user click
thru a bunch of steps, which could be avoided if I could get all the
fields into one new form.




--
Alasdair Nicol
Developer, MEMSET

mail: alasd...@memset.com
 web: http://www.memset.com/

Memset Ltd., registration number 4504980. 25 Frederick Sanger Road, Guildford, 
Surrey, GU2 7YD, UK.

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Multiple forms into one form/trouble accessing form fields

2011-06-15 Thread Thomas Weholt
I got several forms I need to display in one page and post to one
site. Actually, what I want to do is take all the fields from all the
forms and display them as one form and post all input to one view. To
avoid collision between the form fields I want to prefix the fields
somehow.

Say I got three forms:

class UserInputForm1(forms.Form):
username = forms.CharField()
password = forms.CharField()

class UserInputForm2(forms.Form):
comment = forms.CharField()

class UserInputForm3(forms.Form):
like = forms.BooleanField()

I want to put all fields, from all three forms, into one new form and
prefix each field so I know what form the field came from. How can I
do that? When I access the fields after creation it appears to be a
string.

An alternative to this is a FormWizard, but that makes the user click
thru a bunch of steps, which could be avoided if I could get all the
fields into one new form.

-- 
Mvh/Best regards,
Thomas Weholt
http://www.weholt.org

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



How to display shp file data on an osm layer using django without using the databrowse widget ?

2011-06-15 Thread Satyajit Sarangi
I want to display the data that I have stored ,( Openlayers data ,
kml , shp file) data from postgis data on a openlayers/google map
template . How do I do 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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: My django admin page breaks up . Any reason why ?

2011-06-15 Thread Anoop Thomas Mathew
Hi Satyajit,

On 15 June 2011 16:19, Satyajit Sarangi  wrote:

> My django admin page some times breaks up . As in , initially it will
> show all the required tables in a nice columns , but suddenly the
> whole design breaks and the data shows up in random ways .
>


1. The page breaks up because admin css and js is not accessible, try
debugging the html and find if css and js is accessible. Else make it so.


>
> Also how to reset the django admin password ?
>
>
2. http://coderseye.com/2007/howto-reset-the-admin-password-in-django.html Hope
this one helps.



> --
> 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
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


regards,
Anoop

atm
___
Life is short, Live it hard.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



My django admin page breaks up . Any reason why ?

2011-06-15 Thread Satyajit Sarangi
My django admin page some times breaks up . As in , initially it will
show all the required tables in a nice columns , but suddenly the
whole design breaks and the data shows up in random ways .

Also how to reset the django admin password ?

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: unique constraint

2011-06-15 Thread Ivo Brodien
https://docs.djangoproject.com/en/1.3/ref/models/options/#unique-together

On Jun 15, 2011, at 9:40 AM, Tobias Ottenweller wrote:

> hi,
> 
> a had a look at the django documentation but I could not find a way to do 
> something like this in django:
> 
> 
> CREATE TABLE test_table (
>id integer,
>name text
> );
> 
> ALTER TABLE ONLY test_table
>ADD CONSTRAINT test_table_id_name_key UNIQUE (id, name);
> 
> 
> Is there a way to put a constraint like this in django model class?
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



unique constraint

2011-06-15 Thread Tobias Ottenweller

hi,

a had a look at the django documentation but I could not find a way to 
do something like this in django:



CREATE TABLE test_table (
id integer,
name text
);

ALTER TABLE ONLY test_table
ADD CONSTRAINT test_table_id_name_key UNIQUE (id, name);


Is there a way to put a constraint like this in django model class?

--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Djungo on Microsoft IIS

2011-06-15 Thread Yaroslav Govorunov
Hello!

We have recently developed a solution to install and run Django
applications on Microsoft IIS. Here is the link:  
http://www.helicontech.com/zoo/

Currently IIS 7, 7.5 and IIS Express are supported.  We expect to
demonstrate production level performance in this environment on
release. To use the solution you will need to install Web Platform
Installer, as shown on the page, then click on "Blank Django Project"
and after installation is completed overwrite this blank project with
a real one or start development from this point.

Please help us to beta-test our solution. We need to collect some
statistic on how real Django application is operating in IIS
environment.  Please direct either success or fail reports to
supp...@helicontech.com or tweet using #heliconzoo hashtag:
http://twitter.com/?status=%23heliconzoo


Thanks in advance!

Yaroslav Govorunov
Helicon Tech
http://www.helicontech.com

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Odp: Aw: Internationalization in Django.

2011-06-15 Thread Robert
What about django-datatrans ?

Had no problems with that.

RM.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/-wSxOnaLg2gJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Printing admin is strange except in Safari

2011-06-15 Thread Ivo Brodien
Hello,

I have an admin action which produces a table of selected items. I used the 
admin base_site template so I have the ability to go back easily.

I did:

{% extends "admin/base_site.html" %}

...

{% block content %}






{% for participant in participants %}
...
   {% endfor %}


The problem is that the table rows at the beginning of the page get printed 
over with the header from the admin on every page except the first one. I don’t 
know why the admin header gets printed on all of the pages anyways.

IE and Firefox are doing this.

The problem does not occur on Safari (tested on Mac only).

Does anyone know where this behavior come from and how to avoid it?

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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Using django floppy forms , how do I get the longitude and latitude of the point I clicked , or the line I draw ?

2011-06-15 Thread Satyajit Sarangi
I want to know how to get the latitude and logitiude of a point , or a
line that I marked on open layers using django floppy forms . It
returns the geom_id , but how do I get latitude and longitude out of
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-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-06-15 Thread Tom Evans
On Wed, Jun 15, 2011 at 5:40 AM, Chris Seberino  wrote:
>
> 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 aren't they worred?
>
> cs
>

Because to have a problem, you must have an attacker who is listening
to your line. It's not super-likely, but for some places (eg, my bank)
it is enough of a risk to use solely SSL. I'm not too concerned about
someone stealing my ebay session, but I'd be super-annoyed if they
stole my online banking session.

Actually, the main reason is that requiring SSL everywhere makes
browsing your site slow, there can be no intermediate caching, and you
can serve less users with each server than without SSL. More
expensive, slower and a worse user experience vs absolute security.
Your choice.

Cheers

Tom

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Moving Away from if/else Template Logic

2011-06-15 Thread bruno desthuilliers
On Jun 15, 5:04 am, Greg Corradini  wrote:
> 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 %}
>
(snip)

> I would like to move to something like this in the template:
>
> {{ x.message|regtest }}
>
> given this template filter:
>
> def regtest(value):
>     regex = re.compile(r'^\*\*(?P.*)\*\*')


Explicitly calling re.compile in this case is at best useless. Either
define your compiled regex object at the module level - so it's only
compiled once at load time - or don't bother compiling it at all (the
regex module keeps an internal cache of compiled expressions).


>     m = regex.match(value)
>     if m != None: return "%s"%value


None is garanteed to be a singleton, so the identity test will be
faster here (and is the canonical way to test against None FWIW)


>     else: return value


Useless one-liners are considered bad style in Python. Using
appropriate indentation helps wrt/ readability.

 if m != None:
 return "%s" % value
 else:
 return value


> However, the html tags returned from the filter becomes part of the
> element's text value instead of tags. So that's not working.

https://docs.djangoproject.com/en/1.3/howto/custom-template-tags/#filters-and-auto-escaping

Hardcoding markup in a filter is not a great idea IMHO, but YMMV...

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Authentication in API (REST)

2011-06-15 Thread Stuart MacKay

Malcolm,

oAuth also looks like a great solution - it was not as well developed 
when I last looked at REST authentication a couple of years ago. There 
is a lot of developer support now as well, http://oauth.net/code/, 
specifically https://github.com/simplegeo/python-oauth2


Stuart


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 
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 and the most secure but 
running a server with SSL is not the most trivial of tasks and there are issues 
for clients and the problems of managing certificates, etc. etc.

For a Java based REST API I used the scheme used by Amazon web services where 
the request is signed using a secret key and then authenticated on the server 
which worked rather well and was resistant against lots of different types of 
attack. You can find out more at 
http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?RESTAuthentication.html.
 However I am not sure what level of support you can find in django.

Stuart


Hi all, I'm newbie in Django, and I started to build my own API. I
know that there is Piston or Django REST framework, but I want to
learn API from scratch. What I want to know is, how to make my HTTP
Response (View) is perform authentication before can be accessed, or
we can make it have to throw username and password to access the HTTP
Response?

My code is very simple, like this one:
def test_api_view(request, whatever):
   #
   # do things
   #
   return HttpResponse(serializers.serialize("json", mydictionary),
mimetype='application/json')

Thank you.


--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



--
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: 2 projects based on the same codebase

2011-06-15 Thread Benedict Verheyen
On 14/06/2011 17:24, Stuart MacKay wrote:
> 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 with the limited ability for customization
> and the codebases began to diverge quickly.
> 
> Until you can get to the stage where you can factor out the common parts (not 
> always easy) into reusable apps  I would second the suggestion
> for separate projects. It seems like needless duplication (which it is to 
> some extent) but you easily avoid compatibility issues and then
> both projects are free to take whatever path works best.
> 
> Regards,
> 
> Stuart MacKay
> Lisbon, Portugal
> 

Hi Stuart,

thanks for link and the advise.
I've since split the code into 2 projects and so far, so good :)

Regards,
Benedict

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Get MAC from diferent fields

2011-06-15 Thread rat attack
Hi Jirka,
I say weird format because:
external_serial (contains 1 mac address)
mac_address (contains 2 mac adress)
computer_id (isn't a mac adress)

I will look up info to resolve this in pure Python like you said.
Thanks guys

On Jun 14, 4:15 pm, Jirka Vejrazka  wrote:
> 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 "weird format" ?
>
>   Cheers
>
>     Jirka

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



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

2011-06-15 Thread Mike Dewhirst
They should be worried. But the session id is not the  credentials. So it is 
probably argued that it is secure enough. 

However, you should google firesheep. That is a browser add-on which can hijack 
non-SSL sessions over unsecured wireless. 

Mike

On 15/06/2011, at 2:40 PM, Chris Seberino  wrote:

> 
> 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 aren't they worred?
> 
> cs
> 
> -- 
> 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 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.