Re: code revision short job

2012-01-03 Thread Satyajit Sarangi
Little more details.

On Tue, Jan 3, 2012 at 2:43 PM, pixelfields <pixelfie...@gmail.com> wrote:

> Hi,
> I'm loooking for anybody who can review application code in easy app
> based on django 1.3 and postgres.
>
> Thanks
>
> Dusan Simek
>
> --
> 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.



How to iterate over a formset?

2011-11-10 Thread Satyajit Sarangi
This is my forms.py:

from django import forms
from django.forms.formsets import formset_factory

class CodeForm(forms.Form):
code = forms.CharField(widget = forms.Textarea)


CodeFormSet = formset_factory(CodeForm, extra = 5)



How do I iterate over the data?
I tried this:
if request.method == 'POST':
formset = CodeFormSet(request.POST)
if formset.is_valid():
for forms in formset:
   data =
forms.cleaned_data["code"]

This still didn't give me the answer. Data came out to be null. What
can be the 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.



Viewing file-upload in django admin site. How to do it?

2011-10-23 Thread Satyajit Sarangi
This is my models.py

from django.db import models

# Create your models here.

class Question(models.Model):
question_name = models.CharField(max_length=200)
question_type = models.CharField(max_length=20)
def __unicode__(self):
return self.question_name


class PythonQuestion(models.Model):
question_no = models.ForeignKey(Question)
question_text = models.TextField(max_length=1000)
question_testcase = models.TextField(max_length=1000)
question_difflevel = models.CharField(max_length=20)
def __unicode__(self):
return self.question_name


I'm viewing the fields via django-admin site. What I want to do :-

1. Upload a text file via django admin site.
2. Read its contents.
3. Serialize it into JSON and store it in the question_testcase field.

I know how to upload a file in django but not for django-admin site.

-- 
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 link custom search with a view in a different app ?

2011-06-27 Thread Satyajit Sarangi
# Create your views here.

from shapes.models import *
from openmaps.models import *


from django.shortcuts import render_to_response
from django.contrib.gis.shortcuts import render_to_kml
from openmaps.models import Open_Layers
from django import forms
from openmaps.forms import GeoForm
from django.contrib.gis.geos import  GeometryCollection,
MultiPolygon,  Polygon
from openmaps.forms import ReadOnlyForm
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from mapsearch.forms import SearchForm
from OsmMap.models import OsmLayers
from maps.models import Sdr_Layer

def map_search(request):
 lcount = Open_Layers.objects.all()

 form = SearchForm()
 if request.method == 'POST':
form = SearchForm(request.POST)
if form.is_valid():
data = form.cleaned_data
val=form.cleaned_data['LayerName']

a=OsmLayers()
b=Open_Layers()
c=Sdr_Layer()
data = []
data1=[]
data2=[]
data3=[]
data1 = 
OsmLayers.objects.filter(Layername__icontains=val)
data2 = 
Open_Layers.objects.filter(Layer_name__icontains=val)
data3 = 
Sdr_Layer.objects.filter(layer_name__icontains=val)
data.append(data1)
data.append(data2)
data.append(data3)

return render_to_response('searchresult.html', 
{'data':data})



else:
form = SearchForm()
 else:
return render_to_response('mapsearch.html', {'form':form})


This is my view that returns the search data to searchresult.html .
>From searchresult.html , all the returned data , when clicked on
should take it to a view called map_disp directly from the template .

I have read through the documentation , and this is what I inferred .

1. Pass the primary key id as a number to the map_disp view and then
use it to retrieve the date .
2. Change the urls.py so that the number is captured .

Where my doubt is this , what changes needs to be done in the view
code that I have shown here so that the number is sent .

-- 
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.



Error while trying to link up to a view from search results in a template .

2011-06-23 Thread Satyajit Sarangi
My views.py is this

def map_display(request):
 if request.method == 'POST':
form = DispForm(request.POST)
if form.is_valid():
this_user = request.user
user1= this_user.pk
LName = form.cleaned_data['LayerName']
a = OsmLayers()
a = OsmLayers.objects.get(Layername=LName)
uperm = PermiLayer()
perml=uperm.objects.get(user_id__exact=pk,table=a.pk)
if perml.permi == "100":

lcount = OsmLayers()
lcount= OsmLayers.objects.get(pk=tab_id)
form1 = 
ReadOnlyForm(initial={"geomcollection":
lcount.geompoly})

