'module' object has no attribute 'urlpatterns'

2013-10-28 Thread abhijeet shete
Hi Folks,

I have developed one app say "XYZ" and I am using it in my django
project as symblik link.
I am trying to access urlpatterns in urls.py module from django project in
my "XYZ" app as

*from django.conf import settings*
*  from importlib import import_module
*
**
*  root_urls = import_module(settings.ROOT_URLCONF)*
*
*
*  url_patterns = root_urls.urlpatterns*
*
*
*
*
But I am getting this error

*'module' object has no attribute 'urlpatterns'*


. My qustion is how can I access urlpatterns from django project in my
"XYZ" app. I can't directly import urls module from django project in my
app because it is independent or I don't have direct access to urls module.


Any help will be highly appreciated. Thanks in advance.

Thanks and Regards.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN5zVLOHxrHEMNVjzJKJCkY2zXkiocaLux9zuaD51pmdhqpWLg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: hello everyone error in python

2013-08-23 Thread abhijeet shete
Hi,

Please provide more details about the error.
Like what you are trying to do or which part of your code is raising
this error ?


On Fri, Aug 23, 2013 at 3:24 PM, Shru  wrote:

> error :'str' object is not callable
>
> error location :C:\Python27\lib\site-packages\django\core\handlers\base.py
> in get_response, line 115
> so help me to fix it
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


AttributeError: '__proxy__' object has no attribute 'decode'

2013-08-13 Thread abhijeet shete
Hi Folks,

I implemented one independent django app with python 2.7. I ported it
to python 3 from python 2.7 using 2to3 module. I created egg of this app
using setuptools and using it in another django project with version 1.5.1
of django.
Some of my view functions are using HttpResponseRedirect with
reverse_lazy as first argument where reverse_lazy takes named_url as first
argument. These functions was working fine before porting with django 1.4.3
and python 2.7 but now I am getting *AttributeError* after porting to
python 3.

My view function is :

*   * *HOME_URL = reverse_lazy('auth_home')**
*
*   def logout_user(request):*
*"""*
*Logs-out the user and redirects to login page.*
*"""*
*logout(request)*
*return HttpResponseRedirect(HOME_URL)*
*
*
*
*
The error which I gets when I tries to access this view function is:


*File
"env/lib/python3.2/site-packages/TestProject-0.2-py3.2.egg/auth/views.py",
line 123, in login_user
*
*return HttpResponseRedirect(HOME_URL)*
*File env/lib/python3.2/site-packages/django/http/response.py", line
388, in __init__*
*parsed = urlparse(redirect_to)*
*File "lib/python3.2/urllib/parse.py", line 292, in urlparse*
*url, scheme, _coerce_result = _coerce_args(url, scheme)*
*File "lib/python3.2/urllib/parse.py", line 112, in _coerce_args*
*return _decode_args(args) + (_encode_result,)*
*File "lib/python3.2/urllib/parse.py", line 96, in _decode_args*
*return tuple(x.decode(encoding, errors) if x else '' for x in args)
*
*File "lib/python3.2/urllib/parse.py", line 96, in *
*return tuple(x.decode(encoding, errors) if x else '' for x in args)
*
*AttributeError: '__proxy__' object has no attribute 'decode'*


Any help will be highly appreciated.


Thanks and regards.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




ImportError: No module named 'exceptions' - Python3

2013-08-11 Thread abhijeet shete
Hi Folks,

I ported my project from python2.7 to python3 using 2to3 module. One of
my class is inherited from Exception class, but after porting to python3 i
am getting *No module named 'exceptions'  *error.

My class looks something like this :-

*from exceptions import Exception*
*class A(Exception):*
*def __init__(self, value=None):*
*self.value = value*
*
*
And the error which I am getting is
*
*
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named 'exceptions'


I tried to import exceptions in python3 shell but there also I am getting
same error.
Is there any problem with my code or did I missed something while porting
or python3 itself has some problem while importing exceptions ?


Thanks and Regards.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Query Set and Output

2013-08-07 Thread abhijeet shete
Hi,

If you tries to access values from list using slice it returns you the
subset of list not a single value.The query *(*Excuse.objects.order_by('?')*
)* from your view returns a list and you are trying to access values from
that list using slice which in turn returns subset of list and because of
it when your trying to display output in template it is displaying as list.
If you want single object use index instead of slice for example if you
want 1st object from list then
   outout = Excuse.objects.order_by('?')[0]

This will return single object of Excuse.

In your template if you want to display only text from Excuse then use
*output.
*in this case your fieldname is text so use *output.text *instead of just *
output*.



   {{ output.text }} 




Regards.
Abhijeet Shete
Software Engineer | mquotient |  Mobile +91.9860219715


On Wed, Aug 7, 2013 at 2:30 PM, Muhammed TÜFEKYAPAN
wrote:

> It looks like this:
>
> 
>
>{{ output }} 
>
> 
>
> On Wednesday, August 7, 2013 6:58:17 AM UTC+3, Bulkan-Savun Evcimen wrote:
>
>> Hi there,
>>
>> What does your template index.html look like ?
>>
>> Cheers
>>
>> http://bulkan-evcimen.com
>>
>>
>> On Wed, Aug 7, 2013 at 1:19 PM, Muhammed TÜFEKYAPAN 
>> wrote:
>>
>>> Hello everyone,
>>>
>>> I write a basic model in django 1.5.1
>>>
>>> My model is looks like this:
>>> class Excuse(models.Model):
>>> text = models.CharField(max_length=**300)
>>>
>>> def __unicode__(self):
>>> return self.text
>>>
>>> And i have a basic function to get random excuse from this model.
>>>
>>> def home(request):
>>> output = Excuse.objects.order_by('?')[:**1]
>>> template = loader.get_template('index.**html')
>>> context = {'output': output}
>>> return HttpResponse(output)
>>>
>>> If i write my view looks like above everything works well. I get a
>>> random excuse and write it on the page. But when i change this like this:
>>>
>>> def home(request):
>>> output = Excuse.objects.order_by('?')[:**1]
>>> template = loader.get_template('index.**html')
>>> context = {'output': output}
>>> return render(request, 'index.html', context)
>>>
>>> I get output like this: []
>>> i just want to blabla section and how i get away from  []
>>>
>>>
>>> Thanks for all!
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@**googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>>
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users<http://groups.google.com/group/django-users>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>>
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Unable to open database.

2013-07-25 Thread abhijeet shete
Hi Nigel

You have just given the path of db but you need to mention db name in
the DATABASES field of settings file.


>
> 'NAME': '/myproject/database/sqlite3',
>

  'NAME': '/myproject/database/sqlite3/example.db',

Regards.
Software Engineer | mquotient |  Mobile +91.9860219715

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: forloop breaking

2013-06-27 Thread abhijeet shete
Hi,

You can achieve this by using javascript or jquery. Just check this
example : http://jsfiddle.net/pxbW9/


I want to remove the static heading of a table in django templates in
> which the data is coming form database which is dynamic so I want if
> there is no entry in that column it should not display even its
> heading by any means with html, in python.
>


Regards.
Abhijeet Shete
Software Engineer | mquotient |  Mobile +91.9860219715

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django import error (Please reply soon)

2013-06-20 Thread abhijeet shete
Hi Sanju,

Whenever you create any app in django you need to add that app's name
under INSTALLED_APPS in settings.py file. It looks like you commented that
line on which you added the name of app(myapp) under INSTALLED_APPS in your
settings file. Uncomment that line and then try again hope it will work.


> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
>     'django.contrib.staticfiles',
>* #'mysite.myapp',*
> )
>
>

Regards.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upload csv file

2013-04-24 Thread abhijeet shete
According to form you used in your template it will send only csv file
after clicking on submit button.


  {% csrf_token %}

Submit
  

If you want to access Nome and Sobrenome in views on submit button, then
you need to pass these inputs in the same form you used for submit as

 
  {% csrf_token %}





Submit
  

 Currently you are using two different forms for uploading file and Nome &
Sobrenome.

And why there are 2 functions with same name index in your views ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upload csv file

2013-04-24 Thread abhijeet shete
According to form you used in your template it will send only file


  {% csrf_token %}

Submit


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upload csv file

2013-04-24 Thread abhijeet shete
1. In your views.index function you have written something like this

   file = request.FILES
 for line in file:

You cant use file object directly instead try some thing like this

file = request.FILES['file']
for line in file.readlines():
  line = line.split(';')

2. You cant directly access model fields you need to access them with model
object.

Nome  = line[0] # wrong

report.Nome  = line[0] # Correct
report.Sobrenome = line[1]


Cheers.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Upload csv file

2013-04-24 Thread abhijeet shete
Can you please briefly explain your model structure and how you are trying
to save csv in MongoDB so that we can check whats going wrong.

>
Cheers.
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Delivery Status Notification (Failure)

2013-03-11 Thread abhijeet shete
Hi Jasmine,

First if you are asking about the same question then continue in same
thread don't start with new thread every time.

How you created app using django's startapp command or manually ?
Normally if apps folder doesn't contain __init__.py file then it gives this
error while executing


python manage.py sql polls
>
>



Regards.
Abhijeet.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Errors in my first django app

2013-03-11 Thread abhijeet shete
Hi Jasmin,

Looks like you haven't added your app 'polls' in 'settings.py' under
INSTALLED_APPS. Check whether you added your app or not.
If not add it.


On Mon, Mar 11, 2013 at 5:33 PM, jesmine chaudhuri <
jesminechaudhur...@gmail.com> wrote:

> Error: App with label polls could not be found. Are you sure your
>  INSTALLED_APPS setting is correct?
>
>
> Regards..
Abhijeet Shete

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Error: App with label world could not be found. Are you sure your INSTALLED_APPS setting is correct?

2013-03-11 Thread abhijeet shete
Hi Jasmin,

Looks like you haven't added your app 'polls' in 'settings.py' under
INSTALLED_APPS. Check whether you added your app or not.
If not add it.

Regards.
Abhijeet


On Mon, Mar 11, 2013 at 5:05 PM, jesmine chaudhuri <
jesminechaudhur...@gmail.com> wrote:

> Error: App with label polls could not be found. Are you sure your
> INSTALLED_APPS setting is correct? in django 1.3 project and mysql.
>
> I am new in Django and Python. Please anyone help me.
>
> Thanks in advance.
>
> Jesmine C
>
>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Begginer

2013-02-27 Thread abhijeet shete
Hi Akshay,

Django's online documentation is very good.
Here is the link for documentation. https://docs.djangoproject.com/en/1.4/



On Wed, Feb 27, 2013 at 1:59 PM, Akshay Ramesh wrote:

> Hi I am new to Djnago and would like to have some help from you. Where
> should I start from ?
>


Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.