return 
render_to_response('Osmdisplay.html',
{'form':form1})
if perml.permi == "110":
lcount = OsmLayers()
lcount= OsmLayers.objects.get(pk=a.pk)
form1 = 
WriteOnlyForm(initial={"geomcollection":
lcount.geompoly})
return render_to_response('Osmmaps.html', 
{'form':form})


I am linking to it from a template which generates search data like
this




{% block content %}


{% for d in data %}

{% url osmdisp arg=d  as the_url %}
{{d.Layername}}

{% endfor %}
{% endblock %}

What I want to do is pass the d.Layername to the view so that it can
be used there .
But , it is just linking me back to the old mapsearch.html

-- 
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 add this particular url in my template ?

2011-06-23 Thread Satyajit Sarangi
This is the url http://127.0.0.1:8000/admin/maps/test/  .

When I click on a link on a particular template , it should take me
there . How do I manage it ?
The reason why I am asking is this is in the admin .

-- 
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 use the foreign key to get the exact row of that particular table ?

2011-06-23 Thread Satyajit Sarangi
My models.py is this

class PermiLayer(models.Model):
user = models.ForeignKey(User)
table = models.ForeignKey(ContentType)
permi = models.IntegerField()

My views.py is this

perm.table =
ContentType.objects.get(app_label="OsmMap",model="osmlayers")

Perm.table is storing an integer . How do I use that integer , and get
a row of osmlayers ?

-- 
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: What would be a better views.py code to achieve this particular task .

2011-06-23 Thread Satyajit Sarangi
I'm afraid I can't help you any further on this, as I don't know enough
about the contenttypes framework, and I still don't really understand what
it is you are asking.

Cal



I got it fixed . Now I have smaller issue . Foreign key ( of a particular
model) is returning me a table_id with some random integer value . How do I
use that to actually access the table .

As in , in another app , how do I know an integer 34 refers to a particular
row of the table from which the foreign key has been taken

Satyajit
On Fri, Jun 24, 2011 at 2:40 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Again, please keep your replies on-list.
>
> I'm afraid I can't help you any further on this, as I don't know enough
> about the contenttypes framework, and I still don't really understand what
> it is you are asking.
>
> Cal
>
>
> On Thu, Jun 23, 2011 at 10:07 PM, Satyajit Sarangi <
> writetosatya...@gmail.com> wrote:
>
>> I am not saying what is a query set error . I am saying , why am I getting
>> such an error , when in the documentation it is mentioned that the exact
>> query works .
>>
>> On Fri, Jun 24, 2011 at 2:35 AM, Cal Leeming [Simplicity Media Ltd] <
>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>
>>> Please keep your replies on-list so others may benefit in the future.
>>>
>>> On Thu, Jun 23, 2011 at 10:01 PM, Satyajit Sarangi <
>>> writetosatya...@gmail.com> wrote:
>>>
>>>> First of all , when I am doing this
>>>> perm.table =
>>>> ContentType.objects.get(app_label="OsmMap",model="Osm_Layers") I am getting
>>>> a content type matching query doesnt exist error .
>>>>
>>>
>>> I personally don't ever use the contenttypes framework (at least not
>>> directly), so I can't help you here.
>>>
>>>
>>>>
>>>> In another app , in its views . I have done this
>>>>
>>>> tab_id = 3
>>>> this_user = request.user
>>>> user1= this_user.pk
>>>> uperm = PermiLayer()
>>>> a=uperm.objects.get(user_id__exact=pk,table_id_exact=tab_id)
>>>> if a.permi == 3:
>>>>lcount = Osm_Layers()
>>>>   lcount= Osm_Layers.objects.get(pk=tab_id)
>>>>   form1 = ReadOnlyForm(initial={"geomcollection":
>>>> lcount.geom_poly})
>>>>
>>>>
>>>> What I am doing here is this , I am checking if the table_ id and the
>>>> user_id that has logged in has a certain permission . Permission can be any
>>>> number , and thus a certain user on a certain table can have 3 , 2 or/and 1
>>>> as permission . Thus it would repeat itself . Thus , how do I query the db
>>>> better than my present view . And also , what is the query set error?
>>>>
>>>
>>> If you are encountering any condition where data is repeating where it
>>> shouldn't, then I'd say there is a fault in your logic.
>>>
>>> Also, what do you mean by "what is the query set error"?
>>>
>>>
>>>>
>>>> On Fri, Jun 24, 2011 at 2:27 AM, Cal Leeming [Simplicity Media Ltd] <
>>>> cal.leem...@simplicitymedialtd.co.uk> wrote:
>>>>
>>>>> **
>>>>> You're going to have to explain this a lot better, because I really did
>>>>> not understand what you mean.
>>>>>
>>>>> At a *GUESS*, are you trying to prevent against db save race conditions
>>>>> or something??
>>>>>
>>>>> Please clarify.
>>>>>
>>>>> Cal
>>>>>
>>>>>
>>>>> On 23/06/2011 20:07, Satyajit Sarangi wrote:
>>>>>
>>>>> This is my models.py of a different app .
>>>>>
>>>>>
>>>>> class PermiLayer(models.Model):
>>>>> user = models.ForeignKey(User)
>>>>> table = models.ForeignKey(ContentType)
>>>>> permi = models.IntegerField()
>>>>>
>>>>>
>>>>> In another app's views , I am accessing a form that has given me a
>>>>> username .
>>>>>
>>>>> I have to check in PermiLayer model if the username along with the
>>>>> table id match in it and return back the data in permi .
>>>>>
>>>>> The problem here is , User + table can be present multiple times , as
>>>>> 

Content type returns this :ContentType matching query does not exist.

2011-06-23 Thread Satyajit Sarangi
My views.py is this
if k == 3:

perm = PermiLayer()
perm.user = user

perm.permi = k
if int(rad4) == 0:
perm.table =
ContentType.objects.get(app_label="OsmMap",model="Osm_Layers")
else :
perm.table =
ContentType.objects.get(app_label="openmaps",model="Open_Layers")

perm.save()
return render_to_response('permgiven.html', {'val':k})


My traceback is this


Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/
decorators.py" in _wrapped_view
  23. return view_func(request, *args, **kwargs)
File "/home/satyajit/geodjango/geographic_admin/permissions/views.py"
in PermLayer
  43.   perm.table =
ContentType.objects.get(app_label="OsmMap",model="Osm_Layers")
File "/usr/local/lib/python2.6/dist-packages/django/db/models/
manager.py" in get
  132. return self.get_query_set().get(*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/db/models/
query.py" in get
  349. % self.model._meta.object_name)

Exception Type: DoesNotExist at /permissions/
Exception Value: ContentType matching query does not exist.


what can be the 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.



What would be a better views.py code to achieve this particular task .

2011-06-23 Thread Satyajit Sarangi
This is my models.py of a different app .


class PermiLayer(models.Model):
user = models.ForeignKey(User)
table = models.ForeignKey(ContentType)
permi = models.IntegerField()


In another app's views , I am accessing a form that has given me a
username .

I have to check in PermiLayer model if the username along with the
table id match in it and return back the data in permi .

The problem here is , User + table can be present multiple times , as
in the same user and and table id .

What I am doing in my code is , do an object.get.all with a filter of
the username and table id that I have on Permilayer . But ,
object.get.all , as I have read , might just freeze my database , or
slow it down considerably . Is there a faster/better way to 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.



I have two doubts when It comes to django url and django templates . Please help

2011-06-23 Thread Satyajit Sarangi
{% extends "base.html" %}

{% load i18n %}
Hello User {{user}}
{% block content %}
{% if form.errors %}
{% trans "Sorry there are corrections needed
in your form below:" %} {{ form.non_field_errors }}
{% endif %}
{% if form.is_multipart %}

Hello User {{user}}
{% else %}

   {% endif %}
   {{ form.as_p }}
   
   
{% endblock %}

This is a template of mine . It is not displaying Hello User . What
can be the error ?


The other doubt is this .


Create a map with OsmMap as
baselayer This is a link on one of my templates .
Osmmaps.html is a template that displays a form comprising of a OSM
layers .

Both are in different apps .

Thus when I try to link it , this is the error I get
Reverse for 'Osmmaps' with arguments '()' and keyword arguments '{}'
not found.


I am very new to django , and am finding the django documentation on
the url a bit too difficult . Do help

-- 
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.



Haystack No site conf error . How to debug ?

2011-06-23 Thread Satyajit Sarangi
This is my settings.py

# Django global settings

# This allows us to construct the needed absolute paths dynamically,
# e.g., for the GIS_DATA_DIR, MEDIA_ROOT, and TEMPLATE_DIRS settings.
# see: http://rob.cogit8.org/blog/2008/Jun/20/django-and-relativity/
import os
GEOGRAPHIC_ADMIN_DIR = os.path.dirname(__file__)

# http://docs.djangoproject.com/en/dev/topics/testing/#id1
# Your user must be a postgrest superuser
# Avoid specifying your password with: ~/.pgpass
# http://www.postgresql.org/docs/8.3/interactive/libpq-pgpass.html
TEST_RUNNER='django.contrib.gis.tests.run_gis_tests'

DEBUG=True

ADMINS = (
# ('Your Name', 'your_em...@domain.com'),
)

DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'geoadmin'
DATABASE_USER = 'postgres' # make sure to change this to your postgres
user
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''

# Not used at this point but you'll need it here if you
# want to enable a google maps baselayer within your
# OpenLayers maps
GOOGLE_MAPS_API_KEY='abcdefg'

SHP_UPLOAD_DIR = r"/home/satyajit/geodjango/geographic_admin/data"
GIS_DATA_DIR = os.path.join(GEOGRAPHIC_ADMIN_DIR, 'data')

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/Vancouver'

SITE_ID = 1

USE_I18N = True

MEDIA_ROOT = os.path.join(GEOGRAPHIC_ADMIN_DIR, 'media')

MEDIA_URL = '/media/'

HAYSTACK_SITECONF='geographic_admin.search_sites'

HAYSTACK_SEARCH_ENGINE = 'xapian'
HAYSTACK_WHOOSH_PATH = '/home/satyajit/geodjango/geographic_admin/
xapian-index'


ADMIN_MEDIA_PREFIX = '/admin_media/'
LOGIN_REDIRECT_URL = '/accounts/profile/'
SECRET_KEY = '2f!vq4!f)u#g-sk7_=z+i0e(o0o$f%hvpb^vd'
LOGIN_URL='/accounts/login/'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
)

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
TEMPLATE_CONTEXT_PROCESSORS += (
 'django.core.context_processors.request',
 'django.core.context_processors.debug',
 'django.core.context_processors.i18n',
 'django.core.context_processors.media',
 'django.core.context_processors.static',
 'django.contrib.auth.context_processors.auth',
 'django.contrib.messages.context_processors.messages',

)
AUTH_PROFILE_MODULE = 'userprofile.profile'
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
)

ROOT_URLCONF = 'urls'
STATIC_URL = '/static/'
STATIC_ROOT = "/home/satyajit/geodjango/geographic_admin/sitestatic"

if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'

TEMPLATE_DIRS = (
os.path.join(GEOGRAPHIC_ADMIN_DIR, 'templates'),
os.path.join(GEOGRAPHIC_ADMIN_DIR, '../registration/templates'),

# Don't forget to use absolute paths, not relative paths.
)

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.databrowse',
'django.contrib.gis',
'django.contrib.staticfiles',
'world',
'maps',
'shapes',
'registration',
'waypoints',
'openmaps',
'permissions',
'floppyforms',
'OsmMap',
'userprofile',
'mapsearch',
'haystack',

)

ACCOUNT_ACTIVATION_DAYS=7
EMAIL_HOST='localhost'
EMAIL_PORT=1023
EMAIL_HOST_USER='username'
EMAIL_HOST_PASSWORD='password'

The error I get is this
  raise ImproperlyConfigured('The HAYSTACK_SITECONF setting is no
longer used & can be removed.')
django.core.exceptions.ImproperlyConfigured: The HAYSTACK_SITECONF
setting is no longer used & can be removed.

The error when I remove HAYSTACK_SITECONF is this
django.core.exceptions.ImproperlyConfigured: The
HAYSTACK_SEARCH_ENGINE setting has been replaced with
HAYSTACK_CONNECTIONS.

-- 
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.



create_inactive_user() got an unexpected keyword argument 'profile_callback' Error in django registration . What can be the error ?

2011-06-23 Thread Satyajit Sarangi
This is my stack trace .

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/
base.py" in get_response
  111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/registration/views.py" in
register
  144. new_user =
form.save(profile_callback=profile_callback)
File "/usr/local/lib/python2.6/dist-packages/registration/forms.py" in
save
  88.send_email = False)
File "/usr/local/lib/python2.6/dist-packages/django/db/transaction.py"
in inner
  217. res = func(*args, **kwargs)

Exception Type: TypeError at /accounts/register/
Exception Value: create_inactive_user() got an unexpected keyword
argument 'profile_callback'


How to get rid of this 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.



Re: how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
Now I get a database error

relation "registration_userprofile" does not exist
LINE 1: ..."."id", "registration_userprofile"."user_id" FROM "registrat...



On Wed, Jun 22, 2011 at 8:58 PM, Shawn Milochik <sh...@milochik.com> wrote:

> On 06/22/2011 11:25 AM, Satyajit Sarangi wrote:
>
>> Traceback:
>>
>>  60.url(r'^profile/$',UserProfile,**
>> name='UserProfile'),
>>
>> Exception Type: NameError at /accounts/profile/
>> Exception Value: name 'UserProfile' is not defined
>>
>>
> It appears that you have a view named UserProfile in your views.py but it's
> not imported into urls.py, so you get the 'is not defined' message.
>
>
> --
> 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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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 to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py"
in get_response
  101. request.path_info)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  252. sub_match = pattern.resolve(new_path)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
resolve
  250. for pattern in self.url_patterns:
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
_get_url_patterns
  279. patterns = getattr(self.urlconf_module, "urlpatterns",
self.urlconf_module)
File "/usr/local/lib/python2.6/dist-packages/django/core/urlresolvers.py" in
_get_urlconf_module
  274. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.6/dist-packages/django/utils/importlib.py" in
import_module
  35. __import__(name)
File "/usr/local/lib/python2.6/dist-packages/registration/urls.py" in

  60.
 url(r'^profile/$',UserProfile,name='UserProfile'),

Exception Type: NameError at /accounts/profile/
Exception Value: name 'UserProfile' is not defined

On Wed, Jun 22, 2011 at 8:52 PM, Shawn Milochik <sh...@milochik.com> wrote:

> On 06/22/2011 11:21 AM, Satyajit Sarangi wrote:
>
>> These are my steps .
>> 1. Not using django-profile
>> 2. Create my own view to show the profile by using user.get_profile()
>> 3. Created my own view and also a model in django-registration to view the
>> profile .
>> 4 . Did changes to urls.py  url(r'^profile/$',register.**
>> UserProfile,name='user.get_**profile()'),
>>
>> But this is giving me an error here .
>>
>>
> What's the error? Please provide the full stack trace.
>
>
> --
> 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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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 to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
These are my steps .
1. Not using django-profile
2. Create my own view to show the profile by using user.get_profile()
3. Created my own view and also a model in django-registration to view the
profile .
4 . Did changes to
urls.py  url(r'^profile/$',register.UserProfile,name='user.get_profile()'),

But this is giving me an error here .

On Wed, Jun 22, 2011 at 8:48 PM, Piotr Zalewa <zal...@gmail.com> wrote:

> On 06/22/11 16:09, Satyajit Sarangi wrote:
>
>> I am using django registration , which is not displaying any profile
>> when I log in . Thus I am not able to login . What should I do to
>> overcome this ?
>>
>>
> I assume you've been reading docs already. (django-registration and django
> user management ones, possibly also the django first project tutorial).
> Could you provide which steps you've already taken?
>
> zalun
>
> --
> 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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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.



how to set up user profile in django-registration ?

2011-06-22 Thread Satyajit Sarangi
I am using django registration , which is not displaying any profile
when I log in . Thus I am not able to login . What should I do to
overcome this ?

-- 
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 to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
Yes I know thats the problem . But , want to know whats the way out .

On Tue, Jun 21, 2011 at 7:52 PM, Piotr Zalewa <zal...@gmail.com> wrote:

> In urls.py you've got:
>   url(r'^accounts/', include('registration.urls')),
>
> and later:
>(r'^accounts/', include('userprofile.urls')),
>
> /me is no expert, but that smells like asking for trouble.
>
> zalun
>
>
>
> On 06/21/11 14:48, Satyajit Sarangi wrote:
>
>> I am using 1.3
>> This is my settings.py
>> http://dpaste.com/556954/
>>
>> This is my urls.py
>> http://dpaste.com/556955/
>>
>> On Tue, Jun 21, 2011 at 7:14 PM, Piotr Zalewa <zal...@gmail.com
>> <mailto:zal...@gmail.com>> wrote:
>>
>>On 06/21/11 14:15, Satyajit Sarangi wrote:
>>
>>
>> https://bitbucket.org/__**ubernostrum/django-__**registration<https://bitbucket.org/__ubernostrum/django-__registration>
>>
>> <https://bitbucket.org/**ubernostrum/django-**registration<https://bitbucket.org/ubernostrum/django-registration>>
>> This is
>>what I
>>am using for user registration . Once , I log in the user is not
>>able
>>to get into the userprofile page .
>>
>>Thus I installed this
>>
>> https://bitbucket.org/__**ubernostrum/django-profiles/<https://bitbucket.org/__ubernostrum/django-profiles/>
>>
>> <https://bitbucket.org/**ubernostrum/django-profiles/<https://bitbucket.org/ubernostrum/django-profiles/>
>> >
>>for user profile .
>>
>>
>>Recent commits were done 2 years ago.
>>Which version of Django do you use?
>>
>>
>>
>>Now , this produces a conflict in urls.py and also settings.py
>>file .
>>
>>
>>Would you provide any errors?
>>
>>
>>How to resolve it . What changes needs to be done with urls.py and
>>settings.py so that , when a user logs in , he/she is redirected to
>>the profile page .
>>
>>
>>How your current urls.py and settings.py do look like?
>>Please use some dpaste or similar sites.
>>
>>zalun
>>
>>
>>--
>>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
>><mailto:django-users@**googlegroups.com<django-users@googlegroups.com>
>> >.
>>
>>To unsubscribe from this group, send email to
>>django-users+unsubscribe@__goo**glegroups.com<http://googlegroups.com>
>>
>> <mailto:django-users%**2bunsubscr...@googlegroups.com<django-users%252bunsubscr...@googlegroups.com>
>> **>.
>>
>>For more options, visit this group at
>>
>> http://groups.google.com/__**group/django-users?hl=en<http://groups.google.com/__group/django-users?hl=en>
>>
>> <http://groups.google.com/**group/django-users?hl=en<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+unsubscribe@**googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/**group/django-users?hl=en<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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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 to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
I am using 1.3
This is my settings.py
http://dpaste.com/556954/

This is my urls.py
http://dpaste.com/556955/

On Tue, Jun 21, 2011 at 7:14 PM, Piotr Zalewa <zal...@gmail.com> wrote:

> On 06/21/11 14:15, Satyajit Sarangi wrote:
>
>> https://bitbucket.org/**ubernostrum/django-**registration<https://bitbucket.org/ubernostrum/django-registration>This
>>  is what I
>> am using for user registration . Once , I log in the user is not able
>> to get into the userprofile page .
>>
>> Thus I installed this https://bitbucket.org/**
>> ubernostrum/django-profiles/<https://bitbucket.org/ubernostrum/django-profiles/>
>> for user profile .
>>
>
> Recent commits were done 2 years ago.
> Which version of Django do you use?
>
>
>
>> Now , this produces a conflict in urls.py and also settings.py file .
>>
>
> Would you provide any errors?
>
>
>  How to resolve it . What changes needs to be done with urls.py and
>> settings.py so that , when a user logs in , he/she is redirected to
>> the profile page .
>>
>
> How your current urls.py and settings.py do look like?
> Please use some dpaste or similar sites.
>
> zalun
>
>
> --
> 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+unsubscribe@**
> googlegroups.com <django-users%2bunsubscr...@googlegroups.com>.
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en<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.



How to use django-profile with django registration ?

2011-06-21 Thread Satyajit Sarangi
https://bitbucket.org/ubernostrum/django-registration This is what I
am using for user registration . Once , I log in the user is not able
to get into the userprofile page .

Thus I installed this https://bitbucket.org/ubernostrum/django-profiles/
for user profile .

Now , this produces a conflict in urls.py and also settings.py file .

How to resolve it . What changes needs to be done with urls.py and
settings.py so that , when a user logs in , he/she is redirected to
the profile page .

-- 
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 to send the class name from one template to another template both in different apps in django ?

2011-06-21 Thread Satyajit Sarangi
Lets say one template helps me in uploading a file . When I go to an app
called permissions , directly from that template . I want to carry that file
name with me , so that I can assign permissions to it .

On Tue, Jun 21, 2011 at 5:39 PM, Andre Terra <andrete...@gmail.com> wrote:

> It seems you have an issue and you are asking for help on making your
> solution work, when you should be telling us what it is that you want
> to do. Only then will we be able to advise you.
>
> Sincerely,
> Andre Terra
>
> On 6/20/11, Satyajit Sarangi <writetosatya...@gmail.com> wrote:
> > Lets say I work on a class in one template by a certain view . There
> > is a link on that template , that takes  me to another template in a
> > different app , where I would like to add certain permissions to that
> > particular class_id that I just saved in this app . How do I do that ?
> >
> > --
> > 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.
> >
> >
>
> --
> Sent from my mobile device
>
> --
> 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.



How do I create dynamic django models ?

2011-06-21 Thread Satyajit Sarangi
I went through this link , but couldn't really understand where to put
where . A little more help as to how to go about it would be very
helpful .
https://code.djangoproject.com/wiki/DynamicModels

-- 
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 send the class name from one template to another template both in different apps in django ?

2011-06-20 Thread Satyajit Sarangi
Lets say I work on a class in one template by a certain view . There
is a link on that template , that takes  me to another template in a
different app , where I would like to add certain permissions to that
particular class_id that I just saved in this app . How do I do that ?

-- 
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 view the data of a shape file without using the databrowse admin ?

2011-06-17 Thread Satyajit Sarangi
I don't want to use django databrowse admin . Want to create my own
template and view that allows user to view a shapefile stored in the
database . And also view open layers data and OSM data stored in
database . 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: django.db.utils.IntegrityError: null value in column “layer_id_id” violates not-null constraint . How to debug ?

2011-06-16 Thread Satyajit Sarangi
What I want is a very simple thing .
I want the primary key of Sdr_Layer to be the foreign key of Test table .
How do I manage it ?
And , I am assigning values to Test via Layermapping tool , which as you
said that passes a dict .

I think the problem here is the layermapping tries to map onto the Test
model , but doesn't know what to do about the layer_id  . Thats what I think
. Not sure . What can be the way out ?

On Thu, Jun 16, 2011 at 2:19 PM, Daniel Roseman <dan...@roseman.org.uk>wrote:

> On Wednesday, 15 June 2011 22:25:24 UTC+1, Satyajit Sarangi wrote:
>>
>> 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 ?
>
>
>
> On Wednesday, 15 June 2011 22:25:24 UTC+1, Satyajit Sarangi wrote:
>>
>> 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 need to think things through a bit more carefully. It seems like you're
> randomly assigning things without really having any idea of what you're
> doing.
>
> This code:
> S = Sdr_Layer(layer_name="Test")
> instantiates a new Sdr_Layer object, with the name "Test".
>
> This line:
> S.layer_attribute_name=test_mapping
> tries to do something very strange, which is to assign a dictionary to your
> CharField. You can do that, but it will be converted to a string on save.
>
> Now, none of this code would throw a "not_null error on layer_id", because
> layer_id is a field on the Test model, which you don't even use in this
> code. So, there must be code you're not showing us. Also, there is a reason
> why Python prints the full traceback on an error: it's useful debugging
> information, not random cruft. Post it too.
>
> FWIW, I suspect you wanted to do this:
>
> t = Test(**layer_mapping)
> t.layer_id = S
> t.save()
> --
> DR.
>
>  --
> 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/-/mELn7nUrAOMJ.
> 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 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 <sh...@milochik.com> 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.



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 <sh...@milochik.com> 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.



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.



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.



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.



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.



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.



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 file using the databrowse admin ?

-- 
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.



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 django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from maps.models import  Sdr_Layer

class PermiLayer(models.Model):
user = models.ForeignKey(User)
table =
models.ForeignKey(ContentType,related_name='custom_permission_set')
permi = models.IntegerField()



My view logic is this

if form.is_valid():
data = form.cleaned_data
rad1=form.cleaned_data['radio1']
rad2=form.cleaned_data['radio2']
user=User.objects.get(username = data['user'])

perm = PermiLayer()
perm.user = user
perm.table = user_type =
ContentType.objects.get_for_model('maps_parking')
perm.permi = rad1 + rad2
perm.save()

This gives me the error that I have mentioned above . How do I change
the model and the view to remove the 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.



How to display a shape file in open layers as a separate app without using geodjango ?

2011-06-13 Thread Satyajit Sarangi
I want to display a shape file stored in my database without in django
by using open layers without using databrowse admin . I assume I have
to export the data as JSON onto a shapefile . I would like to know how
to 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.



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

2011-06-13 Thread Satyajit Sarangi
My template has radio buttons . I would like to know what exactly be
there in forms.py to render this template in the views ?

This is my tempalte



Username:
   

Who can view the data 

 Any
registered users
 Only users that can edit


 Who can edit the data 

 Any
registered user

Only the following users

-- 
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.