Re: AttributeError: module 'polls.views' has no attribute 'index' error in Django

2024-12-07 Thread Олександр Рябов
Guys, thanks for the help everyone but I just used vim and rewrote the code 
again)

On Thursday, 5 December 2024 at 15:02:36 UTC+3 Олександр Рябов wrote:

> Hello! I'm facing an issue when running my Django project. I get the 
> following error:
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> I've checked the following:  
> 1) In "polls/views.py", I have defined the index function:
> from django.http import HttpResponse
> 
> def index(request):
> return HttpResponse("Hello, World!")
>
> 2) In polls/urls.py, the path to this function is correctly defined:
> from django.urls import path, include
> from . import views
>
> urlpatterns = [
> path("", views.index, name="index"),
> ]
> 3) In the main mysite/urls.py, the URLs from polls are included:
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path("polls/", include("polls.urls")),
> path("admin/", admin.site.urls),
> ]
>
> However, when I run the server with the command:
> " python manage.py runserver "  
>
> I get the error mentioned above. I have also made sure that all imports 
> are correct and that the project is using the right Python version.
>
> What could be the cause of this error and how can I fix it? Thank you!
> P.S. 
> - I am writing my code in Visual Studio Code and have attached two 
> pictures for reference.
> - The first picture shows the general structure of my project.
> - The second picture displays the full error message from the command 
> line(*try to enlarge it, I hope you can see everything.)
> #1
>
> [image: photo_1.png]
> #2
> [image: photo_2.png]
>

-- 
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 view this discussion visit 
https://groups.google.com/d/msgid/django-users/f04cf8be-2103-4bb9-9ef3-7bf90ddbb1edn%40googlegroups.com.


Re: AttributeError: module 'polls.views' has no attribute 'index' error in Django

2024-12-06 Thread Abduljelil Zubairu
is your VS Code on auto save 

On Thursday, December 5, 2024 at 1:02:36 PM UTC+1 Олександр Рябов wrote:

> Hello! I'm facing an issue when running my Django project. I get the 
> following error:
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> I've checked the following:  
> 1) In "polls/views.py", I have defined the index function:
> from django.http import HttpResponse
> 
> def index(request):
> return HttpResponse("Hello, World!")
>
> 2) In polls/urls.py, the path to this function is correctly defined:
> from django.urls import path, include
> from . import views
>
> urlpatterns = [
> path("", views.index, name="index"),
> ]
> 3) In the main mysite/urls.py, the URLs from polls are included:
> from django.contrib import admin
> from django.urls import include, path
>
> urlpatterns = [
> path("polls/", include("polls.urls")),
> path("admin/", admin.site.urls),
> ]
>
> However, when I run the server with the command:
> " python manage.py runserver "  
>
> I get the error mentioned above. I have also made sure that all imports 
> are correct and that the project is using the right Python version.
>
> What could be the cause of this error and how can I fix it? Thank you!
> P.S. 
> - I am writing my code in Visual Studio Code and have attached two 
> pictures for reference.
> - The first picture shows the general structure of my project.
> - The second picture displays the full error message from the command 
> line(*try to enlarge it, I hope you can see everything.)
> #1
>
> [image: photo_1.png]
> #2
> [image: photo_2.png]
>

-- 
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 view this discussion visit 
https://groups.google.com/d/msgid/django-users/3ac25773-c449-444e-9d69-d20f23af18cdn%40googlegroups.com.


Re: AttributeError at /auth/users/

2023-07-02 Thread s.alaoui youssef
Hi
you have to create class User(AbstractUser) 

class User(AbstractUser):
   ...
objects = UserManager()

and add objects with your UserManager
Le samedi 1 juillet 2023 à 18:14:53 UTC+1, arun n a écrit :

> Hello, 
>
> I am new to Django.  I am getting the below error. Can someone help.
>
> from django.db import models
> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, 
> BaseUserManager, UserManager
>
>
> class UserAccountManager(BaseUserManager):
> def create_user(self, email, name, password=None):
> if not email:
> raise ValueError('Email address required')
>
> email = self.normalize_email(email)
> user = self.model(email=email, name=name)
> user.set_password(password)
> user.save()
> return user
>
> AttributeError at /auth/users/'Manager' object has no attribute 
> 'create_user'
> Request Method:
> POST
> Request URL:
> http://127.0.0.1:8000/auth/users/
> Django Version:
> 4.2.2
> Exception Type:
> AttributeError
> Exception Value:
> 'Manager' object has no attribute 'create_user'
> Exception Location:
>
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Lib\site-packages\djoser\serializers.py,
>  
> line 48, in perform_create
> Raised during:
> djoser.views.UserViewSet
> Python Executable:
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Scripts\python.exe
> Python Version:
> 3.11.4
> Python Path:
> ['C:\\Users\\Arun\\Documents\\GitHub\\nc-backend', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
>  
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE\\Lib\\site-packages']
> Server time:
> Fri, 30 Jun 2023 18:48:41 +
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce27af5f-fb17-4347-8496-9c973577a7cdn%40googlegroups.com.


Re: AttributeError at /auth/users/

2023-07-02 Thread s.alaoui youssef
class User(AbstractUser):

   .

objects = UserManager()

we have to create User class and specify as objects your UserManager

Le dimanche 2 juillet 2023 à 02:10:58 UTC+1, Muhammad Juwaini Abdul Rahman 
a écrit :

> What's your code in urls.py for `/auth/user`?
>
> On Sunday, 2 July 2023 at 01:14:53 UTC+8 arun n wrote:
>
>> Hello, 
>>
>> I am new to Django.  I am getting the below error. Can someone help.
>>
>> from django.db import models
>> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
>> , BaseUserManager, UserManager
>>
>>
>> class UserAccountManager(BaseUserManager):
>> def create_user(self, email, name, password=None):
>> if not email:
>> raise ValueError('Email address required')
>>
>> email = self.normalize_email(email)
>> user = self.model(email=email, name=name)
>> user.set_password(password)
>> user.save()
>> return user
>>
>> AttributeError at /auth/users/'Manager' object has no attribute 
>> 'create_user'
>> Request Method:
>> POST
>> Request URL:
>> http://127.0.0.1:8000/auth/users/
>> Django Version:
>> 4.2.2
>> Exception Type:
>> AttributeError
>> Exception Value:
>> 'Manager' object has no attribute 'create_user'
>> Exception Location:
>>
>> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Lib\site-packages\djoser\serializers.py,
>>  
>> line 48, in perform_create
>> Raised during:
>> djoser.views.UserViewSet
>> Python Executable:
>> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Scripts\python.exe
>> Python Version:
>> 3.11.4
>> Python Path:
>> ['C:\\Users\\Arun\\Documents\\GitHub\\nc-backend', 
>> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
>>  
>> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 
>> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 
>> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311', 
>> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE', 
>> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE\\Lib\\site-packages']
>> Server time:
>> Fri, 30 Jun 2023 18:48:41 +
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c5956e09-fc25-4661-8306-7c958044090an%40googlegroups.com.


Re: AttributeError at /auth/users/

2023-07-01 Thread Muhammad Juwaini Abdul Rahman
What's your code in urls.py for `/auth/user`?

On Sunday, 2 July 2023 at 01:14:53 UTC+8 arun n wrote:

> Hello, 
>
> I am new to Django.  I am getting the below error. Can someone help.
>
> from django.db import models
> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, 
> BaseUserManager, UserManager
>
>
> class UserAccountManager(BaseUserManager):
> def create_user(self, email, name, password=None):
> if not email:
> raise ValueError('Email address required')
>
> email = self.normalize_email(email)
> user = self.model(email=email, name=name)
> user.set_password(password)
> user.save()
> return user
>
> AttributeError at /auth/users/'Manager' object has no attribute 
> 'create_user'
> Request Method:
> POST
> Request URL:
> http://127.0.0.1:8000/auth/users/
> Django Version:
> 4.2.2
> Exception Type:
> AttributeError
> Exception Value:
> 'Manager' object has no attribute 'create_user'
> Exception Location:
>
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Lib\site-packages\djoser\serializers.py,
>  
> line 48, in perform_create
> Raised during:
> djoser.views.UserViewSet
> Python Executable:
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Scripts\python.exe
> Python Version:
> 3.11.4
> Python Path:
> ['C:\\Users\\Arun\\Documents\\GitHub\\nc-backend', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
>  
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE\\Lib\\site-packages']
> Server time:
> Fri, 30 Jun 2023 18:48:41 +
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/280c8a92-940c-48f2-9e89-b47351e3d79fn%40googlegroups.com.


Re: AttributeError at /auth/users/

2023-07-01 Thread Fikayo Soetan
Good day,
I'm also still learning but I think the name of the function should be 
"_create_user"
Fikayo.
On Saturday, July 1, 2023 at 6:14:53 PM UTC+1 arun n wrote:

> Hello, 
>
> I am new to Django.  I am getting the below error. Can someone help.
>
> from django.db import models
> from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, 
> BaseUserManager, UserManager
>
>
> class UserAccountManager(BaseUserManager):
> def create_user(self, email, name, password=None):
> if not email:
> raise ValueError('Email address required')
>
> email = self.normalize_email(email)
> user = self.model(email=email, name=name)
> user.set_password(password)
> user.save()
> return user
>
> AttributeError at /auth/users/'Manager' object has no attribute 
> 'create_user'
> Request Method:
> POST
> Request URL:
> http://127.0.0.1:8000/auth/users/
> Django Version:
> 4.2.2
> Exception Type:
> AttributeError
> Exception Value:
> 'Manager' object has no attribute 'create_user'
> Exception Location:
>
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Lib\site-packages\djoser\serializers.py,
>  
> line 48, in perform_create
> Raised during:
> djoser.views.UserViewSet
> Python Executable:
> C:\Users\Arun\.virtualenvs\nc-backend-zDgCjJYE\Scripts\python.exe
> Python Version:
> 3.11.4
> Python Path:
> ['C:\\Users\\Arun\\Documents\\GitHub\\nc-backend', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
>  
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\DLLs', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311\\Lib', 
> 'C:\\Users\\Arun\\AppData\\Local\\Programs\\Python\\Python311', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE', 
> 'C:\\Users\\Arun\\.virtualenvs\\nc-backend-zDgCjJYE\\Lib\\site-packages']
> Server time:
> Fri, 30 Jun 2023 18:48:41 +
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b554889b-b0ef-4856-baaf-6c45b8a96e5an%40googlegroups.com.


Re: AttributeError: 'QuerySet' object has no attribute 'mime_type'

2023-01-19 Thread Jason
is `content` a queryset? 

On Thursday, January 19, 2023 at 8:21:39 AM UTC-5 monisha.s...@ideas2it.com 
wrote:

> @staticmethod
> def post(request, *args, **kwargs):
> constant = utils.send_grid_key
> sg = SendGridAPIClient(constant)
> subject = get_subject()
> content = get_content()
> message = Mail(
> from_email=From((utils.sender_mail, 'Hello')),
> to_emails=To('man...@gmail.com'),
> # to_emails=To(get_email()),
> subject=subject,
> html_content=content)
> response = sg.send(message)
> print(response.status_code)
> print(response.body)
> print(response.headers)
> return Response(response)
>
>
> Traceback (most recent call last):
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\exception.py",
>  
> line 55, in inner
> response = get_response(request)
>^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\base.py",
>  
> line 197, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\decorators\csrf.py",
>  
> line 54, in wrapped_view
> return view_func(*args, **kwargs)
>^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\generic\base.py",
>  
> line 103, in view
> return self.dispatch(request, *args, **kwargs)
>^^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 509, in dispatch
> response = self.handle_exception(exc)
>^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 469, in handle_exception
> self.raise_uncaught_exception(exc)
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 480, in raise_uncaught_exception
> raise exc
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 506, in dispatch
> response = handler(request, *args, **kwargs)
>^
>   File "C:\Users\Lenovo\marketautomation\automation\user\views.py", line 
> 140, in post
> message = Mail(
>   ^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py",
>  
> line 80, in __init__
> self.add_content(html_content, MimeType.html)
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py",
>  
> line 734, in add_content
> if content.mime_type == MimeType.text:
>^
> AttributeError: 'QuerySet' object has no attribute 'mime_type'
> [19/Jan/2023 17:54:52] ERROR - Internal Server Error: /automation/user/mail
> Traceback (most recent call last):
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\exception.py",
>  
> line 55, in inner
> response = get_response(request)
>^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\core\handlers\base.py",
>  
> line 197, in _get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs)
>
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\decorators\csrf.py",
>  
> line 54, in wrapped_view
> return view_func(*args, **kwargs)
>^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\django\views\generic\base.py",
>  
> line 103, in view
> return self.dispatch(request, *args, **kwargs)
>^^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 509, in dispatch
> response = self.handle_exception(exc)
>^^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 469, in handle_exception
> self.raise_uncaught_exception(exc)
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 480, in raise_uncaught_exception
> raise exc
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\rest_framework\views.py",
>  
> line 506, in dispatch
> response = handler(request, *args, **kwargs)
>^
>   File "C:\Users\Lenovo\marketautomation\automation\user\views.py", line 
> 140, in post
> message = Mail(
>   ^
>   File 
> "C:\Users\Lenovo\marketautomation\venv\Lib\site-packages\sendgrid\helpers\mail\mail.py",
>  
> line 80, in

Re: AttributeError at /form/

2022-12-18 Thread 'Kasper Laudrup' via Django users

Reading something like this:

https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2bd

should help guide you in the right direction.

Kind regards,
Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/00319842-092e-3210-43b1-c1152672968a%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: AttributeError: module 'django.db.models' has no attribute 'PointField'

2022-11-27 Thread Larry Martell
On Sun, Nov 27, 2022 at 2:40 PM Ilyas Modni  wrote:
>
> AttributeError: module 'django.db.models' has no attribute 'PointField'

Are you importing:

from django.contrib.gis.db import models

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY6VyNv5RdQ5UbA2N2j9W2OKN0B0vg0gjS_kuphmAmd8xg%40mail.gmail.com.


Re: AttributeError: module 'django.db.models' has no attribute 'PointField'

2022-11-27 Thread Karen Tracey
On Sun, Nov 27, 2022 at 2:41 PM Ilyas Modni  wrote:

> AttributeError: module 'django.db.models' has no attribute 'PointField'
>
> PointField is in django.contrib.gis.db.models:
https://docs.djangoproject.com/en/4.1/ref/contrib/gis/model-api/#pointfield

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACS9raddif%3DiWrMUHUqEoK%2BTBxDoTYeXQ-mW0D_OZPyfoZqnpg%40mail.gmail.com.


Re: AttributeError at /api/courses/

2021-12-22 Thread Kasper Laudrup
If you want someone to help you then spend the minimum effort and ask a 
proper question.


That's the least you can do if you expect someone to take the time to 
help you.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7d05e8a-9fa1-82db-1f7f-fa29df1273a7%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: AttributeError: 'Values' object has no attribute 'link_base' in building sphinx documentation.

2021-12-10 Thread Sencer Hamarat
I think the same way.
I will upgrade to 2.2.25 soon. Then I'll open a ticket asap.

On Thu, Dec 9, 2021 at 7:04 PM Jason  wrote:

> you could raise a bug report on the django tracker at
> https://code.djangoproject.com/query but I'm doubtful that this will gain
> any traction
>
> Those versions of django you specified are very out of date.  1.10 was EOL
> in 2017, 1.11 EOL'd April 2020 and 2.0 EOLd Aug 2018
>
> If you don't have any issues with currently supported versions (2.2, 3.2
> and 4.0),  then its likely that any PRs won't be applied.
>
> On Thursday, December 9, 2021 at 10:15:03 AM UTC-5 sencer...@gmail.com
> wrote:
>
>> Hello everyone,
>>
>> If 'sphinx.ext.autodoc' extension enabled in conf.py of sphinx, when I
>> try to run 'make html' I'm ending up with AttributeError exception:
>>
>> Exception occurred:
>>   File
>> /env/lib/python3.6/site-packages/django/contrib/admindocs/utils.py", line
>> 121, in _role
>> inliner.document.settings.link_base,
>> AttributeError: 'Values' object has no attribute 'link_base'
>>
>> I tried it with combinations of some django and sphinx versions.
>>
>> Here is the no luck list:
>> django 1.10, django 1.11 and sphinx 3.5
>> django 2.0.13 and sphinx 3.5 , sphinx 4.0, sphinx 4.2.0, sphinx 4.3.1
>>
>> I also opened an issue at sphinx github but they said this has to do with
>> django admindocs instead of  sphinx.
>>
>> Is there anybody who has resolved the AttributeError exception thrown
>> while building documents via sphinx?
>>
>> Regards,
>> Sencer HAMARAT
>>
>> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d684ad8e-3001-4d36-8b13-33ce0029cb32n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACp8TZg5PRgxn6HwMpk3rN%3DHqu35%3DYvojoQgeMUSyOgC%3DuXy1A%40mail.gmail.com.


Re: AttributeError: 'Values' object has no attribute 'link_base' in building sphinx documentation.

2021-12-09 Thread Jason
you could raise a bug report on the django tracker 
at https://code.djangoproject.com/query but I'm doubtful that this will 
gain any traction

Those versions of django you specified are very out of date.  1.10 was EOL 
in 2017, 1.11 EOL'd April 2020 and 2.0 EOLd Aug 2018

If you don't have any issues with currently supported versions (2.2, 3.2 
and 4.0),  then its likely that any PRs won't be applied. 

On Thursday, December 9, 2021 at 10:15:03 AM UTC-5 sencer...@gmail.com 
wrote:

> Hello everyone,
>
> If 'sphinx.ext.autodoc' extension enabled in conf.py of sphinx, when I try 
> to run 'make html' I'm ending up with AttributeError exception:
>
> Exception occurred:
>   File 
> /env/lib/python3.6/site-packages/django/contrib/admindocs/utils.py", line 
> 121, in _role
> inliner.document.settings.link_base,
> AttributeError: 'Values' object has no attribute 'link_base'
>
> I tried it with combinations of some django and sphinx versions.
>
> Here is the no luck list:
> django 1.10, django 1.11 and sphinx 3.5
> django 2.0.13 and sphinx 3.5 , sphinx 4.0, sphinx 4.2.0, sphinx 4.3.1
>
> I also opened an issue at sphinx github but they said this has to do with 
> django admindocs instead of  sphinx.
>
> Is there anybody who has resolved the AttributeError exception thrown 
> while building documents via sphinx?
>
> Regards,
> Sencer HAMARAT
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d684ad8e-3001-4d36-8b13-33ce0029cb32n%40googlegroups.com.


Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-07-26 Thread DJANGO DEVELOPER
as you mentioned that you're using django 3.2 but your urls.py file is
following the pattern of django 1.7.
use your urls.py this way : path('your polls url here', views.index,
name='index')

On Mon, Jul 26, 2021 at 6:45 PM Zain  wrote:

> Had the same issue.
>
> Solved, make sure you run each edited python file during the tutorial.
> I guess it needs to update. All I know is this fixed the issue.
>
> On Monday, April 19, 2021 at 2:07:34 AM UTC+10 avi.me...@gmail.com wrote:
>
>> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and
>> Django 3.2 and have exactly the same problems as mentioned above.
>>
>> path('', views.index, name='index'),
>>
>> AttributeError: module 'polls.views' has no attribute 'index'
>>
>> any help on how can I debug this? I am a django noob
>>
>> On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:
>>
>>> Thanks for your reploy.
>>>
>>> Actually I followed the tutorial exactly.
>>>
>>> My polls/views.py has:
>>>
>>> from django.http import HttpResponse
>>>
>>>
>>> def index(request):
>>> return HttpResponse("Hello, world. You're at the polls index.")
>>>
>>> My polls/urls.py has:
>>>
>>> from django.conf.urls import url
>>>
>>> from . import views
>>>
>>> urlpatterns = [
>>> url(r'^$', views.index, name='index'),
>>> ]
>>>
>>>
>>> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>>>
 You didn't give us enough info, but I am thinking that you don't have
 an index() function in your polls/views.py. Start the tutorial from the
 beginning and follow it closely.
 On Apr 19, 2017 4:17 PM, Billy Lin  wrote:

 I'm following the getting started tutorial 01 and running into issues
 after creating the polls app. Can someone please help?

 I'm using Python 3.6.1 and Django 1.11.

 Here's the detailed trace:

 Performing system checks...
 Unhandled exception in thread started by >>> check_errors..wrapper at 0x04222810>
 Traceback (most recent call last):
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
 line
 227, in wrapper
 fn(*args, **kwargs)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
 nserver.py", line 125, in inner_run
 self.check(display_num_errors=True)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
 l
 ine 359, in check
 include_deployment_checks=include_deployment_checks,
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
 l
 ine 346, in _run_checks
 return checks.run_checks(**kwargs)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
 l
 ine 81, in run_checks
 new_errors = check(app_configs=app_configs)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
 line
 16, in check_url_config
 return check_resolver(resolver)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
 line
 26, in check_resolver
 return check_method()
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 line 25
 4, in check
 for pattern in self.url_patterns:
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
 line
 35, in __get__
 res = instance.__dict__[self.name] = self.func(instance)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 line 40
 5, in url_patterns
 patterns = getattr(self.urlconf_module, "urlpatterns",
 self.urlconf_module)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
 line
 35, in __get__
 res = instance.__dict__[self.name] = self.func(instance)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
 line 39
 8, in urlconf_module
 return import_module(self.urlconf_name)
   File
 "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
 line 126, in import_modu
 le
 return _bootstrap._gcd_import(name[level:], package, level)
   File "", line 978, in _gcd_import
   File "", line 961, in _find_and_load
   File "", line 950, in
 _find_and_load_unlocked
   File "", line 655, in _load_unlocked
   File "", line 678, 

Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-07-26 Thread Zain
Had the same issue. 

Solved, make sure you run each edited python file during the tutorial. 
I guess it needs to update. All I know is this fixed the issue.

On Monday, April 19, 2021 at 2:07:34 AM UTC+10 avi.me...@gmail.com wrote:

> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and 
> Django 3.2 and have exactly the same problems as mentioned above.
>
> path('', views.index, name='index'),
>
> AttributeError: module 'polls.views' has no attribute 'index'
>
> any help on how can I debug this? I am a django noob
>
> On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:
>
>> Thanks for your reploy.
>>
>> Actually I followed the tutorial exactly.
>>
>> My polls/views.py has:
>>
>> from django.http import HttpResponse
>>
>>
>> def index(request):
>> return HttpResponse("Hello, world. You're at the polls index.")
>>
>> My polls/urls.py has:
>>
>> from django.conf.urls import url
>>
>> from . import views
>>
>> urlpatterns = [
>> url(r'^$', views.index, name='index'),
>> ]
>>
>>
>> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>>
>>> You didn't give us enough info, but I am thinking that you don't have an 
>>> index() function in your polls/views.py. Start the tutorial from the 
>>> beginning and follow it closely.
>>> On Apr 19, 2017 4:17 PM, Billy Lin  wrote:
>>>
>>> I'm following the getting started tutorial 01 and running into issues 
>>> after creating the polls app. Can someone please help?
>>>
>>> I'm using Python 3.6.1 and Django 1.11.
>>>
>>> Here's the detailed trace:
>>>
>>> Performing system checks...
>>> Unhandled exception in thread started by >> check_errors..wrapper at 0x04222810>
>>> Traceback (most recent call last):
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>>>  
>>> line
>>> 227, in wrapper
>>> fn(*args, **kwargs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
>>> nserver.py", line 125, in inner_run
>>> self.check(display_num_errors=True)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>  
>>> l
>>> ine 359, in check
>>> include_deployment_checks=include_deployment_checks,
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>>  
>>> l
>>> ine 346, in _run_checks
>>> return checks.run_checks(**kwargs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>>>  
>>> l
>>> ine 81, in run_checks
>>> new_errors = check(app_configs=app_configs)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>  
>>> line
>>> 16, in check_url_config
>>> return check_resolver(resolver)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>>  
>>> line
>>> 26, in check_resolver
>>> return check_method()
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>  
>>> line 25
>>> 4, in check
>>> for pattern in self.url_patterns:
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>>  
>>> line
>>> 35, in __get__
>>> res = instance.__dict__[self.name] = self.func(instance)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>  
>>> line 40
>>> 5, in url_patterns
>>> patterns = getattr(self.urlconf_module, "urlpatterns", 
>>> self.urlconf_module)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>>  
>>> line
>>> 35, in __get__
>>> res = instance.__dict__[self.name] = self.func(instance)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>>  
>>> line 39
>>> 8, in urlconf_module
>>> return import_module(self.urlconf_name)
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>>>  
>>> line 126, in import_modu
>>> le
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>>   File "", line 978, in _gcd_import
>>>   File "", line 961, in _find_and_load
>>>   File "", line 950, in 
>>> _find_and_load_unlocked
>>>   File "", line 655, in _load_unlocked
>>>   File "", line 678, in exec_module
>>>   File "", line 205, in 
>>> _call_with_frames_removed
>>>   File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, 
>>> in 
>>> url(r'^polls/', include('polls.urls')),
>>>   File 
>>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python3

Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-04-22 Thread David Nugent
On Mon, Apr 19, 2021 at 2:07 AM Avi Mehenwal  wrote:

> I followed the same tutorial on 17th April 2021 with Python 3.9.2 and
> Django 3.2 and have exactly the same problems as mentioned above.
>
> path('', views.index, name='index'),
> AttributeError: module 'polls.views' has no attribute 'index'
>
> any help on how can I debug this? I am a django noob
>

We all started out that way.

>From the error message, assuming views it is defined as:

from . import views

or, maybe

from polls import views

it means that python cannot find the function index() in the views module.

Regards

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE5VhgUckZZtR%2BVBmW6ungOQ8uBowyE%2BSLG%3DVg%3DuqZVZmw275w%40mail.gmail.com.


Re: AttributeError: module 'polls.views' has no attribute 'index'

2021-04-18 Thread Avi Mehenwal
I followed the same tutorial on 17th April 2021 with Python 3.9.2 and 
Django 3.2 and have exactly the same problems as mentioned above.

path('', views.index, name='index'),
AttributeError: module 'polls.views' has no attribute 'index'

any help on how can I debug this? I am a django noob

On Wednesday, 19 April 2017 at 16:31:59 UTC+2 lce...@gmail.com wrote:

> Thanks for your reploy.
>
> Actually I followed the tutorial exactly.
>
> My polls/views.py has:
>
> from django.http import HttpResponse
>
>
> def index(request):
> return HttpResponse("Hello, world. You're at the polls index.")
>
> My polls/urls.py has:
>
> from django.conf.urls import url
>
> from . import views
>
> urlpatterns = [
> url(r'^$', views.index, name='index'),
> ]
>
>
> On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:
>
>> You didn't give us enough info, but I am thinking that you don't have an 
>> index() function in your polls/views.py. Start the tutorial from the 
>> beginning and follow it closely.
>> On Apr 19, 2017 4:17 PM, Billy Lin  wrote:
>>
>> I'm following the getting started tutorial 01 and running into issues 
>> after creating the polls app. Can someone please help?
>>
>> I'm using Python 3.6.1 and Django 1.11.
>>
>> Here's the detailed trace:
>>
>> Performing system checks...
>> Unhandled exception in thread started by > check_errors..wrapper at 0x04222810>
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>>  
>> line
>> 227, in wrapper
>> fn(*args, **kwargs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
>> nserver.py", line 125, in inner_run
>> self.check(display_num_errors=True)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>  
>> l
>> ine 359, in check
>> include_deployment_checks=include_deployment_checks,
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>>  
>> l
>> ine 346, in _run_checks
>> return checks.run_checks(**kwargs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>>  
>> l
>> ine 81, in run_checks
>> new_errors = check(app_configs=app_configs)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>  
>> line
>> 16, in check_url_config
>> return check_resolver(resolver)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>>  
>> line
>> 26, in check_resolver
>> return check_method()
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 25
>> 4, in check
>> for pattern in self.url_patterns:
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>  
>> line
>> 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 40
>> 5, in url_patterns
>> patterns = getattr(self.urlconf_module, "urlpatterns", 
>> self.urlconf_module)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>>  
>> line
>> 35, in __get__
>> res = instance.__dict__[self.name] = self.func(instance)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>>  
>> line 39
>> 8, in urlconf_module
>> return import_module(self.urlconf_name)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>>  
>> line 126, in import_modu
>> le
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 978, in _gcd_import
>>   File "", line 961, in _find_and_load
>>   File "", line 950, in 
>> _find_and_load_unlocked
>>   File "", line 655, in _load_unlocked
>>   File "", line 678, in exec_module
>>   File "", line 205, in 
>> _call_with_frames_removed
>>   File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, 
>> in 
>> url(r'^polls/', include('polls.urls')),
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py",
>>  
>> lin
>> e 50, in include
>> urlconf_module = import_module(urlconf_module)
>>   File 
>> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>>  
>> line 126, in import_modu
>> le
>> return _bootstrap._gcd_import(name[level:], package, level)
>>   File "", line 978, in _gcd_im

Re: AttributeError: 'customer' object has no attribute 'is_authenticated'

2021-04-01 Thread Gabriel Araya Garcia
Why you don't explain better your problem ? When appear that

Gabriel Araya Garcia
GMI - Desarrollo de Sistemas Informáticos




El jue, 1 abr 2021 a las 15:43, Mahendra ()
escribió:

> I think given name is wrong Hlo do you have any idea posting form data?
>
> Mahendra Yadav
>
> On Thu, 1 Apr 2021, 22:32 Salima Begum, 
> wrote:
>
>> Hi all,
>>
>> How to solve this errors
>> ```
>> AttributeError: 'customer' object has no attribute 'is_authenticated'
>> ```
>>
>> ```
>>   AttributeError: 'customer' object has no attribute 'is_anonymous'
>> ```
>>
>> How can I solve this above errors. Help me.
>>
>> Thanks
>> ~Salima
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMSz6bkcDZeFhhStQeTOeLAst1kNA1xa%2BuVsd0sva1JA0P8kMw%40mail.gmail.com
>> 
>> .
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAN-6G3x_vyJcBsfQ-pfN3AgK1-V_SVPSt3Fk6h%2ByLnU4iKorkg%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKVvSDCxW%3DcKpko_oxduQkZyCO00t1tRjbJ55fBTf%3DhjZj6-3g%40mail.gmail.com.


Re: AttributeError: 'customer' object has no attribute 'is_authenticated'

2021-04-01 Thread sebasti...@gmail.com
I think this must be wrong. Only User instance have a method 
is_authenticated. Here a example for views:

if request.user.is_authenticated:
   pass

sali...@rohteksolutions.com schrieb am Donnerstag, 1. April 2021 um 
19:03:36 UTC+2:

> Hi all,
>
> How to solve this errors
> ```
> AttributeError: 'customer' object has no attribute 'is_authenticated'
> ```
>
> ```
>   AttributeError: 'customer' object has no attribute 'is_anonymous'  
> ```
>
> How can I solve this above errors. Help me.
>
> Thanks
> ~Salima
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3e9ee7e0-0616-4150-a778-75e9660b5fb1n%40googlegroups.com.


Re: AttributeError: 'customer' object has no attribute 'is_authenticated'

2021-04-01 Thread Mahendra
I think given name is wrong Hlo do you have any idea posting form data?

Mahendra Yadav

On Thu, 1 Apr 2021, 22:32 Salima Begum, 
wrote:

> Hi all,
>
> How to solve this errors
> ```
> AttributeError: 'customer' object has no attribute 'is_authenticated'
> ```
>
> ```
>   AttributeError: 'customer' object has no attribute 'is_anonymous'
> ```
>
> How can I solve this above errors. Help me.
>
> Thanks
> ~Salima
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMSz6bkcDZeFhhStQeTOeLAst1kNA1xa%2BuVsd0sva1JA0P8kMw%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-6G3x_vyJcBsfQ-pfN3AgK1-V_SVPSt3Fk6h%2ByLnU4iKorkg%40mail.gmail.com.


Re: AttributeError: 'NoneType' object has no attribute 'replace'

2021-02-23 Thread Kasper Laudrup

On 23/02/2021 17.56, Abnilson Rafael wrote:

Hi,
I'm getting error above when I try to this program:


The get_language() member function/method of your "translation" 
object/variable doesn't return anything and you most likely expect it to 
return a string.


Try to figure out how that could happen and you'll most likely have the 
solution.


Hard to help you any further without knowing anything about what you are 
trying to achieve.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b8f083f9-5640-c8d0-7043-88a7a646ce85%40stacktrace.dk.


Re: AttributeError: type object 'User' has no attribute 'objects'

2021-02-22 Thread georgia...@gmail.com
Sorry I have the same similar problem, please help, thank you!!
I put the question on stackoverflow, there are questions and reference 
materials attached.

So you can click the link to enter : 
https://stackoverflow.com/questions/66310704/attributeerror-type-object-product-has-no-attribute-objects

for
File "C:\Users\georgiawang\PycharmProjects\libshopapp\store\views.py", line 
195, in updateItem** product = Product.objects.get(id=productId) 
AttributeError: type object 'Product' has no attribute 'objects'**
sagar ninave 在 2020年4月27日 星期一下午11:10:21 [UTC+8] 的信中寫道:

> i got answer 
>
> i was doing this:
> from .models import User
> user = User.objects.filter(pk=user_id) 
>
> instead i do this:
> from .models import MyUser
> user =  MyUser.objects.filter(pk=user_id) 
>
>
> error gone
>
>
>
>
> On Mon, Apr 27, 2020 at 6:57 AM Kasper Laudrup  
> wrote:
>
>> Hi Sagar,
>>
>> On 27/04/2020 14.25, sagar ninave wrote:
>> > i am getting this error
>> > 
>>
>> It's hard to guess since you don't show where your User class comes
>> from, but it doesn't seem like its inheriting from the Django model class.
>>
>> The error message is quite clear. Look at your User model.
>>
>> Btw. just a hint: please try to "return early". It is quite difficult to
>> see which else branches are connected to which if statements in the code
>> following the one throwing the exception.
>>
>> Kind regards,
>>
>> Kasper Laudrup
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/96eba188-98e9-4284-cbab-a3aa3c909c05%40stacktrace.dk
>> .
>>
>
>
> -- 
>
> 
>  
> sagar ninave
> about.me/sagarninave 
> 
>  
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c631cbb-2294-4350-b136-e6ef38d9f022n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-15 Thread Mislav Jurić
Thank you for your suggestion. I will use the username, as it is unique as 
well.

Best,
Mislav

Dana ponedjeljak, 14. rujna 2020. u 19:45:36 UTC+2 korisnik coolguy napisao 
je:

> If i had to stick to your code then i would save the file with 
> instance.username. username is available and folder would be readable as 
> well.
>
> However, as i mentioned in my last reply and seems you agreed, 
> save/register the employee and then have employee upload the picture.
>
> On Monday, September 14, 2020 at 8:20:21 AM UTC-4 mislav@gmail.com 
> wrote:
>
>> What I can do is first register the employee via a register form, then 
>> once he logs in ask him/her for the profile picture. *Can I do that this 
>> way? *
>>
>> If I do it this way, I don't have to change my model in any way.
>>
>> Dana nedjelja, 13. rujna 2020. u 18:11:18 UTC+2 korisnik coolguy napisao 
>> je:
>>
>>> not sure about the purpose of showing that example in Django 
>>> documentation while its comments are clear that "object will not have been 
>>> saved to the database yet, so if it uses the default AutoField, *it 
>>> might not yet have a value for its primary key field*."
>>>
>>> so that's the reason for having None with file path.
>>>
>>> In this approach what i can see is to save the employee first without 
>>> file and then edit and select the file.
>>>
>>> I would not use this approach and rather keep it simple as followed:
>>>
>>> photo = models.ImageField(upload_to='employee/%Y/%m/%d/', blank=True)
>>>
>>> On Sunday, September 13, 2020 at 5:41:18 AM UTC-4 mislav@gmail.com 
>>> wrote:
>>>
 Hey coolguy,

 thanks for responding. After I changed that line as you suggested that 
 error is solved, *but when I add the user through the admin interface, 
 I get None as the ID* (the folder that gets created in the 
 */media/users* is titled *None*). I'm not sure if this is expected 
 behavior.

 I haven't added the registration or the login yet, so maybe the ID gets 
 a value when someone is actually registering.

 Let me know.

 Best,
 Mislav

 Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao 
 je:

> I wanted to see your model to understand but i realized after my last 
> post that you are using "instance.user.id" while your employee 
> instance does not have user field. (had to go somewhere urgently) >>> 
> return "employees/media/users/{0}/profile_picture.{1}".format(
> instance.user.id, extension)  
>
> change it as follow and remove user from it.
> return "employees/media/users/{0}/profile_picture.{1}".format(
> instance.id , extension)  
>
> It should work...
>
> On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 
> mislav@gmail.com wrote:
>
>> coolguy here is the complete Employee model:
>>
>> class Employee(models.Model): #TODO: Double-check this
>> username = models.CharField(max_length=50, unique=True)
>> email = models.EmailField()
>> password = models.CharField(max_length=50)
>> first_name = models.CharField(max_length=150)
>> last_name = models.CharField(max_length=100)
>> website = models.URLField(max_length=200, blank=True)
>>
>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>> blank=True, null=True)
>> 
>> def __str__(self):
>> return str(self.first_name) + str(self.last_name)
>>
>> *Why do I need the foreign key to User in the first place?* I don't 
>> recall seing the foreign key to User in any one of the tutorials.
>> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy 
>> napisao je:
>>
>>> Please share the complete employee model. It seems you are missing 
>>> User foreign key in it.
>>>
>>> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 
>>> mislav@gmail.com wrote:
>>>
 Hey guys,

 I have the following code in models.py file in one of my apps:

 def get_upload_path(instance, filename):
 extension = filename.split('.')[-1]
 return "employees/media/users/{0}/profile_picture.{1}".format(
 instance.user.id, extension)

 class Employee(models.Model):
 # some attributes here
 profile_picture = models.ImageField(upload_to=get_upload_path, 
 blank=True, null=True)

 I am getting the following error when I try to add an Employee via 
 the admin interface:

 AttributeError at /admin/employees/employee/add/

 'Employee' object has no attribute 'user'

 *I don't know where this error is stemming from.* I took the 
 get_upload_path function from the official Django FIleField 
 documentation 
 

Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-14 Thread coolguy
If i had to stick to your code then i would save the file with 
instance.username. username is available and folder would be readable as 
well.

However, as i mentioned in my last reply and seems you agreed, 
save/register the employee and then have employee upload the picture.

On Monday, September 14, 2020 at 8:20:21 AM UTC-4 mislav@gmail.com 
wrote:

> What I can do is first register the employee via a register form, then 
> once he logs in ask him/her for the profile picture. *Can I do that this 
> way? *
>
> If I do it this way, I don't have to change my model in any way.
>
> Dana nedjelja, 13. rujna 2020. u 18:11:18 UTC+2 korisnik coolguy napisao 
> je:
>
>> not sure about the purpose of showing that example in Django 
>> documentation while its comments are clear that "object will not have been 
>> saved to the database yet, so if it uses the default AutoField, *it 
>> might not yet have a value for its primary key field*."
>>
>> so that's the reason for having None with file path.
>>
>> In this approach what i can see is to save the employee first without 
>> file and then edit and select the file.
>>
>> I would not use this approach and rather keep it simple as followed:
>>
>> photo = models.ImageField(upload_to='employee/%Y/%m/%d/', blank=True)
>>
>> On Sunday, September 13, 2020 at 5:41:18 AM UTC-4 mislav@gmail.com 
>> wrote:
>>
>>> Hey coolguy,
>>>
>>> thanks for responding. After I changed that line as you suggested that 
>>> error is solved, *but when I add the user through the admin interface, 
>>> I get None as the ID* (the folder that gets created in the 
>>> */media/users* is titled *None*). I'm not sure if this is expected 
>>> behavior.
>>>
>>> I haven't added the registration or the login yet, so maybe the ID gets 
>>> a value when someone is actually registering.
>>>
>>> Let me know.
>>>
>>> Best,
>>> Mislav
>>>
>>> Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao 
>>> je:
>>>
 I wanted to see your model to understand but i realized after my last 
 post that you are using "instance.user.id" while your employee 
 instance does not have user field. (had to go somewhere urgently) >>> 
 return "employees/media/users/{0}/profile_picture.{1}".format(
 instance.user.id, extension)  

 change it as follow and remove user from it.
 return "employees/media/users/{0}/profile_picture.{1}".format(
 instance.id , extension)  

 It should work...

 On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 
 mislav@gmail.com wrote:

> coolguy here is the complete Employee model:
>
> class Employee(models.Model): #TODO: Double-check this
> username = models.CharField(max_length=50, unique=True)
> email = models.EmailField()
> password = models.CharField(max_length=50)
> first_name = models.CharField(max_length=150)
> last_name = models.CharField(max_length=100)
> website = models.URLField(max_length=200, blank=True)
>
> profile_picture = models.ImageField(upload_to=get_upload_path, 
> blank=True, null=True)
> 
> def __str__(self):
> return str(self.first_name) + str(self.last_name)
>
> *Why do I need the foreign key to User in the first place?* I don't 
> recall seing the foreign key to User in any one of the tutorials.
> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao 
> je:
>
>> Please share the complete employee model. It seems you are missing 
>> User foreign key in it.
>>
>> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 
>> mislav@gmail.com wrote:
>>
>>> Hey guys,
>>>
>>> I have the following code in models.py file in one of my apps:
>>>
>>> def get_upload_path(instance, filename):
>>> extension = filename.split('.')[-1]
>>> return "employees/media/users/{0}/profile_picture.{1}".format(
>>> instance.user.id, extension)
>>>
>>> class Employee(models.Model):
>>> # some attributes here
>>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>>> blank=True, null=True)
>>>
>>> I am getting the following error when I try to add an Employee via 
>>> the admin interface:
>>>
>>> AttributeError at /admin/employees/employee/add/
>>>
>>> 'Employee' object has no attribute 'user'
>>>
>>> *I don't know where this error is stemming from.* I took the 
>>> get_upload_path function from the official Django FIleField 
>>> documentation 
>>> 
>>> .
>>>
>>> Any ideas as to what is going on here?
>>>
>>> Best,
>>> Mislav
>>>
>>

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

Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-14 Thread Mislav Jurić
What I can do is first register the employee via a register form, then once 
he logs in ask him/her for the profile picture. *Can I do that this way? *

If I do it this way, I don't have to change my model in any way.

Dana nedjelja, 13. rujna 2020. u 18:11:18 UTC+2 korisnik coolguy napisao je:

> not sure about the purpose of showing that example in Django documentation 
> while its comments are clear that "object will not have been saved to the 
> database yet, so if it uses the default AutoField, *it might not yet have 
> a value for its primary key field*."
>
> so that's the reason for having None with file path.
>
> In this approach what i can see is to save the employee first without file 
> and then edit and select the file.
>
> I would not use this approach and rather keep it simple as followed:
>
> photo = models.ImageField(upload_to='employee/%Y/%m/%d/', blank=True)
>
> On Sunday, September 13, 2020 at 5:41:18 AM UTC-4 mislav@gmail.com 
> wrote:
>
>> Hey coolguy,
>>
>> thanks for responding. After I changed that line as you suggested that 
>> error is solved, *but when I add the user through the admin interface, I 
>> get None as the ID* (the folder that gets created in the */media/users* 
>> is titled *None*). I'm not sure if this is expected behavior.
>>
>> I haven't added the registration or the login yet, so maybe the ID gets a 
>> value when someone is actually registering.
>>
>> Let me know.
>>
>> Best,
>> Mislav
>>
>> Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao je:
>>
>>> I wanted to see your model to understand but i realized after my last 
>>> post that you are using "instance.user.id" while your employee instance 
>>> does not have user field. (had to go somewhere urgently) >>> return 
>>> "employees/media/users/{0}/profile_picture.{1}".format(instance.user.id, 
>>> extension)  
>>>
>>> change it as follow and remove user from it.
>>> return "employees/media/users/{0}/profile_picture.{1}".format(
>>> instance.id , extension)  
>>>
>>> It should work...
>>>
>>> On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 mislav@gmail.com 
>>> wrote:
>>>
 coolguy here is the complete Employee model:

 class Employee(models.Model): #TODO: Double-check this
 username = models.CharField(max_length=50, unique=True)
 email = models.EmailField()
 password = models.CharField(max_length=50)
 first_name = models.CharField(max_length=150)
 last_name = models.CharField(max_length=100)
 website = models.URLField(max_length=200, blank=True)

 profile_picture = models.ImageField(upload_to=get_upload_path, 
 blank=True, null=True)
 
 def __str__(self):
 return str(self.first_name) + str(self.last_name)

 *Why do I need the foreign key to User in the first place?* I don't 
 recall seing the foreign key to User in any one of the tutorials.
 Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao 
 je:

> Please share the complete employee model. It seems you are missing 
> User foreign key in it.
>
> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 
> mislav@gmail.com wrote:
>
>> Hey guys,
>>
>> I have the following code in models.py file in one of my apps:
>>
>> def get_upload_path(instance, filename):
>> extension = filename.split('.')[-1]
>> return "employees/media/users/{0}/profile_picture.{1}".format(
>> instance.user.id, extension)
>>
>> class Employee(models.Model):
>> # some attributes here
>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>> blank=True, null=True)
>>
>> I am getting the following error when I try to add an Employee via 
>> the admin interface:
>>
>> AttributeError at /admin/employees/employee/add/
>>
>> 'Employee' object has no attribute 'user'
>>
>> *I don't know where this error is stemming from.* I took the 
>> get_upload_path function from the official Django FIleField 
>> documentation 
>> .
>>
>> Any ideas as to what is going on here?
>>
>> Best,
>> Mislav
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/428c96ea-d71b-4174-a8e7-ff5ad45f5ec3n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-13 Thread coolguy
not sure about the purpose of showing that example in Django documentation 
while its comments are clear that "object will not have been saved to the 
database yet, so if it uses the default AutoField, *it might not yet have a 
value for its primary key field*."

so that's the reason for having None with file path.

In this approach what i can see is to save the employee first without file 
and then edit and select the file.

I would not use this approach and rather keep it simple as followed:

photo = models.ImageField(upload_to='employee/%Y/%m/%d/', blank=True)

On Sunday, September 13, 2020 at 5:41:18 AM UTC-4 mislav@gmail.com 
wrote:

> Hey coolguy,
>
> thanks for responding. After I changed that line as you suggested that 
> error is solved, *but when I add the user through the admin interface, I 
> get None as the ID* (the folder that gets created in the */media/users* 
> is titled *None*). I'm not sure if this is expected behavior.
>
> I haven't added the registration or the login yet, so maybe the ID gets a 
> value when someone is actually registering.
>
> Let me know.
>
> Best,
> Mislav
>
> Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao je:
>
>> I wanted to see your model to understand but i realized after my last 
>> post that you are using "instance.user.id" while your employee instance 
>> does not have user field. (had to go somewhere urgently) >>> return 
>> "employees/media/users/{0}/profile_picture.{1}".format(instance.user.id, 
>> extension)  
>>
>> change it as follow and remove user from it.
>> return "employees/media/users/{0}/profile_picture.{1}".format(instance.id 
>> , extension)  
>>
>> It should work...
>>
>> On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 mislav@gmail.com 
>> wrote:
>>
>>> coolguy here is the complete Employee model:
>>>
>>> class Employee(models.Model): #TODO: Double-check this
>>> username = models.CharField(max_length=50, unique=True)
>>> email = models.EmailField()
>>> password = models.CharField(max_length=50)
>>> first_name = models.CharField(max_length=150)
>>> last_name = models.CharField(max_length=100)
>>> website = models.URLField(max_length=200, blank=True)
>>>
>>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>>> blank=True, null=True)
>>> 
>>> def __str__(self):
>>> return str(self.first_name) + str(self.last_name)
>>>
>>> *Why do I need the foreign key to User in the first place?* I don't 
>>> recall seing the foreign key to User in any one of the tutorials.
>>> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao 
>>> je:
>>>
 Please share the complete employee model. It seems you are missing User 
 foreign key in it.

 On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 
 mislav@gmail.com wrote:

> Hey guys,
>
> I have the following code in models.py file in one of my apps:
>
> def get_upload_path(instance, filename):
> extension = filename.split('.')[-1]
> return "employees/media/users/{0}/profile_picture.{1}".format(
> instance.user.id, extension)
>
> class Employee(models.Model):
> # some attributes here
> profile_picture = models.ImageField(upload_to=get_upload_path, 
> blank=True, null=True)
>
> I am getting the following error when I try to add an Employee via the 
> admin interface:
>
> AttributeError at /admin/employees/employee/add/
>
> 'Employee' object has no attribute 'user'
>
> *I don't know where this error is stemming from.* I took the 
> get_upload_path function from the official Django FIleField 
> documentation 
> .
>
> Any ideas as to what is going on here?
>
> Best,
> Mislav
>


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7daceb0e-c1d5-4b9a-b64b-7dbabec6118fn%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-13 Thread coolguy
May the purpose of showing that example in Django documentation is 
something else. If you read the comments there , there is a potential issue 
that the instance that they suggest to use mostly would have not been 
persisted in the database if AutoField has been used. so there will be 'no' 
id as yet resulting None is being saved with file path.

In this approach what i can see is to save the employee first without file 
and then edit and select the file.

I would not use this approach and rather keep it simple as followed:

photo = models.ImageField(upload_to='employee/%Y/%m/%d/', blank=True)

On Sunday, September 13, 2020 at 5:41:18 AM UTC-4 mislav@gmail.com 
wrote:

> Hey coolguy,
>
> thanks for responding. After I changed that line as you suggested that 
> error is solved, *but when I add the user through the admin interface, I 
> get None as the ID* (the folder that gets created in the */media/users* 
> is titled *None*). I'm not sure if this is expected behavior.
>
> I haven't added the registration or the login yet, so maybe the ID gets a 
> value when someone is actually registering.
>
> Let me know.
>
> Best,
> Mislav
>
> Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao je:
>
>> I wanted to see your model to understand but i realized after my last 
>> post that you are using "instance.user.id" while your employee instance 
>> does not have user field. (had to go somewhere urgently) >>> return 
>> "employees/media/users/{0}/profile_picture.{1}".format(instance.user.id, 
>> extension)  
>>
>> change it as follow and remove user from it.
>> return "employees/media/users/{0}/profile_picture.{1}".format(instance.id 
>> , extension)  
>>
>> It should work...
>>
>> On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 mislav@gmail.com 
>> wrote:
>>
>>> coolguy here is the complete Employee model:
>>>
>>> class Employee(models.Model): #TODO: Double-check this
>>> username = models.CharField(max_length=50, unique=True)
>>> email = models.EmailField()
>>> password = models.CharField(max_length=50)
>>> first_name = models.CharField(max_length=150)
>>> last_name = models.CharField(max_length=100)
>>> website = models.URLField(max_length=200, blank=True)
>>>
>>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>>> blank=True, null=True)
>>> 
>>> def __str__(self):
>>> return str(self.first_name) + str(self.last_name)
>>>
>>> *Why do I need the foreign key to User in the first place?* I don't 
>>> recall seing the foreign key to User in any one of the tutorials.
>>> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao 
>>> je:
>>>
 Please share the complete employee model. It seems you are missing User 
 foreign key in it.

 On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 
 mislav@gmail.com wrote:

> Hey guys,
>
> I have the following code in models.py file in one of my apps:
>
> def get_upload_path(instance, filename):
> extension = filename.split('.')[-1]
> return "employees/media/users/{0}/profile_picture.{1}".format(
> instance.user.id, extension)
>
> class Employee(models.Model):
> # some attributes here
> profile_picture = models.ImageField(upload_to=get_upload_path, 
> blank=True, null=True)
>
> I am getting the following error when I try to add an Employee via the 
> admin interface:
>
> AttributeError at /admin/employees/employee/add/
>
> 'Employee' object has no attribute 'user'
>
> *I don't know where this error is stemming from.* I took the 
> get_upload_path function from the official Django FIleField 
> documentation 
> .
>
> Any ideas as to what is going on here?
>
> Best,
> Mislav
>


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e8aa1e36-8364-4d0a-b325-f79974763c02n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-13 Thread Mislav Jurić
Hey coolguy,

thanks for responding. After I changed that line as you suggested that 
error is solved, *but when I add the user through the admin interface, I 
get None as the ID* (the folder that gets created in the */media/users* is 
titled *None*). I'm not sure if this is expected behavior.

I haven't added the registration or the login yet, so maybe the ID gets a 
value when someone is actually registering.

Let me know.

Best,
Mislav

Dana subota, 12. rujna 2020. u 21:57:21 UTC+2 korisnik coolguy napisao je:

> I wanted to see your model to understand but i realized after my last post 
> that you are using "instance.user.id" while your employee instance does 
> not have user field. (had to go somewhere urgently) >>> return 
> "employees/media/users/{0}/profile_picture.{1}".format(instance.user.id, 
> extension)  
>
> change it as follow and remove user from it.
> return "employees/media/users/{0}/profile_picture.{1}".format(instance.id 
> , extension)  
>
> It should work...
>
> On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 mislav@gmail.com 
> wrote:
>
>> coolguy here is the complete Employee model:
>>
>> class Employee(models.Model): #TODO: Double-check this
>> username = models.CharField(max_length=50, unique=True)
>> email = models.EmailField()
>> password = models.CharField(max_length=50)
>> first_name = models.CharField(max_length=150)
>> last_name = models.CharField(max_length=100)
>> website = models.URLField(max_length=200, blank=True)
>>
>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>> blank=True, null=True)
>> 
>> def __str__(self):
>> return str(self.first_name) + str(self.last_name)
>>
>> *Why do I need the foreign key to User in the first place?* I don't 
>> recall seing the foreign key to User in any one of the tutorials.
>> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao je:
>>
>>> Please share the complete employee model. It seems you are missing User 
>>> foreign key in it.
>>>
>>> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 mislav@gmail.com 
>>> wrote:
>>>
 Hey guys,

 I have the following code in models.py file in one of my apps:

 def get_upload_path(instance, filename):
 extension = filename.split('.')[-1]
 return "employees/media/users/{0}/profile_picture.{1}".format(
 instance.user.id, extension)

 class Employee(models.Model):
 # some attributes here
 profile_picture = models.ImageField(upload_to=get_upload_path, 
 blank=True, null=True)

 I am getting the following error when I try to add an Employee via the 
 admin interface:

 AttributeError at /admin/employees/employee/add/

 'Employee' object has no attribute 'user'

 *I don't know where this error is stemming from.* I took the 
 get_upload_path function from the official Django FIleField 
 documentation 
 .

 Any ideas as to what is going on here?

 Best,
 Mislav

>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f8662343-2ae8-40f9-a37f-d49bcc8c58c8n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-12 Thread coolguy
I wanted to see your model to understand but i realized after my last post 
that you are using "instance.user.id" while your employee instance does not 
have user field. (had to go somewhere urgently) >>> return 
"employees/media/users/{0}/profile_picture.{1}".format(instance.user.id, 
extension)  

change it as follow and remove user from it.
return "employees/media/users/{0}/profile_picture.{1}".format(instance.id 
, extension)  

It should work...

On Saturday, September 12, 2020 at 3:17:28 PM UTC-4 mislav@gmail.com 
wrote:

> coolguy here is the complete Employee model:
>
> class Employee(models.Model): #TODO: Double-check this
> username = models.CharField(max_length=50, unique=True)
> email = models.EmailField()
> password = models.CharField(max_length=50)
> first_name = models.CharField(max_length=150)
> last_name = models.CharField(max_length=100)
> website = models.URLField(max_length=200, blank=True)
>
> profile_picture = models.ImageField(upload_to=get_upload_path, 
> blank=True, null=True)
> 
> def __str__(self):
> return str(self.first_name) + str(self.last_name)
>
> *Why do I need the foreign key to User in the first place?* I don't 
> recall seing the foreign key to User in any one of the tutorials.
> Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao je:
>
>> Please share the complete employee model. It seems you are missing User 
>> foreign key in it.
>>
>> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 mislav@gmail.com 
>> wrote:
>>
>>> Hey guys,
>>>
>>> I have the following code in models.py file in one of my apps:
>>>
>>> def get_upload_path(instance, filename):
>>> extension = filename.split('.')[-1]
>>> return "employees/media/users/{0}/profile_picture.{1}".format(
>>> instance.user.id, extension)
>>>
>>> class Employee(models.Model):
>>> # some attributes here
>>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>>> blank=True, null=True)
>>>
>>> I am getting the following error when I try to add an Employee via the 
>>> admin interface:
>>>
>>> AttributeError at /admin/employees/employee/add/
>>>
>>> 'Employee' object has no attribute 'user'
>>>
>>> *I don't know where this error is stemming from.* I took the 
>>> get_upload_path function from the official Django FIleField 
>>> documentation 
>>> .
>>>
>>> Any ideas as to what is going on here?
>>>
>>> Best,
>>> Mislav
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f08f03a-9617-48b9-bfdb-d00e44652cf1n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-12 Thread Mislav Jurić
coolguy here is the complete Employee model:

class Employee(models.Model): #TODO: Double-check this
username = models.CharField(max_length=50, unique=True)
email = models.EmailField()
password = models.CharField(max_length=50)
first_name = models.CharField(max_length=150)
last_name = models.CharField(max_length=100)
website = models.URLField(max_length=200, blank=True)
profile_picture = models.ImageField(upload_to=get_upload_path, 
blank=True, null=True)

def __str__(self):
return str(self.first_name) + str(self.last_name)

*Why do I need the foreign key to User in the first place?* I don't recall 
seing the foreign key to User in any one of the tutorials.
Dana subota, 12. rujna 2020. u 20:20:11 UTC+2 korisnik coolguy napisao je:

> Please share the complete employee model. It seems you are missing User 
> foreign key in it.
>
> On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 mislav@gmail.com 
> wrote:
>
>> Hey guys,
>>
>> I have the following code in models.py file in one of my apps:
>>
>> def get_upload_path(instance, filename):
>> extension = filename.split('.')[-1]
>> return "employees/media/users/{0}/profile_picture.{1}".format(
>> instance.user.id, extension)
>>
>> class Employee(models.Model):
>> # some attributes here
>> profile_picture = models.ImageField(upload_to=get_upload_path, 
>> blank=True, null=True)
>>
>> I am getting the following error when I try to add an Employee via the 
>> admin interface:
>>
>> AttributeError at /admin/employees/employee/add/
>>
>> 'Employee' object has no attribute 'user'
>>
>> *I don't know where this error is stemming from.* I took the 
>> get_upload_path function from the official Django FIleField documentation 
>> .
>>
>> Any ideas as to what is going on here?
>>
>> Best,
>> Mislav
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c0e9382d-62d2-4c49-bb83-e3a985d26749n%40googlegroups.com.


Re: AttributeError: object has no attribute 'user' while trying to access instance.user.id

2020-09-12 Thread coolguy
Please share the complete employee model. It seems you are missing User 
foreign key in it.

On Saturday, September 12, 2020 at 2:03:20 PM UTC-4 mislav@gmail.com 
wrote:

> Hey guys,
>
> I have the following code in models.py file in one of my apps:
>
> def get_upload_path(instance, filename):
> extension = filename.split('.')[-1]
> return "employees/media/users/{0}/profile_picture.{1}".format(
> instance.user.id, extension)
>
> class Employee(models.Model):
> # some attributes here
> profile_picture = models.ImageField(upload_to=get_upload_path, 
> blank=True, null=True)
>
> I am getting the following error when I try to add an Employee via the 
> admin interface:
>
> AttributeError at /admin/employees/employee/add/
>
> 'Employee' object has no attribute 'user'
>
> *I don't know where this error is stemming from.* I took the 
> get_upload_path function from the official Django FIleField documentation 
> .
>
> Any ideas as to what is going on here?
>
> Best,
> Mislav
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f3940db-9144-4b68-bd83-095322b51af2n%40googlegroups.com.


Re: AttributeError when returning post.title in a comment model

2020-05-31 Thread Julio Cojom
Try '{0}-{1}'.format(var1, var2)

Check in the console in what line it's throwing the attribute error

Rewards

El vie., 29 de mayo de 2020 5:10 p. m., Ahmed Khairy <
ahmed.heshamel...@gmail.com> escribió:

> I was working on a comment section for post and was getting an
> AttributeError when I return return '{}-{}'.format(self.post.title,
> str(self.user.username)) in the comment model
>
> I am trying to link users and posts to the comment I am getting the same
> error
>
> Here is the Models.py
>
> class Comment(models.Model):
> post = models.ForeignKey(Post, on_delete=models.CASCADE)
> user = models.ForeignKey(User, on_delete=models.CASCADE)
> content = models.TextField(max_length=160)
> timestamp = models.DateTimeField(auto_now_add=True)
>
> def __str__(self):
> return '{}-{}'.format(self.post.title, str(self.user.username))
>
> Here is the views.py:
>
> class PostDetailView(DetailView):
> model = Post
> template_name = "post_detail.html"
>
> def get_context_data(self, *args, **kwargs):
> context = super(PostDetailView, self).get_context_data()
> post = get_object_or_404(Post, slug=self.kwargs['slug'])
> comments = Comment.objects.filter(post=post).order_by('-id')
> total_likes = post.total_likes()
> liked = False
> if post.likes.filter(id=self.request.user.id).exists():
> liked = True
>
> if self.request.method == 'POST':
> comment_form = CommentForm(self.request.POST or None)
> if comment_form.is_valid():
> content = self.request.POST.get('content')
> comment = Comment.objects.create(
> post=post, user=request.user, content=content)
> comment.save()
> return HttpResponseRedirect("post_detail.html")
> else:
> comment_form = CommentForm()
>
> context["total_likes"] = total_likes
> context["liked"] = liked
> context["comments"] = comments
> context["comment_form"] = comment_form
> return context
>
>
> class PostCommentCreateView(LoginRequiredMixin, CreateView):
> model = Comment
> form_class = CommentForm
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9e84bb03-ca66-4517-ab34-8d723a457b9f%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHRQUHki1Fk2s1a9ws4vB7yhfaLFhyboOVwvPSSVG87BSo0%3DtA%40mail.gmail.com.


Re: " AttributeError at /register/ " facing problem in implementing user registration

2020-05-24 Thread Kasper Laudrup

Hi Madhav,

On 24/05/2020 13.08, Madhav Nandan wrote:

I'm creating a register page.

see the screenshot below., I'm following lectures and doing as 
instructed but still stuck.




I don't see how the screenshots are related to the issue you are having. 
Please explain.


here is the source code of my course: 
https://github.com/codingforentrepreneurs/eCommerce/tree/master/src/ecommerce




Great. How is that relevant?


Please help me get run the code.



I *am* trying to help you. I asked you some questions related to the 
problem you were facing. You could start by answering those.


Feel free to ask any further questions related to that if something's 
not clear.


Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d98054b-983b-4db7-bdfd-344e80cc07e1%40stacktrace.dk.


Re: " AttributeError at /register/ " facing problem in implementing user registration

2020-05-24 Thread Kasper Laudrup

Hi Madhav,

On 24/05/2020 04.54, Madhav Nandan wrote:

Hi,
I need help here. I did the required changes in forms.py as well as in 
view.py but my user registration still not working.




Once again, try to make sense from the error messages. They are actually 
pointing to your problem quite clearly.


In this case, what is your "User" object in your forms.py file?

It is hard to tell since you've only provided some screenshots, but this 
line:


User = get_user_model()

in your views.py file looks very suspicious.

Why are you creating a global User variable?

Did you do the same in forms.py for some reason and why?

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1e2d5ba7-09f1-0b70-69bf-f136598b7989%40stacktrace.dk.


Re: AttributeError

2020-04-27 Thread 'Amitesh Sahay' via Django users
Do you have a "date" field in your models.py.? Please share models.py, and 
views.py as well

Sent from Yahoo Mail on Android 
 
  On Mon, 27 Apr 2020 at 22:44, Phako Perez<13.phak...@gmail.com> wrote:   I 
think issue is how you are trying to access the attributeThis is a form and 
must be accessed through a post call.
Can you share your html form???

Sent from my iPhone

On 27 Apr 2020, at 10:29, DimGo  wrote:



from django import forms
from django.core.exceptions import ValidationError

class SearchProduct(forms.Form):
 text=forms.CharField(label='Search ')
 date=forms.DateField(required=False)
 
t = SearchProduct()
print(t.date)

Error: 

AttributeError: 'SearchProduct' object has no attribute 'date'



why is there this error? How to fix it? 

ff


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/445e0ffb-03e7-4a32-9d83-b48795a9866c%40googlegroups.com.



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6FEB0B14-73FF-4A74-80B4-ED982F95D01F%40gmail.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/37640327.684638.1588012361686%40mail.yahoo.com.


Re: AttributeError with forms

2020-04-27 Thread 'Amitesh Sahay' via Django users
I couldn't open the screenshot . But to work with the django forms you need to 
perform below tasks.
1) create model of your choice in models.py.2).  Python manage.py 
makemigrations3) python manage py migrate.4 create a python file called 
forms.py inside your app.5) import your models there ( from .models import 
model_name6) create class to extend forms module.7) in views.py you either need 
to define class based views or function based views. 
I hope that helps.

Sent from Yahoo Mail on Android 
 
  On Mon, 27 Apr 2020 at 20:59, DimGo wrote:   Why 
is this this strange error? 


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com.
  

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/407015029.685337.1588012209457%40mail.yahoo.com.


Re: AttributeError with forms

2020-04-27 Thread Ethem Güner
It's not strange. You can't access to an attribute of a form class
directly. Remember how do you define the form in a view. You're passing
arguments such as *data=request.POST*. You're trying to access an undefined
attribute. Because It's a form class and needs input.

Try to print *t.__dict__  *you'll get a dictionary of that class. But If
you really need to access to the attribute like this, use* t['date']*

DimGo , 27 Nis 2020 Pzt, 18:29 tarihinde şunu
yazdı:

> Why is this this strange error?
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMsyPm_ck-hhC-P_FGz3vwk_fgKQWAy9rx6WpAh7AE1Gr08iqg%40mail.gmail.com.


Re: AttributeError with forms

2020-04-27 Thread Phako Perez
In addition, you must define your model in models.py

And to get this attributes on your views.py from a post request, you could use 
like {{ form.attribute }}

Regards

Sent from my iPhone

> On 27 Apr 2020, at 10:29, DimGo  wrote:
> 
> 
> Why is this this strange error? 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/7a2089af-344a-479d-bf7c-8a943973159b%40googlegroups.com.
> <Снимок экрана от 2020-04-27 18-06-28.png>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/A6EAD9A6-59B3-4986-8338-DF0A5DFDF2F7%40gmail.com.


Re: AttributeError

2020-04-27 Thread Phako Perez
I think issue is how you are trying to access the attribute
This is a form and must be accessed through a post call.

Can you share your html form???

Sent from my iPhone

> On 27 Apr 2020, at 10:29, DimGo  wrote:
> 
> 
> from django import forms
> from django.core.exceptions import ValidationError
> 
> class SearchProduct(forms.Form):
>  text=forms.CharField(label='Search ')
>  date=forms.DateField(required=False)
>  
> t = SearchProduct()
> print(t.date)
> 
> Error: 
> 
> AttributeError: 'SearchProduct' object has no attribute 'date'
> 
> 
> 
> why is there this error? How to fix it? 
> 
> ff
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/445e0ffb-03e7-4a32-9d83-b48795a9866c%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6FEB0B14-73FF-4A74-80B4-ED982F95D01F%40gmail.com.


Re: AttributeError: type object 'User' has no attribute 'objects'

2020-04-27 Thread sagar ninave
i got answer

i was doing this:
from .models import User
user = User.objects.filter(pk=user_id)

instead i do this:
from .models import MyUser
user =  MyUser.objects.filter(pk=user_id)


error gone




On Mon, Apr 27, 2020 at 6:57 AM Kasper Laudrup 
wrote:

> Hi Sagar,
>
> On 27/04/2020 14.25, sagar ninave wrote:
> > i am getting this error
> >
>
> It's hard to guess since you don't show where your User class comes
> from, but it doesn't seem like its inheriting from the Django model class.
>
> The error message is quite clear. Look at your User model.
>
> Btw. just a hint: please try to "return early". It is quite difficult to
> see which else branches are connected to which if statements in the code
> following the one throwing the exception.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/96eba188-98e9-4284-cbab-a3aa3c909c05%40stacktrace.dk
> .
>


-- 

sagar ninave
about.me/sagarninave


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAA6pdZ818Ju8uHr%3DdDayJr3NKwE%2B%2BJ%2BQQZk1iOHqG1EL4yjO1g%40mail.gmail.com.


Re: AttributeError: type object 'User' has no attribute 'objects'

2020-04-27 Thread Kasper Laudrup

Hi Sagar,

On 27/04/2020 14.25, sagar ninave wrote:

i am getting this error



It's hard to guess since you don't show where your User class comes
from, but it doesn't seem like its inheriting from the Django model class.

The error message is quite clear. Look at your User model.

Btw. just a hint: please try to "return early". It is quite difficult to
see which else branches are connected to which if statements in the code
following the one throwing the exception.

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/96eba188-98e9-4284-cbab-a3aa3c909c05%40stacktrace.dk.


Re: AttributeError: 'NoneType' object has no attribute 'app_name'

2020-03-13 Thread Sencer Hamarat
Thank you for your suggestion. And sorry fro delayed answer.

My hunch is saying same thing but I want to be sure about it.

Kind Regards,
Sencer Hamarat

3 Mart 2020 Salı 12:24:34 UTC+3 tarihinde Naveen Arora yazdı:
>
> Hi, 
>
> Can't the error be resolved ? Still, if error has to occur then you can 
> put conditions instead of try blocks for better functioning.
>
> Regards
> Naveen Arora
>
>
> On Monday, 2 March 2020 18:25:15 UTC+5:30, Sencer Hamarat wrote:
>>
>> Hello, 
>>
>> The project I'm working on has it's custom template context_processor.
>> And when unavailable URL request arrives to Django (Eg. "/wp-login.php"), 
>> the context_processor is throwing AttributeError.
>>
>> Which way should I use to prevent from context processor from throwing 
>> errors?
>> Is it ok to wrapping return with try block and returning empty dictionary 
>> if AttributeError raised?
>>
>> def resolver_context_processor(request):
>> return {
>> 'app_name': request.resolver_match.app_name,
>> 'namespace': request.resolver_match.namespace,
>> 'url_name': request.resolver_match.url_name
>> }
>>
>>
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c876117-f16b-4603-8d7b-d3609420093a%40googlegroups.com.


Re: AttributeError: 'NoneType' object has no attribute 'app_name'

2020-03-03 Thread Naveen Arora
Hi, 

Can't the error be resolved ? Still, if error has to occur then you can put 
conditions instead of try blocks for better functioning.

Regards
Naveen Arora


On Monday, 2 March 2020 18:25:15 UTC+5:30, Sencer Hamarat wrote:
>
> Hello, 
>
> The project I'm working on has it's custom template context_processor.
> And when unavailable URL request arrives to Django (Eg. "/wp-login.php"), 
> the context_processor is throwing AttributeError.
>
> Which way should I use to prevent from context processor from throwing 
> errors?
> Is it ok to wrapping return with try block and returning empty dictionary 
> if AttributeError raised?
>
> def resolver_context_processor(request):
> return {
> 'app_name': request.resolver_match.app_name,
> 'namespace': request.resolver_match.namespace,
> 'url_name': request.resolver_match.url_name
> }
>
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/77b25608-b663-440c-977c-4fedfd808c8c%40googlegroups.com.


Re: AttributeError: cffi library '_constant_time' has no function, constant or global variable named '__spec__'

2019-10-21 Thread Jorge Gimeno
Searches to both of your error messages suggested a mismatch in .so
objects. I would uninstall and reinstall Django and see if that helps.


-Jorge

On Sun, Oct 20, 2019 at 7:59 AM 'Abhishek Sharma' via Django users <
django-users@googlegroups.com> wrote:

> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "manage.py", line 21, in 
> main()
>   File "manage.py", line 17, in main
> execute_from_command_line(sys.argv)
>   File "C:\Python35\lib\site-packages\django\core\management\__init__.py",
> line 381, in execute_from_command_line
> utility.execute()
>   File "C:\Python35\lib\site-packages\django\core\management\__init__.py",
> line 375, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "C:\Python35\lib\site-packages\django\core\management\base.py",
> line 323, in run_from_argv
> self.execute(*args, **cmd_options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 60, in execute
> super().execute(*args, **options)
>   File "C:\Python35\lib\site-packages\django\core\management\base.py",
> line 364, in execute
> output = self.handle(*args, **options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 95, in handle
> self.run(**options)
>   File
> "C:\Python35\lib\site-packages\django\core\management\commands\runserver.py",
> line 102, in run
> autoreload.run_with_reloader(self.inner_run, **options)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 598, in run_with_reloader
> start_django(reloader, main_func, *args, **kwargs)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 583, in start_django
> reloader.run(django_main_thread)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 301, in run
> self.run_loop()
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 307, in run_loop
> next(ticker)
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 347, in tick
> for filepath, mtime in self.snapshot_files():
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 363, in snapshot_files
> for file in self.watched_files():
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 262, in watched_files
> yield from iter_all_python_module_files()
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 103, in iter_all_python_module_files
> return iter_modules_and_files(modules, frozenset(_error_files))
>   File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line
> 124, in iter_modules_and_files
> if getattr(module, '__spec__', None) is None:
> SystemError:  returned a result with an error
> set
>
>
>
> On Sunday, October 20, 2019 at 8:27:48 PM UTC+5:30, Abhishek Sharma wrote:
>>
>> I'm using Django and while run code getting below error, please help out
>> on it
>>
>> AttributeError: cffi library '_constant_time' has no function, constant
>> or global variable named '__spec__'
>>
>
>
>
> --
>
> The information in this e-mail and any attachments is confidential and may
> be legally privileged. It is intended solely for the addressee or
> addressee's. If you are not an intended recipient, please delete the
> message and any attachments and notify the sender of nondelivery. Any use
> or disclosure of the contents of either is unauthorised and may be
> unlawful. All liability for viruses is excluded to the fullest extent
> permitted by law. Any views expressed in this message are those of the
> individual sender, except where the sender states them, with requisite
> authority, to be those of the organisation.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e98263bd-05b9-4d7c-bbc7-bd1ebf9a4a83%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK-%2BD8R9pDc23RXYGJoE4wVpzx23BGK48qy8rw-RFD8EtQ%40mail.gmail.com.


Re: AttributeError: cffi library '_constant_time' has no function, constant or global variable named '__spec__'

2019-10-20 Thread 'Abhishek Sharma' via Django users
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "manage.py", line 21, in 
main()
  File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
  File "C:\Python35\lib\site-packages\django\core\management\__init__.py", 
line 381, in execute_from_command_line
utility.execute()
  File "C:\Python35\lib\site-packages\django\core\management\__init__.py", 
line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python35\lib\site-packages\django\core\management\base.py", line 
323, in run_from_argv
self.execute(*args, **cmd_options)
  File 
"C:\Python35\lib\site-packages\django\core\management\commands\runserver.py", 
line 60, in execute
super().execute(*args, **options)
  File "C:\Python35\lib\site-packages\django\core\management\base.py", line 
364, in execute
output = self.handle(*args, **options)
  File 
"C:\Python35\lib\site-packages\django\core\management\commands\runserver.py", 
line 95, in handle
self.run(**options)
  File 
"C:\Python35\lib\site-packages\django\core\management\commands\runserver.py", 
line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
598, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
583, in start_django
reloader.run(django_main_thread)
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
301, in run
self.run_loop()
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
307, in run_loop
next(ticker)
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
347, in tick
for filepath, mtime in self.snapshot_files():
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
363, in snapshot_files
for file in self.watched_files():
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
262, in watched_files
yield from iter_all_python_module_files()
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
103, in iter_all_python_module_files
return iter_modules_and_files(modules, frozenset(_error_files))
  File "C:\Python35\lib\site-packages\django\utils\autoreload.py", line 
124, in iter_modules_and_files
if getattr(module, '__spec__', None) is None:
SystemError:  returned a result with an error set



On Sunday, October 20, 2019 at 8:27:48 PM UTC+5:30, Abhishek Sharma wrote:
>
> I'm using Django and while run code getting below error, please help out 
> on it
>
> AttributeError: cffi library '_constant_time' has no function, constant or 
> global variable named '__spec__'
>

-- 

















The information in this
e-mail and any attachments is 
confidential and may be legally privileged. It is
intended solely for the 
addressee or addressee's. If you are not an intended
recipient, please 
delete the message and any attachments and notify the sender
of 
nondelivery. Any use or disclosure of the contents of either is 
unauthorised
and may be unlawful. All liability for viruses is excluded to 
the fullest
extent permitted by law. Any views expressed in this message 
are those of the
individual sender, except where the sender states them, 
with requisite
authority, to be those of the organisation.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e98263bd-05b9-4d7c-bbc7-bd1ebf9a4a83%40googlegroups.com.


Re: AttributeError

2019-10-02 Thread Daniel Hepper
You have a typo in your details view:

question=Question.object.get(

Should be:

question=Question.objects.get(

Cheers,
Daniel

> Am 02.10.2019 um 06:38 schrieb Jorge Gimeno :
> 
> 
> 
> 
>> On Tue, Oct 1, 2019 at 9:24 PM yasar arafath Kajamydeen  
>> wrote:
>> Hi ,
>> 
>> While try to execute  it showing AttributeError, Can some one help me on 
>> this.
>> 
>> 
>> My views.py
>> 
>> 
>> 
>> from django.shortcuts import render
>> from django.http import Http404
>> from django.http import HttpResponse
>> from .models import Question
>> 
>> 
>> def index(request):
>> latest_question_list=Question.objects.order_by('pub_date')[:3]
>> context={'latest_question_list':latest_question_list}
>> return render(request,'polls/index.html',context)
>> 
>> def detail(request, question_id):
>> try:
>> question=Question.object.get(pk=question_id)
>> except Question.DoesNotExist:
>> raise Http404("Question does not exist")
>> return render(request, 'polls/detail.html', {'question':question})
>> 
>> 
>> def results(request, question_id):
>> response = "You're looking at the results of question %s."
>> return HttpResponse(response%question_id)
>> 
>> 
>> def vote(request, question_id):
>> return HttpResponse("You're voting on question %s."%question_id)
>> 
>> 
>> 
>> 
>> 
>> 
>> My detail.html
>> 
>> 
>>   {{question}}
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> My polls/urls.py
>> 
>> 
>> 
>> from django.urls import path
>> 
>> from . import views
>> 
>> urlpatterns = [
>> # ex: /polls/
>> path('', views.index, name='index'),
>> # ex: /polls/5/
>> path('/', views.detail, name='detail'),
>> # ex: /polls/5/results/
>> path('/results/', views.results, name='results'),
>> # ex: /polls/5/vote/
>> path('/vote/', views.vote, name='vote'),
>> 
>> ]
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9918df61-41fd-40bd-8ca3-79ee3be12ec3%40googlegroups.com.
> 
> Can you please post the traceback?  Copy and paste, please. Without that we 
> won't know where the exception is raised.
> 
> -Jorge
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CANfN%3DK_EVDfucXrk490XeumWyf2_u0QOfitfbQ0jFQOJyKkAjg%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69313C94-61A3-4670-96C1-35253FEFDB31%40gmail.com.


Re: AttributeError

2019-10-01 Thread Jorge Gimeno
On Tue, Oct 1, 2019 at 9:24 PM yasar arafath Kajamydeen 
wrote:

> Hi ,
>
> While try to execute  it showing AttributeError, Can some one help me on
> this.
>
>
> *My views.py*
>
>
>
> from django.shortcuts import render
> from django.http import Http404
> from django.http import HttpResponse
> from .models import Question
>
>
> def index(request):
> latest_question_list=Question.objects.order_by('pub_date')[:3]
> context={'latest_question_list':latest_question_list}
> return render(request,'polls/index.html',context)
>
> def detail(request, question_id):
> try:
> question=Question.object.get(pk=question_id)
> except Question.DoesNotExist:
> raise Http404("Question does not exist")
> return render(request, 'polls/detail.html', {'question':question})
>
>
> def results(request, question_id):
> response = "You're looking at the results of question %s."
> return HttpResponse(response%question_id)
>
>
> def vote(request, question_id):
> return HttpResponse("You're voting on question %s."%question_id)
>
>
>
>
>
>
>
> *My detail.html*
>
>
>
>   {{question}}
>
>
>
>
>
>
>
>
>
> *My polls/urls.py*
>
>
>
>
> from django.urls import path
>
> from . import views
>
> urlpatterns = [
> # ex: /polls/
> path('', views.index, name='index'),
> # ex: /polls/5/
> path('/', views.detail, name='detail'),
> # ex: /polls/5/results/
> path('/results/', views.results, name='results'),
> # ex: /polls/5/vote/
> path('/vote/', views.vote, name='vote'),
>
> ]
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9918df61-41fd-40bd-8ca3-79ee3be12ec3%40googlegroups.com
> 
> .
>

Can you please post the traceback?  Copy and paste, please. Without that we
won't know where the exception is raised.

-Jorge

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANfN%3DK_EVDfucXrk490XeumWyf2_u0QOfitfbQ0jFQOJyKkAjg%40mail.gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-07 Thread Kean
Hi,

removing did, not work, still getting same error.
Welcome any other help from the wider community in reference to this issue.
best,

Kean

On 6 Sep 2019, at 22:26, Bhoopesh sisoudiya  wrote:

> Try after removing related_name='expenses' from Expenses model.
> 
> On Sat, Sep 7, 2019, 2:28 AM Kean  wrote:
> Hi Bhoopesh,
> 
> If this is a simple issue to resolve, please provide code which works.
> Reading an abstract reference, is welcome, but is not really helping to solve 
> as one can always reference a source. 
> 
> Please advise solution that works, and then reference a learning resource, so 
> user knows where to go for learning, but with solution in hand.
> 
> Best,
> 
> Kean
> 
> On 6 Sep 2019, at 21:54, Bhoopesh sisoudiya  wrote:
> 
>> https://stackoverflow.com/questions/31237042/whats-the-difference-between-select-related-and-prefetch-related-in-django-orm
>> 
>> 
>> On Sat, Sep 7, 2019, 2:20 AM Kean  wrote:
>> Don’t understand?
>> 
>> On 6 Sep 2019, at 21:41, Bhoopesh sisoudiya  wrote:
>> 
>>> 'project' inside select_related() is foreign key in Expenses modal of 
>>> Project modal.
>>> 
>>> On Sat, Sep 7, 2019, 2:07 AM Kean  wrote:
>>> Ok,
>>> 
>>> Updated to below, and am still getting the same error:
>>> 
>>> def projectdetail(request):
>>> projectList = Project.objects.all()
>>> projectExpenseDetails = Expense.objects.select_related('project').all()
>>> return render(request, 'busprojectdetail.html', {'project': project, 
>>> 'expense_list': projectExpenseDetails})
>>> 
>>> Exception Type: NameError
>>> Exception Value:
>>> name 'project' is not defined
>>> Exception Location: 
>>> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
>>> line 239
>>> Best,
>>> Kean
>>> 
>>> 
>>> On 6 Sep 2019, at 21:32, Bhoopesh sisoudiya  wrote:
>>> 
 Sorry my mistake
 
 
 def projectdetail(request):
 projectList = Project.objects.all()
 projectExpenseDetails = Expense.objects.select_related('project').all()
 return render(request, 'busprojectdetail.html', {'project': 
 projectList, 'expense_list': projectExpenseDetails})
 
 
 On Sat, Sep 7, 2019, 1:55 AM Kean  wrote:
 Hi Ok,
 
 I updated as advised.
 
 views.py
 
 def projectdetail(request):
 projectExpenseDetails = Expense.objects.select_related('project').all()
 return render(request, 'busprojectdetail.html', {'project': project, 
 'expense_list': projectExpenseDetails})
 
 I get new error
 Exception Type:NameError
 Exception Value:   
 name 'project' is not defined
 Exception Location:
 /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in 
 projectdetail, line 238
 
 
 Please advise?
 
 Best,
 
 Kean
 On 6 Sep 2019, at 21:19, Bhoopesh sisoudiya  wrote:
 
> projectExpnseDetails
 
>>> 
>> 
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/43C89EFD-1D4C-4B03-962E-898124A8D96D%40gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Ok,

Updated to below, and am still getting the same error:

def projectdetail(request):
projectList = Project.objects.all()
projectExpenseDetails = Expense.objects.select_related('project').all()
return render(request, 'busprojectdetail.html', {'project': project, 
'expense_list': projectExpenseDetails})

Exception Type: NameError
Exception Value:
name 'project' is not defined
Exception Location: 
/Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
line 239
Best,
Kean


On 6 Sep 2019, at 21:32, Bhoopesh sisoudiya  wrote:

> Sorry my mistake
> 
> 
> def projectdetail(request):
> projectList = Project.objects.all()
> projectExpenseDetails = Expense.objects.select_related('project').all()
> return render(request, 'busprojectdetail.html', {'project': projectList, 
> 'expense_list': projectExpenseDetails})
> 
> 
> On Sat, Sep 7, 2019, 1:55 AM Kean  wrote:
> Hi Ok,
> 
> I updated as advised.
> 
> views.py
> 
> def projectdetail(request):
> projectExpenseDetails = Expense.objects.select_related('project').all()
> return render(request, 'busprojectdetail.html', {'project': project, 
> 'expense_list': projectExpenseDetails})
> 
> I get new error
> Exception Type:   NameError
> Exception Value:  
> name 'project' is not defined
> Exception Location:   
> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
> line 238
> 
> 
> Please advise?
> 
> Best,
> 
> Kean
> On 6 Sep 2019, at 21:19, Bhoopesh sisoudiya  wrote:
> 
>> projectExpnseDetails
> 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20716649-508A-4E8C-8134-8DD8EECADF7C%40gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Hi Ok,

I updated as advised.

views.py

def projectdetail(request):
projectExpenseDetails = Expense.objects.select_related('project').all()
return render(request, 'busprojectdetail.html', {'project': project, 
'expense_list': projectExpenseDetails})

I get new error
Exception Type: NameError
Exception Value:
name 'project' is not defined
Exception Location: 
/Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
line 238


Please advise?

Best,

Kean
On 6 Sep 2019, at 21:19, Bhoopesh sisoudiya  wrote:

> projectExpnseDetails

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86E3CF35-2148-4C36-A503-5413BE568F95%40gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
def projectdetail(request):
projectExpnseDetails = Expense.objects.select_related('project').all()
return render(request, 'busprojectdetail.html', {'project': project,
'expense_list':projectExpnseDetails })


On Sat, Sep 7, 2019, 1:43 AM Bhoopesh sisoudiya 
wrote:

> Write this
>
> Expense.objects.select_related('project').all()
>
>
>
> On Sat, Sep 7, 2019, 1:37 AM Kean  wrote:
>
>> Thanks,
>>
>> I updated the view, and now I am getting syntax error.
>> Please see below.
>>
>> views.py
>>
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project': project,
>> 'expense_list': project.expenses.all()})
>>
>> projectDetails =
>> Project.objects.select_related(Project).values(select column).all()
>>
>> please advise how to correct?
>>
>> Best,
>>
>> Kean
>>
>> On 6 Sep 2019, at 21:01, Bhoopesh sisoudiya  wrote:
>>
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project': project,
>> 'expense_list': project.expenses.all()})
>>
>> According to me by this archive you want expense details of each project
>>
>> Then you write
>>
>> projectDetails = Project.objects.select_related(your foreign key).values
>> (select column).all()
>>
>> Thanks
>> Bhoopesh sisoudiya
>>
>>
>> On Sat, Sep 7, 2019, 1:22 AM Kean  wrote:
>>
>>> Hi,
>>>
>>> please ignore the manager it is just a naming convention ignore, it if
>>> for me to identify tables, if i have 50 table, I want to be able to know
>>> which model is holding which object information and for what I need it.
>>>
>>> Please use below, I have removed the # information to reduce confusion.
>>>
>>> models.py
>>>
>>> class Project(models.Model):
>>> name = models.CharField(max_length=100)
>>> budget = IntegerField()
>>>
>>> def save(self, *args, **kwargs):
>>> self.name
>>> super(Project, self).save(*args, **kwargs)
>>>
>>> class Category(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE)
>>> name = models.CharField(max_length=150)
>>>
>>> class Expense(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE, related_name='expenses')
>>> title = models.CharField(max_length=100)
>>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>>> On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya 
>>> wrote:
>>>
>>> Best wishes,
>>> Kean
>>>
>>> Ok No problem but
>>> why you want Manager?
>>>
>>> Please send me answer
>>>
>>> Thanks
>>> Bhoopesh sisoudiya
>>>
>>> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>>>
 Hi Bhoopesh
 Thanks for this, please can you put it into the context of my specific
 model setup, so I get it right and understand.
 This will be easier for me as this approach is causing me some other
 errors, when i try to apply it.

 Best wishes,

 Kean
 On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya 
 wrote:

 Hi Kean,

  Write manager like this ,I give you reference

 from django.db import models
  # First, define the Manager subclass.
 class BhoopeshBookManager(models.Manager):
def get_queryset(self):
 return super(BhoopeshBookManager,
 self).get_queryset().filter(author='Bhoopesh')

 # Then hook it into the Book model explicitly. class
 Book(models.Model):
 title = models.CharField(max_length=100)
 author = models.CharField(max_length=50)
  # ...
 objects = models.Manager()
  # The default manager.

 bhoopesh_objects = BhoopeshBookManager()
  # The Bhoopesh-specific manager.


 Book.bhoopesh_objects.all() # use manager


 Thanks
 Bhoopesh Kumar


 On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
 wrote:

> Hi kean,
> Please check Expenses Class is not Manager
> Please make Manager Class.
>
>
> Thanks
> Bhoopesh sisoudiya
>
> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>
>> Hi,
>>
>> New to Django. when navigating to the reqired view, I get the error
>> above.
>>
>> urls.py
>>
>> path('businesslogin/businessadmin/busproject', views.projectdetail,
>> name='projectdetail'),
>>
>> views.py
>>
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project':
>> project, 'expense_list': project.expenses.all()})
>>
>> models.py
>>
>> # Project model
>>
>> class Project(models.Model):
>> name = models.CharField(max_length=100)
>> budget = IntegerField()
>>
>> def save(self, *args, **kwargs):
>> self.name
>> super(Project, self).save(*args, **kwargs)
>>
>> # Category manag

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
This is still not working,
please can you provide full code, this way it is complete and accurate, and not 
me guessing?

Best,
Kean

On 6 Sep 2019, at 21:13, Bhoopesh sisoudiya  wrote:

> Write this
> 
> Expense.objects.select_related('project').all()
> 
> 
> 
> On Sat, Sep 7, 2019, 1:37 AM Kean  wrote:
> Thanks,
> 
> I updated the view, and now I am getting syntax error.
> Please see below.
> 
> views.py
> 
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project, 
> 'expense_list': project.expenses.all()})
> 
> projectDetails = Project.objects.select_related(Project).values(select 
> column).all()
> 
> please advise how to correct?
> 
> Best,
> 
> Kean
> 
> On 6 Sep 2019, at 21:01, Bhoopesh sisoudiya  wrote:
> 
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project': project, 
>> 'expense_list': project.expenses.all()})
>> 
>> According to me by this archive you want expense details of each project
>> 
>> Then you write
>> 
>> projectDetails = Project.objects.select_related(your foreign key).values 
>> (select column).all()
>> 
>> Thanks
>> Bhoopesh sisoudiya
>> 
>> 
>> On Sat, Sep 7, 2019, 1:22 AM Kean  wrote:
>> Hi,
>> 
>> please ignore the manager it is just a naming convention ignore, it if for 
>> me to identify tables, if i have 50 table, I want to be able to know which 
>> model is holding which object information and for what I need it.
>> 
>> Please use below, I have removed the # information to reduce confusion.
>> 
>> models.py
>> 
>> class Project(models.Model):
>> name = models.CharField(max_length=100)
>> budget = IntegerField()
>> 
>> def save(self, *args, **kwargs):
>> self.name
>> super(Project, self).save(*args, **kwargs)
>> 
>> class Category(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE)
>> name = models.CharField(max_length=150)
>> 
>> class Expense(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE, related_name='expenses')
>> title = models.CharField(max_length=100)
>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>> On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya  wrote:
>> 
>> Best wishes,
>> Kean
>> 
>>> Ok No problem but 
>>> why you want Manager?
>>> 
>>> Please send me answer
>>> 
>>> Thanks
>>> Bhoopesh sisoudiya
>>> 
>>> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>>> Hi Bhoopesh
>>> Thanks for this, please can you put it into the context of my specific 
>>> model setup, so I get it right and understand.
>>> This will be easier for me as this approach is causing me some other 
>>> errors, when i try to apply it.
>>> 
>>> Best wishes, 
>>> 
>>> Kean 
>>> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
>>> 
 Hi Kean,
 
  Write manager like this ,I give you reference
 
 from django.db import models
  # First, define the Manager subclass. 
 class BhoopeshBookManager(models.Manager):
def get_queryset(self): 
 return super(BhoopeshBookManager, 
 self).get_queryset().filter(author='Bhoopesh') 
 
 # Then hook it into the Book model explicitly. class Book(models.Model): 
 title = models.CharField(max_length=100) 
 author = models.CharField(max_length=50)
  # ... 
 objects = models.Manager()
  # The default manager. 
 
 bhoopesh_objects = BhoopeshBookManager()
  # The Bhoopesh-specific manager.
 
 
 Book.bhoopesh_objects.all() # use manager
 
 
 Thanks 
 Bhoopesh Kumar
 
 
 On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya  
 wrote:
 Hi kean,
 Please check Expenses Class is not Manager
 Please make Manager Class.
 
 
 Thanks
 Bhoopesh sisoudiya
 
 On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
 Hi, 
 
 New to Django. when navigating to the reqired view, I get the error above.
 
 urls.py
 
 path('businesslogin/businessadmin/busproject', views.projectdetail, 
 name='projectdetail'),
 
 views.py
 
 def projectdetail(request):
 project = Project.objects.all()
 return render(request, 'busprojectdetail.html', {'project': project, 
 'expense_list': project.expenses.all()})
 
 models.py
 
 # Project model
 
 class Project(models.Model):
 name = models.CharField(max_length=100)
 budget = IntegerField()
 
 def save(self, *args, **kwargs):
 self.name
 super(Project, self).save(*args, **kwargs)
 
 # Category manager model
 
 
 class Category(models.Model):
 project = models.ForeignKey(
 Project, on_delete=models.CASCADE)
 name = models.CharField(max_len

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
Write this

Expense.objects.select_related('project').all()



On Sat, Sep 7, 2019, 1:37 AM Kean  wrote:

> Thanks,
>
> I updated the view, and now I am getting syntax error.
> Please see below.
>
> views.py
>
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project,
> 'expense_list': project.expenses.all()})
>
> projectDetails = Project.objects.select_related(Project).values(select
> column).all()
>
> please advise how to correct?
>
> Best,
>
> Kean
>
> On 6 Sep 2019, at 21:01, Bhoopesh sisoudiya  wrote:
>
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project,
> 'expense_list': project.expenses.all()})
>
> According to me by this archive you want expense details of each project
>
> Then you write
>
> projectDetails = Project.objects.select_related(your foreign key).values
> (select column).all()
>
> Thanks
> Bhoopesh sisoudiya
>
>
> On Sat, Sep 7, 2019, 1:22 AM Kean  wrote:
>
>> Hi,
>>
>> please ignore the manager it is just a naming convention ignore, it if
>> for me to identify tables, if i have 50 table, I want to be able to know
>> which model is holding which object information and for what I need it.
>>
>> Please use below, I have removed the # information to reduce confusion.
>>
>> models.py
>>
>> class Project(models.Model):
>> name = models.CharField(max_length=100)
>> budget = IntegerField()
>>
>> def save(self, *args, **kwargs):
>> self.name
>> super(Project, self).save(*args, **kwargs)
>>
>> class Category(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE)
>> name = models.CharField(max_length=150)
>>
>> class Expense(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE, related_name='expenses')
>> title = models.CharField(max_length=100)
>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>> On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya  wrote:
>>
>> Best wishes,
>> Kean
>>
>> Ok No problem but
>> why you want Manager?
>>
>> Please send me answer
>>
>> Thanks
>> Bhoopesh sisoudiya
>>
>> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>>
>>> Hi Bhoopesh
>>> Thanks for this, please can you put it into the context of my specific
>>> model setup, so I get it right and understand.
>>> This will be easier for me as this approach is causing me some other
>>> errors, when i try to apply it.
>>>
>>> Best wishes,
>>>
>>> Kean
>>> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya 
>>> wrote:
>>>
>>> Hi Kean,
>>>
>>>  Write manager like this ,I give you reference
>>>
>>> from django.db import models
>>>  # First, define the Manager subclass.
>>> class BhoopeshBookManager(models.Manager):
>>>def get_queryset(self):
>>> return super(BhoopeshBookManager,
>>> self).get_queryset().filter(author='Bhoopesh')
>>>
>>> # Then hook it into the Book model explicitly. class Book(models.Model):
>>> title = models.CharField(max_length=100)
>>> author = models.CharField(max_length=50)
>>>  # ...
>>> objects = models.Manager()
>>>  # The default manager.
>>>
>>> bhoopesh_objects = BhoopeshBookManager()
>>>  # The Bhoopesh-specific manager.
>>>
>>>
>>> Book.bhoopesh_objects.all() # use manager
>>>
>>>
>>> Thanks
>>> Bhoopesh Kumar
>>>
>>>
>>> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
>>> wrote:
>>>
 Hi kean,
 Please check Expenses Class is not Manager
 Please make Manager Class.


 Thanks
 Bhoopesh sisoudiya

 On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:

> Hi,
>
> New to Django. when navigating to the reqired view, I get the error
> above.
>
> urls.py
>
> path('businesslogin/businessadmin/busproject', views.projectdetail,
> name='projectdetail'),
>
> views.py
>
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project':
> project, 'expense_list': project.expenses.all()})
>
> models.py
>
> # Project model
>
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
>
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
>
> # Category manager model
>
>
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
>
>
> # Expenses manager model
>
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = m

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Thanks,

I updated the view, and now I am getting syntax error.
Please see below.

views.py

def projectdetail(request):
project = Project.objects.all()
return render(request, 'busprojectdetail.html', {'project': project, 
'expense_list': project.expenses.all()})

projectDetails = Project.objects.select_related(Project).values(select 
column).all()

please advise how to correct?

Best,

Kean

On 6 Sep 2019, at 21:01, Bhoopesh sisoudiya  wrote:

> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project, 
> 'expense_list': project.expenses.all()})
> 
> According to me by this archive you want expense details of each project
> 
> Then you write
> 
> projectDetails = Project.objects.select_related(your foreign key).values 
> (select column).all()
> 
> Thanks
> Bhoopesh sisoudiya
> 
> 
> On Sat, Sep 7, 2019, 1:22 AM Kean  wrote:
> Hi,
> 
> please ignore the manager it is just a naming convention ignore, it if for me 
> to identify tables, if i have 50 table, I want to be able to know which model 
> is holding which object information and for what I need it.
> 
> Please use below, I have removed the # information to reduce confusion.
> 
> models.py
> 
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
> 
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
> 
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
> 
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> category = models.ForeignKey(Category, on_delete=models.CASCADE)
> On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya  wrote:
> 
> Best wishes,
> Kean
> 
>> Ok No problem but 
>> why you want Manager?
>> 
>> Please send me answer
>> 
>> Thanks
>> Bhoopesh sisoudiya
>> 
>> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>> Hi Bhoopesh
>> Thanks for this, please can you put it into the context of my specific model 
>> setup, so I get it right and understand.
>> This will be easier for me as this approach is causing me some other errors, 
>> when i try to apply it.
>> 
>> Best wishes, 
>> 
>> Kean 
>> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
>> 
>>> Hi Kean,
>>> 
>>>  Write manager like this ,I give you reference
>>> 
>>> from django.db import models
>>>  # First, define the Manager subclass. 
>>> class BhoopeshBookManager(models.Manager):
>>>def get_queryset(self): 
>>> return super(BhoopeshBookManager, 
>>> self).get_queryset().filter(author='Bhoopesh') 
>>> 
>>> # Then hook it into the Book model explicitly. class Book(models.Model): 
>>> title = models.CharField(max_length=100) 
>>> author = models.CharField(max_length=50)
>>>  # ... 
>>> objects = models.Manager()
>>>  # The default manager. 
>>> 
>>> bhoopesh_objects = BhoopeshBookManager()
>>>  # The Bhoopesh-specific manager.
>>> 
>>> 
>>> Book.bhoopesh_objects.all() # use manager
>>> 
>>> 
>>> Thanks 
>>> Bhoopesh Kumar
>>> 
>>> 
>>> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya  
>>> wrote:
>>> Hi kean,
>>> Please check Expenses Class is not Manager
>>> Please make Manager Class.
>>> 
>>> 
>>> Thanks
>>> Bhoopesh sisoudiya
>>> 
>>> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>>> Hi, 
>>> 
>>> New to Django. when navigating to the reqired view, I get the error above.
>>> 
>>> urls.py
>>> 
>>> path('businesslogin/businessadmin/busproject', views.projectdetail, 
>>> name='projectdetail'),
>>> 
>>> views.py
>>> 
>>> def projectdetail(request):
>>> project = Project.objects.all()
>>> return render(request, 'busprojectdetail.html', {'project': project, 
>>> 'expense_list': project.expenses.all()})
>>> 
>>> models.py
>>> 
>>> # Project model
>>> 
>>> class Project(models.Model):
>>> name = models.CharField(max_length=100)
>>> budget = IntegerField()
>>> 
>>> def save(self, *args, **kwargs):
>>> self.name
>>> super(Project, self).save(*args, **kwargs)
>>> 
>>> # Category manager model
>>> 
>>> 
>>> class Category(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE)
>>> name = models.CharField(max_length=150)
>>> 
>>> 
>>> # Expenses manager model
>>> 
>>> class Expense(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE, related_name='expenses')
>>> title = models.CharField(max_length=100)
>>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>>> 
>>> the error is as follows:
>>> 
>>> 
>>> Exception Type: AttributeError
>>> Exception Value:
>>> 

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
def projectdetail(request):
project = Project.objects.all()
return render(request, 'busprojectdetail.html', {'project': project,
'expense_list': project.expenses.all()})

According to me by this archive you want expense details of each project

Then you write

projectDetails = Project.objects.select_related(your foreign key).values
(select column).all()

Thanks
Bhoopesh sisoudiya


On Sat, Sep 7, 2019, 1:22 AM Kean  wrote:

> Hi,
>
> please ignore the manager it is just a naming convention ignore, it if for
> me to identify tables, if i have 50 table, I want to be able to know which
> model is holding which object information and for what I need it.
>
> Please use below, I have removed the # information to reduce confusion.
>
> models.py
>
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
>
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
>
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
>
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> category = models.ForeignKey(Category, on_delete=models.CASCADE)
> On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya  wrote:
>
> Best wishes,
> Kean
>
> Ok No problem but
> why you want Manager?
>
> Please send me answer
>
> Thanks
> Bhoopesh sisoudiya
>
> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>
>> Hi Bhoopesh
>> Thanks for this, please can you put it into the context of my specific
>> model setup, so I get it right and understand.
>> This will be easier for me as this approach is causing me some other
>> errors, when i try to apply it.
>>
>> Best wishes,
>>
>> Kean
>> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
>>
>> Hi Kean,
>>
>>  Write manager like this ,I give you reference
>>
>> from django.db import models
>>  # First, define the Manager subclass.
>> class BhoopeshBookManager(models.Manager):
>>def get_queryset(self):
>> return super(BhoopeshBookManager,
>> self).get_queryset().filter(author='Bhoopesh')
>>
>> # Then hook it into the Book model explicitly. class Book(models.Model):
>> title = models.CharField(max_length=100)
>> author = models.CharField(max_length=50)
>>  # ...
>> objects = models.Manager()
>>  # The default manager.
>>
>> bhoopesh_objects = BhoopeshBookManager()
>>  # The Bhoopesh-specific manager.
>>
>>
>> Book.bhoopesh_objects.all() # use manager
>>
>>
>> Thanks
>> Bhoopesh Kumar
>>
>>
>> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
>> wrote:
>>
>>> Hi kean,
>>> Please check Expenses Class is not Manager
>>> Please make Manager Class.
>>>
>>>
>>> Thanks
>>> Bhoopesh sisoudiya
>>>
>>> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>>>
 Hi,

 New to Django. when navigating to the reqired view, I get the error
 above.

 urls.py

 path('businesslogin/businessadmin/busproject', views.projectdetail,
 name='projectdetail'),

 views.py

 def projectdetail(request):
 project = Project.objects.all()
 return render(request, 'busprojectdetail.html', {'project':
 project, 'expense_list': project.expenses.all()})

 models.py

 # Project model

 class Project(models.Model):
 name = models.CharField(max_length=100)
 budget = IntegerField()

 def save(self, *args, **kwargs):
 self.name
 super(Project, self).save(*args, **kwargs)

 # Category manager model


 class Category(models.Model):
 project = models.ForeignKey(
 Project, on_delete=models.CASCADE)
 name = models.CharField(max_length=150)


 # Expenses manager model

 class Expense(models.Model):
 project = models.ForeignKey(
 Project, on_delete=models.CASCADE, related_name='expenses')
 title = models.CharField(max_length=100)
 amount = models.DecimalField(max_digits=8, decimal_places=2)
 category = models.ForeignKey(Category, on_delete=models.CASCADE)

 the error is as follows:


 Exception Type: AttributeError
 Exception Value:

 'QuerySet' object has no attribute 'expenses'

 Exception Location: 
 /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py
 in projectdetail, line 238

 Please can anyone help?

 Best

 K


 --
 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 view this discussion on the web visit

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Hi,

please ignore the manager it is just a naming convention ignore, it if for me 
to identify tables, if i have 50 table, I want to be able to know which model 
is holding which object information and for what I need it.

Please use below, I have removed the # information to reduce confusion.

models.py

class Project(models.Model):
name = models.CharField(max_length=100)
budget = IntegerField()

def save(self, *args, **kwargs):
self.name
super(Project, self).save(*args, **kwargs)

class Category(models.Model):
project = models.ForeignKey(
Project, on_delete=models.CASCADE)
name = models.CharField(max_length=150)

class Expense(models.Model):
project = models.ForeignKey(
Project, on_delete=models.CASCADE, related_name='expenses')
title = models.CharField(max_length=100)
amount = models.DecimalField(max_digits=8, decimal_places=2)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
On 6 Sep 2019, at 20:45, Bhoopesh sisoudiya  wrote:

Best wishes,
Kean

> Ok No problem but 
> why you want Manager?
> 
> Please send me answer
> 
> Thanks
> Bhoopesh sisoudiya
> 
> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
> Hi Bhoopesh
> Thanks for this, please can you put it into the context of my specific model 
> setup, so I get it right and understand.
> This will be easier for me as this approach is causing me some other errors, 
> when i try to apply it.
> 
> Best wishes, 
> 
> Kean 
> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
> 
>> Hi Kean,
>> 
>>  Write manager like this ,I give you reference
>> 
>> from django.db import models
>>  # First, define the Manager subclass. 
>> class BhoopeshBookManager(models.Manager):
>>def get_queryset(self): 
>> return super(BhoopeshBookManager, 
>> self).get_queryset().filter(author='Bhoopesh') 
>> 
>> # Then hook it into the Book model explicitly. class Book(models.Model): 
>> title = models.CharField(max_length=100) 
>> author = models.CharField(max_length=50)
>>  # ... 
>> objects = models.Manager()
>>  # The default manager. 
>> 
>> bhoopesh_objects = BhoopeshBookManager()
>>  # The Bhoopesh-specific manager.
>> 
>> 
>> Book.bhoopesh_objects.all() # use manager
>> 
>> 
>> Thanks 
>> Bhoopesh Kumar
>> 
>> 
>> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya  
>> wrote:
>> Hi kean,
>> Please check Expenses Class is not Manager
>> Please make Manager Class.
>> 
>> 
>> Thanks
>> Bhoopesh sisoudiya
>> 
>> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>> Hi, 
>> 
>> New to Django. when navigating to the reqired view, I get the error above.
>> 
>> urls.py
>> 
>> path('businesslogin/businessadmin/busproject', views.projectdetail, 
>> name='projectdetail'),
>> 
>> views.py
>> 
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project': project, 
>> 'expense_list': project.expenses.all()})
>> 
>> models.py
>> 
>> # Project model
>> 
>> class Project(models.Model):
>> name = models.CharField(max_length=100)
>> budget = IntegerField()
>> 
>> def save(self, *args, **kwargs):
>> self.name
>> super(Project, self).save(*args, **kwargs)
>> 
>> # Category manager model
>> 
>> 
>> class Category(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE)
>> name = models.CharField(max_length=150)
>> 
>> 
>> # Expenses manager model
>> 
>> class Expense(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE, related_name='expenses')
>> title = models.CharField(max_length=100)
>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>> 
>> the error is as follows:
>> 
>> 
>> Exception Type:  AttributeError
>> Exception Value: 
>> 'QuerySet' object has no attribute 'expenses'
>> Exception Location:  
>> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
>> line 238
>> 
>> Please can anyone help?
>> 
>> Best 
>> 
>> K
>> 
>> 
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com.
>> 
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAAk3c1NmgbP7cQtyX8uOAFX%3DXbyC6f2ug1FURabwxRgD44Mwpg%40mail.gmail.com.
> 
> 
> -- 
> You received this message because you are subscribed to the Goo

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
Hi kean,

Category and Expense is not Manager model this is only model class.

Thanks
Bhoopesh Kumar



On Sat, Sep 7, 2019, 1:15 AM Bhoopesh sisoudiya 
wrote:

> Ok No problem but
> why you want Manager?
>
> Please send me answer
>
> Thanks
> Bhoopesh sisoudiya
>
> On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:
>
>> Hi Bhoopesh
>> Thanks for this, please can you put it into the context of my specific
>> model setup, so I get it right and understand.
>> This will be easier for me as this approach is causing me some other
>> errors, when i try to apply it.
>>
>> Best wishes,
>>
>> Kean
>> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
>>
>> Hi Kean,
>>
>>  Write manager like this ,I give you reference
>>
>> from django.db import models
>>  # First, define the Manager subclass.
>> class BhoopeshBookManager(models.Manager):
>>def get_queryset(self):
>> return super(BhoopeshBookManager,
>> self).get_queryset().filter(author='Bhoopesh')
>>
>> # Then hook it into the Book model explicitly. class Book(models.Model):
>> title = models.CharField(max_length=100)
>> author = models.CharField(max_length=50)
>>  # ...
>> objects = models.Manager()
>>  # The default manager.
>>
>> bhoopesh_objects = BhoopeshBookManager()
>>  # The Bhoopesh-specific manager.
>>
>>
>> Book.bhoopesh_objects.all() # use manager
>>
>>
>> Thanks
>> Bhoopesh Kumar
>>
>>
>> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
>> wrote:
>>
>>> Hi kean,
>>> Please check Expenses Class is not Manager
>>> Please make Manager Class.
>>>
>>>
>>> Thanks
>>> Bhoopesh sisoudiya
>>>
>>> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>>>
 Hi,

 New to Django. when navigating to the reqired view, I get the error
 above.

 urls.py

 path('businesslogin/businessadmin/busproject', views.projectdetail,
 name='projectdetail'),

 views.py

 def projectdetail(request):
 project = Project.objects.all()
 return render(request, 'busprojectdetail.html', {'project':
 project, 'expense_list': project.expenses.all()})

 models.py

 # Project model

 class Project(models.Model):
 name = models.CharField(max_length=100)
 budget = IntegerField()

 def save(self, *args, **kwargs):
 self.name
 super(Project, self).save(*args, **kwargs)

 # Category manager model


 class Category(models.Model):
 project = models.ForeignKey(
 Project, on_delete=models.CASCADE)
 name = models.CharField(max_length=150)


 # Expenses manager model

 class Expense(models.Model):
 project = models.ForeignKey(
 Project, on_delete=models.CASCADE, related_name='expenses')
 title = models.CharField(max_length=100)
 amount = models.DecimalField(max_digits=8, decimal_places=2)
 category = models.ForeignKey(Category, on_delete=models.CASCADE)

 the error is as follows:


 Exception Type: AttributeError
 Exception Value:

 'QuerySet' object has no attribute 'expenses'

 Exception Location: 
 /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py
 in projectdetail, line 238

 Please can anyone help?

 Best

 K


 --
 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 view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com
 
 .

>>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAAk3c1NmgbP7cQtyX8uOAFX%3DXbyC6f2ug1FURabwxRgD44Mwpg%40mail.gmail.com
>> 
>> .
>>
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/52D49AAA-5E17-4F6C-92DE-E1576F305927%40gmail.com
>> 
>> .
>>
>

-- 
You 

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
Ok No problem but
why you want Manager?

Please send me answer

Thanks
Bhoopesh sisoudiya

On Sat, Sep 7, 2019, 1:06 AM Kean  wrote:

> Hi Bhoopesh
> Thanks for this, please can you put it into the context of my specific
> model setup, so I get it right and understand.
> This will be easier for me as this approach is causing me some other
> errors, when i try to apply it.
>
> Best wishes,
>
> Kean
> On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:
>
> Hi Kean,
>
>  Write manager like this ,I give you reference
>
> from django.db import models
>  # First, define the Manager subclass.
> class BhoopeshBookManager(models.Manager):
>def get_queryset(self):
> return super(BhoopeshBookManager,
> self).get_queryset().filter(author='Bhoopesh')
>
> # Then hook it into the Book model explicitly. class Book(models.Model):
> title = models.CharField(max_length=100)
> author = models.CharField(max_length=50)
>  # ...
> objects = models.Manager()
>  # The default manager.
>
> bhoopesh_objects = BhoopeshBookManager()
>  # The Bhoopesh-specific manager.
>
>
> Book.bhoopesh_objects.all() # use manager
>
>
> Thanks
> Bhoopesh Kumar
>
>
> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
> wrote:
>
>> Hi kean,
>> Please check Expenses Class is not Manager
>> Please make Manager Class.
>>
>>
>> Thanks
>> Bhoopesh sisoudiya
>>
>> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>>
>>> Hi,
>>>
>>> New to Django. when navigating to the reqired view, I get the error
>>> above.
>>>
>>> urls.py
>>>
>>> path('businesslogin/businessadmin/busproject', views.projectdetail,
>>> name='projectdetail'),
>>>
>>> views.py
>>>
>>> def projectdetail(request):
>>> project = Project.objects.all()
>>> return render(request, 'busprojectdetail.html', {'project':
>>> project, 'expense_list': project.expenses.all()})
>>>
>>> models.py
>>>
>>> # Project model
>>>
>>> class Project(models.Model):
>>> name = models.CharField(max_length=100)
>>> budget = IntegerField()
>>>
>>> def save(self, *args, **kwargs):
>>> self.name
>>> super(Project, self).save(*args, **kwargs)
>>>
>>> # Category manager model
>>>
>>>
>>> class Category(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE)
>>> name = models.CharField(max_length=150)
>>>
>>>
>>> # Expenses manager model
>>>
>>> class Expense(models.Model):
>>> project = models.ForeignKey(
>>> Project, on_delete=models.CASCADE, related_name='expenses')
>>> title = models.CharField(max_length=100)
>>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>>>
>>> the error is as follows:
>>>
>>>
>>> Exception Type: AttributeError
>>> Exception Value:
>>>
>>> 'QuerySet' object has no attribute 'expenses'
>>>
>>> Exception Location: 
>>> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py
>>> in projectdetail, line 238
>>>
>>> Please can anyone help?
>>>
>>> Best
>>>
>>> K
>>>
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com
>>> 
>>> .
>>>
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAk3c1NmgbP7cQtyX8uOAFX%3DXbyC6f2ug1FURabwxRgD44Mwpg%40mail.gmail.com
> 
> .
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/52D49AAA-5E17-4F6C-92DE-E1576F305927%40gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAk3c1PtFX7oNie8qZKF

Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Hi Bhoopesh
Thanks for this, please can you put it into the context of my specific model 
setup, so I get it right and understand.
This will be easier for me as this approach is causing me some other errors, 
when i try to apply it.

Best wishes, 

Kean 
On 6 Sep 2019, at 20:19, Bhoopesh sisoudiya  wrote:

> Hi Kean,
> 
>  Write manager like this ,I give you reference
> 
> from django.db import models
>  # First, define the Manager subclass. 
> class BhoopeshBookManager(models.Manager):
>def get_queryset(self): 
> return super(BhoopeshBookManager, 
> self).get_queryset().filter(author='Bhoopesh') 
> 
> # Then hook it into the Book model explicitly. class Book(models.Model): 
> title = models.CharField(max_length=100) 
> author = models.CharField(max_length=50)
>  # ... 
> objects = models.Manager()
>  # The default manager. 
> 
> bhoopesh_objects = BhoopeshBookManager()
>  # The Bhoopesh-specific manager.
> 
> 
> Book.bhoopesh_objects.all() # use manager
> 
> 
> Thanks 
> Bhoopesh Kumar
> 
> 
> On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya  wrote:
> Hi kean,
> Please check Expenses Class is not Manager
> Please make Manager Class.
> 
> 
> Thanks
> Bhoopesh sisoudiya
> 
> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
> Hi, 
> 
> New to Django. when navigating to the reqired view, I get the error above.
> 
> urls.py
> 
> path('businesslogin/businessadmin/busproject', views.projectdetail, 
> name='projectdetail'),
> 
> views.py
> 
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project, 
> 'expense_list': project.expenses.all()})
> 
> models.py
> 
> # Project model
> 
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
> 
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
> 
> # Category manager model
> 
> 
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
> 
> 
> # Expenses manager model
> 
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> category = models.ForeignKey(Category, on_delete=models.CASCADE)
> 
> the error is as follows:
> 
> 
> Exception Type:   AttributeError
> Exception Value:  
> 'QuerySet' object has no attribute 'expenses'
> Exception Location:   
> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
> line 238
> 
> Please can anyone help?
> 
> Best 
> 
> K
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com.
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAAk3c1NmgbP7cQtyX8uOAFX%3DXbyC6f2ug1FURabwxRgD44Mwpg%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52D49AAA-5E17-4F6C-92DE-E1576F305927%40gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
Hi Kean,

 Write manager like this ,I give you reference

from django.db import models
 # First, define the Manager subclass.
class BhoopeshBookManager(models.Manager):
   def get_queryset(self):
return super(BhoopeshBookManager,
self).get_queryset().filter(author='Bhoopesh')

# Then hook it into the Book model explicitly. class Book(models.Model):
title = models.CharField(max_length=100)
author = models.CharField(max_length=50)
 # ...
objects = models.Manager()
 # The default manager.

bhoopesh_objects = BhoopeshBookManager()
 # The Bhoopesh-specific manager.


Book.bhoopesh_objects.all() # use manager


Thanks
Bhoopesh Kumar


On Sat, Sep 7, 2019, 12:34 AM Bhoopesh sisoudiya 
wrote:

> Hi kean,
> Please check Expenses Class is not Manager
> Please make Manager Class.
>
>
> Thanks
> Bhoopesh sisoudiya
>
> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
>
>> Hi,
>>
>> New to Django. when navigating to the reqired view, I get the error above.
>>
>> urls.py
>>
>> path('businesslogin/businessadmin/busproject', views.projectdetail,
>> name='projectdetail'),
>>
>> views.py
>>
>> def projectdetail(request):
>> project = Project.objects.all()
>> return render(request, 'busprojectdetail.html', {'project': project,
>> 'expense_list': project.expenses.all()})
>>
>> models.py
>>
>> # Project model
>>
>> class Project(models.Model):
>> name = models.CharField(max_length=100)
>> budget = IntegerField()
>>
>> def save(self, *args, **kwargs):
>> self.name
>> super(Project, self).save(*args, **kwargs)
>>
>> # Category manager model
>>
>>
>> class Category(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE)
>> name = models.CharField(max_length=150)
>>
>>
>> # Expenses manager model
>>
>> class Expense(models.Model):
>> project = models.ForeignKey(
>> Project, on_delete=models.CASCADE, related_name='expenses')
>> title = models.CharField(max_length=100)
>> amount = models.DecimalField(max_digits=8, decimal_places=2)
>> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>>
>> the error is as follows:
>>
>>
>> Exception Type: AttributeError
>> Exception Value:
>>
>> 'QuerySet' object has no attribute 'expenses'
>>
>> Exception Location: /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py
>> in projectdetail, line 238
>>
>> Please can anyone help?
>>
>> Best
>>
>> K
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAk3c1NmgbP7cQtyX8uOAFX%3DXbyC6f2ug1FURabwxRgD44Mwpg%40mail.gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Kean
Hi, 

Thanks for the help.

The header for each model is # out, so is not read when the code parsed, it is 
just to help me identify the models.
I only have 3 models Project, Category and Expense.

Best wishes,

Kean

On 6 Sep 2019, at 20:04, Bhoopesh sisoudiya  wrote:

> Hi kean,
> Please check Expenses Class is not Manager
> Please make Manager Class.
> 
> 
> Thanks
> Bhoopesh sisoudiya
> 
> On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:
> Hi, 
> 
> New to Django. when navigating to the reqired view, I get the error above.
> 
> urls.py
> 
> path('businesslogin/businessadmin/busproject', views.projectdetail, 
> name='projectdetail'),
> 
> views.py
> 
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project, 
> 'expense_list': project.expenses.all()})
> 
> models.py
> 
> # Project model
> 
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
> 
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
> 
> # Category manager model
> 
> 
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
> 
> 
> # Expenses manager model
> 
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> category = models.ForeignKey(Category, on_delete=models.CASCADE)
> 
> the error is as follows:
> 
> 
> Exception Type:   AttributeError
> Exception Value:  
> 'QuerySet' object has no attribute 'expenses'
> Exception Location:   
> /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py in projectdetail, 
> line 238
> 
> Please can anyone help?
> 
> Best 
> 
> K
> 
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com.
> 
> -- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAAk3c1PoGuLeAsnJoEUuB1LdZw8SwpJDFy51%3Di89%2BAv_Zd1sOA%40mail.gmail.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/72107009-5D9C-4EC6-8D4D-233A244E8563%40gmail.com.


Re: AttributeError 'QuerySet' object has no attribute 'expenses'

2019-09-06 Thread Bhoopesh sisoudiya
Hi kean,
Please check Expenses Class is not Manager
Please make Manager Class.


Thanks
Bhoopesh sisoudiya

On Sat, Sep 7, 2019, 12:20 AM Kean  wrote:

> Hi,
>
> New to Django. when navigating to the reqired view, I get the error above.
>
> urls.py
>
> path('businesslogin/businessadmin/busproject', views.projectdetail,
> name='projectdetail'),
>
> views.py
>
> def projectdetail(request):
> project = Project.objects.all()
> return render(request, 'busprojectdetail.html', {'project': project,
> 'expense_list': project.expenses.all()})
>
> models.py
>
> # Project model
>
> class Project(models.Model):
> name = models.CharField(max_length=100)
> budget = IntegerField()
>
> def save(self, *args, **kwargs):
> self.name
> super(Project, self).save(*args, **kwargs)
>
> # Category manager model
>
>
> class Category(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE)
> name = models.CharField(max_length=150)
>
>
> # Expenses manager model
>
> class Expense(models.Model):
> project = models.ForeignKey(
> Project, on_delete=models.CASCADE, related_name='expenses')
> title = models.CharField(max_length=100)
> amount = models.DecimalField(max_digits=8, decimal_places=2)
> category = models.ForeignKey(Category, on_delete=models.CASCADE)
>
> the error is as follows:
>
>
> Exception Type: AttributeError
> Exception Value:
>
> 'QuerySet' object has no attribute 'expenses'
>
> Exception Location: /Users/ProductionEnv/Desktop/test/test1/dev/core/views.py
> in projectdetail, line 238
>
> Please can anyone help?
>
> Best
>
> K
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/024bc998-b683-41ae-90e2-d33f4527913a%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAk3c1PoGuLeAsnJoEUuB1LdZw8SwpJDFy51%3Di89%2BAv_Zd1sOA%40mail.gmail.com.


Re: AttributeError 'QuerySet' object has no attribute '_meta'

2019-08-18 Thread Kean Dumba
Ok thanks is there a way to call all objects, as this is more user friendly
and efficient when potentially editing many object fields?

On Sun, 18 Aug 2019 at 18:05, Daniel Roseman  wrote:

> You can't pass *all* the objects to the form. You have to get the specific
> one you want to edit and pass that as the instance.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e78cfd54-9800-4c17-b8a4-0ffaf5ddcfd4%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKvrVZO_rKiPOm9ZLZ%2BmiUpTgUy-xim%2Br7s8kRWskThHtndjpw%40mail.gmail.com.


Re: AttributeError at /admin/login/

2018-05-01 Thread Gerald Brown
Finally solved this problem by installing python3-dev & 
libmysqlclient-dev and then I was able to install mysqlclient.


Case closed!!!


On Tuesday, 01 May, 2018 07:09 PM, Gerald Brown wrote:
As a follow-up with further information.  This error occurs when on 
the Admin login screen I enter the user name and password and then 
click "SUBMIT".


The Exception Location is: 
"/home/medrec2/.virtualenvs/medrecproj/lib/python3.5/site-packages/*mysql*/connector/conversion.py 
in _DATETIME_to_python, line 506".


Is there another db connector I can use to connect to the Mariadb 
database?


On Tuesday, May 1, 2018 at 7:45:47 AM UTC+8, Gerald Brown wrote:

I had replied to Daniel Roseman instead of to the users group as I
am new to this group.

Thanks to Daniel for his response



 Forwarded Message --------
Subject:Re: AttributeError at /admin/login/
Date:   Mon, 30 Apr 2018 21:46:35 +0800
From:   Gerald Brown
To: Daniel Roseman




No. You need to show the full traceback.
--
DR.
-- 

Here is the full traceback.  It is quite long.


  AttributeError at /admin/login/

'datetime.datetime' object has no attribute 'split'

Request Method: POST
Request URL:http://192.168.0.122/admin/login/?next=/admin/
<http://192.168.0.122/admin/login/?next=/admin/>
Django Version: 2.0.4
Exception Type: AttributeError
Exception Value:

'datetime.datetime' object has no attribute 'split'

Exception Location:

/home/medrec2/.local/lib/python3.6/site-packages/mysql/connector/conversion.py
in _DATETIME_to_python, line 506
Python Executable:
/home/medrec2/.virtualenvs/medrecproj/bin/python3.6
Python Version: 3.6.5
Python Path:

['/home/medrec2/medrecproj',
  '/home/medrec2/.virtualenvs/medrecproj/bin',
  '/usr/local/lib/python36.zip',
  '/usr/local/lib/python3.6',
  '/usr/local/lib/python3.6/lib-dynload',
  '/home/medrec2/.local/lib/python3.6/site-packages',
  '/usr/local/lib/python3.6/site-packages']

Server time:Sun, 29 Apr 2018 18:31:23 +0800


Traceback Switch to copy-and-paste view
<http://192.168.0.122/admin/login/?next=/admin/#>

  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/exception.py|
in |inner|
   35.

 response = get_response(request)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py|
in |_get_response|
  128.

 response = self.process_exception_by_middleware(e, 
request)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py|
in |_get_response|
  126.

 response = wrapped_callback(request, 
*callback_args, **callback_kwargs)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/cache.py|
in |_wrapped_view_func|
   44.

 response = view_func(request, *args, **kwargs)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/contrib/admin/sites.py|
in |login|
  398.

 return LoginView.as_view(**defaults)(request)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/generic/base.py|
in |view|
   69.

 return self.dispatch(request, *args, **kwargs)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
in |_wrapper|
   62.

 return bound_func(*args, **kwargs)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/debug.py|
in |sensitive_post_parameters_wrapper|
   76.

 return view(request, *args, **kwargs)

...
▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
  * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
in |bound_func|
   58.

 return func.__get__(self, type(self))(*args2, 
**kwargs2)


Re: Re: AttributeError at /admin/login/

2018-05-01 Thread Gerald Brown
As a follow-up with further information.  This error occurs when on the 
Admin login screen I enter the user name and password and then click 
"SUBMIT".

The Exception Location is: 
"/home/medrec2/.virtualenvs/medrecproj/lib/python3.5/site-packages/mysql/connector/conversion.py
 
in _DATETIME_to_python, line 506".

Is there another db connector I can use to connect to the Mariadb database?

On Tuesday, May 1, 2018 at 7:45:47 AM UTC+8, Gerald Brown wrote:
>
> I had replied to Daniel Roseman instead of to the users group as I am new 
> to this group.
>
> Thanks to Daniel for his response 
>
>
> ---- Forwarded Message  
> Subject: Re: AttributeError at /admin/login/ 
> Date: Mon, 30 Apr 2018 21:46:35 +0800 
> From: Gerald Brown  
> To: Daniel Roseman  
>
> No. You need to show the full traceback.
> --
> DR. 
> -- 
>
> Here is the full traceback.  It is quite long.
>
> AttributeError at /admin/login/ 
>
> 'datetime.datetime' object has no attribute 'split'
>
> Request Method: POST 
> Request URL: http://192.168.0.122/admin/login/?next=/admin/ 
> Django Version: 2.0.4 
> Exception Type: AttributeError 
> Exception Value: 
>
> 'datetime.datetime' object has no attribute 'split'
>
> Exception Location: 
> /home/medrec2/.local/lib/python3.6/site-packages/mysql/connector/conversion.py
>  
> in _DATETIME_to_python, line 506 
> Python Executable: /home/medrec2/.virtualenvs/medrecproj/bin/python3.6 
> Python Version: 3.6.5 
> Python Path: 
>
> ['/home/medrec2/medrecproj',
>  '/home/medrec2/.virtualenvs/medrecproj/bin',
>  '/usr/local/lib/python36.zip',
>  '/usr/local/lib/python3.6',
>  '/usr/local/lib/python3.6/lib-dynload',
>  '/home/medrec2/.local/lib/python3.6/site-packages',
>  '/usr/local/lib/python3.6/site-packages']
>
> Server time: Sun, 29 Apr 2018 18:31:23 +0800 
> Traceback Switch to copy-and-paste view 
> <http://192.168.0.122/admin/login/?next=/admin/#> 
>
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/exception.py
>  
>in inner 
>1. 
>   
>   response = get_response(request)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py 
>in _get_response 
>1. 
>   
>   response = self.process_exception_by_middleware(e, 
> request)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py 
>in _get_response 
>1. 
>   
>   response = wrapped_callback(request, *callback_args, 
> **callback_kwargs)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/cache.py
>  
>in _wrapped_view_func 
>1. 
>   
>   response = view_func(request, *args, **kwargs)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/contrib/admin/sites.py
>  
>in login 
>1. 
>   
>   return LoginView.as_view(**defaults)(request)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/views/generic/base.py 
>in view 
>1. 
>   
>   return self.dispatch(request, *args, **kwargs)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py 
>in _wrapper 
>1. 
>   
>   return bound_func(*args, **kwargs)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/debug.py
>  
>in sensitive_post_parameters_wrapper 
>1. 
>   
>   return view(request, *args, **kwargs)
>   
>   ... 
>▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#> 
>- 
>
> /home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py 

Fwd: Re: AttributeError at /admin/login/

2018-04-30 Thread Gerald Brown
I had replied to Daniel Roseman instead of to the users group as I am 
new to this group.


Thanks to Daniel for his response



 Forwarded Message 
Subject:Re: AttributeError at /admin/login/
Date:   Mon, 30 Apr 2018 21:46:35 +0800
From:   Gerald Brown 
To: Daniel Roseman 




No. You need to show the full traceback.
--
DR.
--

Here is the full traceback.  It is quite long.


 AttributeError at /admin/login/

'datetime.datetime' object has no attribute 'split'

Request Method: POST
Request URL:http://192.168.0.122/admin/login/?next=/admin/
Django Version: 2.0.4
Exception Type: AttributeError
Exception Value:

'datetime.datetime' object has no attribute 'split'

Exception Location: 
/home/medrec2/.local/lib/python3.6/site-packages/mysql/connector/conversion.py 
in _DATETIME_to_python, line 506

Python Executable:  /home/medrec2/.virtualenvs/medrecproj/bin/python3.6
Python Version: 3.6.5
Python Path:

['/home/medrec2/medrecproj',
 '/home/medrec2/.virtualenvs/medrecproj/bin',
 '/usr/local/lib/python36.zip',
 '/usr/local/lib/python3.6',
 '/usr/local/lib/python3.6/lib-dynload',
 '/home/medrec2/.local/lib/python3.6/site-packages',
 '/usr/local/lib/python3.6/site-packages']

Server time:Sun, 29 Apr 2018 18:31:23 +0800


   Traceback Switch to copy-and-paste view
   <http://192.168.0.122/admin/login/?next=/admin/#>

 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/exception.py|
   in |inner|
   35.

response = get_response(request)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py|
   in |_get_response|
  128.

response = self.process_exception_by_middleware(e, 
request)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/core/handlers/base.py|
   in |_get_response|
  126.

response = wrapped_callback(request, *callback_args, 
**callback_kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/cache.py|
   in |_wrapped_view_func|
   44.

response = view_func(request, *args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/contrib/admin/sites.py|
   in |login|
  398.

return LoginView.as_view(**defaults)(request)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/generic/base.py|
   in |view|
   69.

return self.dispatch(request, *args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |_wrapper|
   62.

return bound_func(*args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local/lib/python3.6/site-packages/django/views/decorators/debug.py|
   in |sensitive_post_parameters_wrapper|
   76.

return view(request, *args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |bound_func|
   58.

return func.__get__(self, type(self))(*args2, **kwargs2)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |_wrapper|
   62.

return bound_func(*args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |_wrapped_view|
  142.

response = view_func(request, *args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |bound_func|
   58.

return func.__get__(self, type(self))(*args2, **kwargs2)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * |/home/medrec2/.local/lib/python3.6/site-packages/django/utils/decorators.py|
   in |_wrapper|
   62.

return bound_func(*args, **kwargs)

   ...
   ▶ Local vars <http://192.168.0.122/admin/login/?next=/admin/#>
 * 
|/home/medrec2/.local

Re: AttributeError at /admin/login/

2018-04-30 Thread Daniel Roseman
n Monday, 30 April 2018 13:30:54 UTC+1, Gerald Brown wrote:
>
> I am getting the following error when I TRY to log in to my site
> "AttributeError at /admin/login/ 
>
> 'datetime.datetime' object has no attribute 'split'"
>
> This looks like a Django bug as it is in the Admin module and is NOT related 
> to any of my code.
>
> Does anyone have any idea why this is happening???
>
> Thanks.
>
>

No. You need to show the full traceback.
--
DR. 

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cab9c72e-bf78-4f27-8f00-e2314a8694c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread PASCUAL Eric
Maybe it works like this in Windows (I don't know since having left this world 
since long now), but Greng mentioned a Debian environment inside his Docker 
container. Hence my remark.


By the way you mentioned "DLLs". Geng's trouble seems to be related to Python 
packages finding, not binary libs. In Linux, they are governed by different 
search paths.


Eric


From: django-users@googlegroups.com  on behalf 
of Matthew Pava 
Sent: Wednesday, February 14, 2018 4:05:57 PM
To: 'django-users@googlegroups.com'
Subject: RE: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2


I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs 
in my WSGI configuration in my Apache configuration file.

WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs;



From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of PASCUAL Eric
Sent: Wednesday, February 14, 2018 8:52 AM
To: Django users
Subject: Re: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2



Hi,



Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.



I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.



Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.



Best



Eric



From: django-users@googlegroups.com<mailto:django-users@googlegroups.com> 
mailto:django-users@googlegroups.com>> on behalf 
of Greng Fortezza mailto:greng@gmail.com>>
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2



Hi,



I'm trying to set up the following configuration in Docker

python: 3.6.4

Django: 2.0.2

Apache/2.4.10 (Debian)



First, I was getting the error



ImportError: No module named django.core.wsgi



Then I added Django to PYTHONPATH



export PYTHONPATH="/usr/local/lib/python3.6/site-packages"



the previous problem has gone away but now there is another one



AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line



WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.



What could be wrong?



Thanks,

Greng

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com<https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/django-users/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https

RE: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread Matthew Pava
I’m not familiar with Docker, but I did have to add the path to Python 3.6 DLLs 
in my WSGI configuration in my Apache configuration file.
WSGIPythonPath ${project_path};${virtualenv};C:/Python36/DLLs;

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of PASCUAL Eric
Sent: Wednesday, February 14, 2018 8:52 AM
To: Django users
Subject: Re: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2


Hi,



Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.



I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.



Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.



Best


Eric

From: django-users@googlegroups.com<mailto:django-users@googlegroups.com> 
mailto:django-users@googlegroups.com>> on behalf 
of Greng Fortezza mailto:greng@gmail.com>>
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2

Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng
--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com<https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM<https://groups.google.com/d/msgid/django-users/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f0cabae1fd6544528668a9494f6dfe03%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'lru_cache' with python 3.6.4 and Django 2.0.2

2018-02-14 Thread PASCUAL Eric
Hi,


Normally you shouldn't have to add site-packages in the PYTHONPATH since it is 
supposed to be already. If not, packages installed via "sudo pip install" would 
not be found.


I've packaged a lot of applications in Docker containers, and never had to 
modify PYTHONPATH.


Your problem is maybe be lurking elsewhere than PYTHONPATH, and this change has 
just created a new one which is hiding the original one, but not solving it at 
all.


Best


Eric


From: django-users@googlegroups.com  on behalf 
of Greng Fortezza 
Sent: Wednesday, February 14, 2018 3:02:28 PM
To: Django users
Subject: AttributeError: 'module' object has no attribute 'lru_cache' with 
python 3.6.4 and Django 2.0.2

Hi,

I'm trying to set up the following configuration in Docker
python: 3.6.4
Django: 2.0.2
Apache/2.4.10 (Debian)

First, I was getting the error

ImportError: No module named django.core.wsgi

Then I added Django to PYTHONPATH

export PYTHONPATH="/usr/local/lib/python3.6/site-packages"

the previous problem has gone away but now there is another one

AttributeError: 'module' object has no attribute 'lru_cache'

Apache configs contains the following line

WSGIScriptAlias / /www/settings/wsgi.py

where /www/settings/wsgi.py is  actual path to wsgi.py file.

What could be wrong?

Thanks,
Greng

--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/02803efb-92a9-4958-9a52-f77bee7de89b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/AM5P193MB008328E4760DBF0DA724D2238CF50%40AM5P193MB0083.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-24 Thread Web Architect
Figured out why the issue was occurring. I had written a cache decorator to 
cache based on per user:

def cache_per_user_method(ttl=None, prefix=None, cache_post=False):

'''

Decorator which caches the view for each User

* ttl - the cache lifetime, do not send this parameter means that the 
cache

  will last until the restart server or decide to remove it

* prefix - Prefix to use to store the response in the cache. If not 
informed,

  it will be used 'view_cache _' + function.__ name__

* cache_post - Determine whether to make requests cache POST

* The caching for anonymous users is shared with everyone


How to use it:

@cache_per_user_method(ttl=3600, cache_post=False)

def get(self, request):

...

'''

def decorator(view_method):

def apply_cache(obj, request, *args, **kwargs):


CACHE_KEY = cache_key(request, prefix)


logger.debug("cache key %s",CACHE_KEY)


# Verifica se pode fazer o cache do request

if not cache_post and request.method == 'POST':

can_cache = False

else:

can_cache = True


if can_cache:

response = core_cache.get(CACHE_KEY, None)

else:

response = None


if not response:

response = view_method(obj, request, *args, **kwargs)

logger.debug("cache not found in decorator")

if can_cache and hasattr(response, 'render'):

logger.debug("cache set in decorator")

core_cache.set(CACHE_KEY, response.render(), ttl)

return response

return apply_cache


The above code was causing the error to happen but couldn't figure out 
where the issue was in the above. 


Thanks,

On Wednesday, November 22, 2017 at 9:44:59 PM UTC+5:30, Tim Graham wrote:
>
> I tried a Google search for the last line of the error message and came to 
> https://code.djangoproject.com/ticket/25964. Conclusion: try clearing 
> your cache.
>
> On Wednesday, November 22, 2017 at 3:29:42 AM UTC-5, Web Architect wrote:
>>
>> Hi,
>>
>> We recently migrated from Django 1.8 to Django 1.11.7. We have an 
>> ecommerece site running on Django. When we are trying to access a page, 
>> following exception is occuring:
>>
>> Traceback (most recent call last):
>>
>>   File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run
>>
>> self.result = application(self.environ, self.start_response)
>>
>>   File 
>> "/virenv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py",
>>  
>> line 63, in __call__
>>
>> return self.application(environ, start_response)
>>
>>   File 
>> "/virenv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 
>> 161, in __call__
>>
>> status = '%d %s' % (response.status_code, response.reason_phrase)
>>
>>   File "/virenv/lib/python2.7/site-packages/django/http/response.py", 
>> line 69, in reason_phrase
>>
>> if self._reason_phrase is not None:
>>
>> AttributeError: 'TemplateResponse' object has no attribute 
>> '_reason_phrase'
>>
>>
>> I am completely clueless why the above exception is occurring. I do not 
>> have any other data or logs for the above exception
>>
>>
>> Could anyone help me in providing a way to debug the above?
>>
>>
>> Thanks.
>>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27d1281c-2d9f-44f3-a6a3-d2e6672310c7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-22 Thread Tim Graham
I tried a Google search for the last line of the error message and came to 
https://code.djangoproject.com/ticket/25964. Conclusion: try clearing your 
cache.

On Wednesday, November 22, 2017 at 3:29:42 AM UTC-5, Web Architect wrote:
>
> Hi,
>
> We recently migrated from Django 1.8 to Django 1.11.7. We have an 
> ecommerece site running on Django. When we are trying to access a page, 
> following exception is occuring:
>
> Traceback (most recent call last):
>
>   File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run
>
> self.result = application(self.environ, self.start_response)
>
>   File 
> "/virenv/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", 
> line 63, in __call__
>
> return self.application(environ, start_response)
>
>   File 
> "/virenv/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 
> 161, in __call__
>
> status = '%d %s' % (response.status_code, response.reason_phrase)
>
>   File "/virenv/lib/python2.7/site-packages/django/http/response.py", 
> line 69, in reason_phrase
>
> if self._reason_phrase is not None:
>
> AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'
>
>
> I am completely clueless why the above exception is occurring. I do not 
> have any other data or logs for the above exception
>
>
> Could anyone help me in providing a way to debug the above?
>
>
> Thanks.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27e97e12-d7bd-482b-835f-3dd9f82d7170%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TemplateResponse' object has no attribute '_reason_phrase'

2017-11-22 Thread Jason
what is the code for the render call?

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/08ba6d49-7d3e-4fb7-a69c-dbb060e1c1fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError When Overwritting AUTH_USER_MODEL in Test Cases

2017-10-19 Thread sarfaraz ahmed
I am getting similar issue. No reply on your question. Please share the 
solution if you found


On Monday, 8 February 2016 19:50:07 UTC+5:30, Aubrey Stark-Toller wrote:
>
> Hello, 
>
> When I override the AUTH_USER_MODEL setting to "auth.User",  when 
> AUTH_USER_MODEL in settings is not set to "auth.User", in 
> either a TestCase or individual test, and then try to access the objects 
> attribute on the user model, I get an AttributeError. 
>
> The exact error I get is: 
> AttributeError: Manager isn't available; 'auth.User' has been swapped 
> for 'None' 
>
> I've found this to be the case in both Django 1.8 and 1.9. 
>
> This is easily reproducible in a fresh project : create a boilerplate 
> project with a boilerplate app, add a new user model (call it 
> CustomUser) to the app and set to AUTH_USER_MODEL to CustomUser, and add 
> the following test case to the app: 
>
> > from django.test import TestCase, override_settings 
> > from django.contrib.auth import get_user_model 
> > 
> > class MyTestCase(TestCase): 
> >@override_settings(AUTH_USER_MODEL = 'auth.User') 
> >def test_custom_user(self): 
> >UserModel = get_user_model() 
> >UserModel.objects.all() 
>
> get_user_model() retrieves the correct model but accessing objects 
> attribute gives the stated error when running the test. 
>
> If I throw in another user model (say CustomerUser2) and write a test 
> such as: 
>
> >@override_settings(AUTH_USER_MODEL = 'another_app.CustomerUser2') 
> >def test_custom_user(self): 
> >UserModel = get_user_model() 
> >UserModel.objects.all() 
>
> this works fine, and if I unset AUTH_USER_MODEL in settings again 
> everything works as expected. 
>
> Perhaps someone can shed some light on this behavior? 
>
> Cheers, 
> Aubrey 
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20fc529a-8452-40f6-8a6e-e8a11cdc2bd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'Settings' object has no attribute 'SATIC_ROOT'

2017-09-21 Thread Lachlan Musicman
The problem's right there in the error. there is no satic_root. In urls.py



*urlpatterns += static(settings.STATIC_URL,
document_root=settings.SATIC_ROOT)*
Should read


*urlpatterns += static(settings.STATIC_URL,
document_root=settings.STATIC_ROOT)*
Cheers
L.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAGBeqiMvESc3WMpgJyoM2stwD8V9kS8YFP%2Bq1RmXJZUXgyDJDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'SubfieldBase'

2017-08-07 Thread Tim Graham
>From https://bitbucket.org/schinckel/django-timedelta-field: "If you are 
using Django 1.8 or greater (and you really _should_ be), then you should 
use the included DurationField() instead of this. This field does not work 
with Django 1.10, and will probably not be updated to fix the issue(s). 
When migrating TimedeltaField to DurationField using Django migrations, 
alter any migrations that have an import to this library to mention the new 
field type, this works to prevent Django from crashing when trying to run 
the deprecated code."

On Monday, August 7, 2017 at 3:52:15 PM UTC-4, ahmed dawod wrote:
>
> I'm working on a project that was built using an earlier version of 
> django. My environment has the latest Django version (1.11.4). 
> When I try to "python manage.py runserver" I get this: 
>
> Unhandled exception in thread started by >> 0x7fb1dab36cf8>
>>
>> Traceback (most recent call last):
>>
>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 
>>> 228, in wrapper
>>
>> fn(*args, **kwargs)
>>
>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py",
>>>  
>>> line 117, in inner_run
>>
>> autoreload.raise_last_exception()
>>
>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 
>>> 251, in raise_last_exception
>>
>> six.reraise(*_exception)
>>
>>   File 
>>> "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 
>>> 228, in wrapper
>>
>> fn(*args, **kwargs)
>>
>>   File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 
>>> 27, in setup
>>
>> apps.populate(settings.INSTALLED_APPS)
>>
>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", 
>>> line 108, in populate
>>
>> app_config.import_models()
>>
>>   File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", 
>>> line 202, in import_models
>>
>> self.models_module = import_module(models_module_name)
>>
>>   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in 
>>> import_module
>>
>> __import__(name)
>>
>>   File 
>>> "/home/ahmedn1/Documents/Paymob/wallet_executive_panel-master-c109bd6fe9cd1bf793c11a5c2e97d18a1887c3ba/accounts/models.py",
>>>  
>>> line 8, in 
>>
>> import timedelta
>>
>>   File "/usr/local/lib/python2.7/dist-packages/timedelta/__init__.py", 
>>> line 11, in 
>>
>> from .fields import TimedeltaField
>>
>>   File "/usr/local/lib/python2.7/dist-packages/timedelta/fields.py", line 
>>> 18, in 
>>
>> class TimedeltaField(six.with_metaclass(models.SubfieldBase, 
>>> models.Field)):
>>
>> AttributeError: 'module' object has no attribute 'SubfieldBase'
>>
>>
> So the problem is with the django-timedeltafield package but its version 
> is 0.7.10 which is the latest version. So, why does it still have a problem 
> with this deprecated SubfieldBase? 
>
> What should I do to solve the problem?  
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/432839fb-0640-470f-a84a-7a107f4883f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: module 'polls.views' has no attribute 'index'

2017-04-19 Thread Billy Lin
Thanks for your reploy.

Actually I followed the tutorial exactly.

My polls/views.py has:

from django.http import HttpResponse


def index(request):
return HttpResponse("Hello, world. You're at the polls index.")

My polls/urls.py has:

from django.conf.urls import url

from . import views

urlpatterns = [
url(r'^$', views.index, name='index'),
]


On Wednesday, 19 April 2017 15:43:57 UTC+2, m712 - Developer wrote:

> You didn't give us enough info, but I am thinking that you don't have an 
> index() function in your polls/views.py. Start the tutorial from the 
> beginning and follow it closely.
> On Apr 19, 2017 4:17 PM, Billy Lin > wrote:
>
> I'm following the getting started tutorial 01 and running into issues 
> after creating the polls app. Can someone please help?
>
> I'm using Python 3.6.1 and Django 1.11.
>
> Here's the detailed trace:
>
> Performing system checks...
> Unhandled exception in thread started by  check_errors..wrapper at 0x04222810>
> Traceback (most recent call last):
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py",
>  
> line
> 227, in wrapper
> fn(*args, **kwargs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\ru
> nserver.py", line 125, in inner_run
> self.check(display_num_errors=True)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>  
> l
> ine 359, in check
> include_deployment_checks=include_deployment_checks,
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py",
>  
> l
> ine 346, in _run_checks
> return checks.run_checks(**kwargs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py",
>  
> l
> ine 81, in run_checks
> new_errors = check(app_configs=app_configs)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>  
> line
> 16, in check_url_config
> return check_resolver(resolver)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py",
>  
> line
> 26, in check_resolver
> return check_method()
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 25
> 4, in check
> for pattern in self.url_patterns:
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>  
> line
> 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 40
> 5, in url_patterns
> patterns = getattr(self.urlconf_module, "urlpatterns", 
> self.urlconf_module)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py",
>  
> line
> 35, in __get__
> res = instance.__dict__[self.name] = self.func(instance)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py",
>  
> line 39
> 8, in urlconf_module
> return import_module(self.urlconf_name)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>  
> line 126, in import_modu
> le
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 978, in _gcd_import
>   File "", line 961, in _find_and_load
>   File "", line 950, in 
> _find_and_load_unlocked
>   File "", line 655, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 205, in 
> _call_with_frames_removed
>   File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, in 
> 
> url(r'^polls/', include('polls.urls')),
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py",
>  
> lin
> e 50, in include
> urlconf_module = import_module(urlconf_module)
>   File 
> "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py",
>  
> line 126, in import_modu
> le
> return _bootstrap._gcd_import(name[level:], package, level)
>   File "", line 978, in _gcd_import
>   File "", line 961, in _find_and_load
>   File "", line 950, in 
> _find_and_load_unlocked
>   File "", line 655, in _load_unlocked
>   File "", line 678, in exec_module
>   File "", line 205, in 
> _call_with_frames_removed
>   File "C:\Users\cephalin\Repos\django\mysite\polls\urls.py", line 6, in 
> 
> url(r'^$', views.index, name='index'),
> AttributeError: module 'polls.views' has no attribute 'index'
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" gr

Re: AttributeError: module 'polls.views' has no attribute 'index'

2017-04-19 Thread m712 - Developer
You didn't give us enough info, but I am thinking that you don't have an index() function in your polls/views.py. Start the tutorial from the beginning and follow it closely.
On Apr 19, 2017 4:17 PM, Billy Lin  wrote:I'm following the getting started tutorial 01 and running into issues after creating the polls app. Can someone please help?I'm using Python 3.6.1 and Django 1.11.Here's the detailed trace:Performing system checks...Unhandled exception in thread started by .wrapper at 0x04222810>Traceback (most recent call last):  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line227, in wrapper    fn(*args, **kwargs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_run    self.check(display_num_errors=True)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 359, in check    include_deployment_checks=include_deployment_checks,  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 346, in _run_checks    return checks.run_checks(**kwargs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks    new_errors = check(app_configs=app_configs)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line16, in check_url_config    return check_resolver(resolver)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\checks\urls.py", line26, in check_resolver    return check_method()  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 254, in check    for pattern in self.url_patterns:  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line35, in __get__    res = instance.__dict__[self.name] = self.func(instance)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 405, in url_patterns    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\functional.py", line35, in __get__    res = instance.__dict__[self.name] = self.func(instance)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_module    return import_module(self.urlconf_name)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "", line 978, in _gcd_import  File "", line 961, in _find_and_load  File "", line 950, in _find_and_load_unlocked  File "", line 655, in _load_unlocked  File "", line 678, in exec_module  File "", line 205, in _call_with_frames_removed  File "C:\Users\cephalin\Repos\django\mysite\mysite\urls.py", line 20, in     url(r'^polls/', include('polls.urls')),  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\conf\urls\__init__.py", line 50, in include    urlconf_module = import_module(urlconf_module)  File "C:\Users\cephalin\AppData\Local\Programs\Python\Python36-32\lib\importlib\__init__.py", line 126, in import_module    return _bootstrap._gcd_import(name[level:], package, level)  File "", line 978, in _gcd_import  File "", line 961, in _find_and_load  File "", line 950, in _find_and_load_unlocked  File "", line 655, in _load_unlocked  File "", line 678, in exec_module  File "", line 205, in _call_with_frames_removed  File "C:\Users\cephalin\Repos\django\mysite\polls\urls.py", line 6, in     url(r'^$', views.index, name='index'),AttributeError: module 'polls.views' has no attribute 'index'



-- 
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b77a1a74-b07f-4277-98da-23b46ca7d2e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




-- 
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 https://groups.google.com/group/django

Re: AttributeError overriding save_existing_objects in Formset class

2016-08-10 Thread Constantine Covtushenko
I believe that you should also override `save` method with your
commit=False.

That `save` method and `save_existing_objects` method works in sync. It is
supposed that they should have the same `commit` value.

Hope that helps,

On Wed, Aug 10, 2016 at 10:14 AM, Vincenzo  wrote:

> The Django version I'm using is the 1.9.4
>
> Il giorno martedì 9 agosto 2016 22:04:57 UTC+2, Constantine Covtushenko ha
> scritto:
>>
>> Hi Vincenzo,
>>
>> Can you please specify Django version that you are using.
>>
>> Regards,
>>
>> On Tue, Aug 9, 2016 at 6:06 PM, Vincenzo  wrote:
>>
>>> Hi there,
>>> I'm using the admin and I have a form admin  and an inline admin form.
>>> For this inline admin, I need to ignore modifications done for existing
>>> items: for this task I have done an override of save_existing_objects
>>> method for a Formset which inherit from forms.models.BaseInlineFormset.
>>> In this function I simply call the super with commit=False but doing that
>>> cause the following error:
>>>
>>> traceback (most recent call last):
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/core/handlers/base.py", line 149, in get_response
>>> response = self.process_exception_by_middleware(e, request)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/core/handlers/base.py", line 147, in get_response
>>> response = wrapped_callback(request, *callback_args, **
>>> callback_kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/options.py", line 541, in wrapper
>>> return self.admin_site.admin_view(view)(*args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/utils/decorators.py", line 149, in _wrapped_view
>>> response = view_func(request, *args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/views/decorators/cache.py", line 57, in
>>> _wrapped_view_func
>>> response = view_func(request, *args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/sites.py", line 244, in inner
>>> return view(request, *args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/reversion/admin.py", line 186, in change_view
>>> return super(VersionAdmin, self).change_view(request, object_id,
>>> form_url, extra_context)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/options.py", line 1440, in change_view
>>> return self.changeform_view(request, object_id, form_url,
>>> extra_context)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/utils/decorators.py", line 67, in _wrapper
>>> return bound_func(*args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/utils/decorators.py", line 149, in _wrapped_view
>>> response = view_func(request, *args, **kwargs)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/utils/decorators.py", line 63, in bound_func
>>> return func.__get__(self, type(self))(*args2, **kwargs2)
>>>   File "/usr/lib/python3.4/contextlib.py", line 30, in inner
>>> return func(*args, **kwds)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/options.py", line 1379, in changeform_view
>>> self.save_related(request, form, formsets, not add)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/options.py", line 1015, in save_related
>>> self.save_formset(request, form, formset, change=change)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/contrib/admin/options.py", line 1003, in save_formset
>>> formset.save()
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/forms/models.py", line 645, in save
>>> return self.save_existing_objects(commit) + self.save_new_objects(
>>> commit)
>>>   File "/home/vincenzo/workspace/mynetgest2/warehouse/forms.py", line
>>> 118, in save_existing_objects
>>> instances_not_saved = super(IncomingBillOfLadingRowFormset, self).
>>> save_existing_objects(commit=False)
>>>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
>>> packages/django/forms/models.py", line 763, in save_existing_objects
>>> self.saved_forms.append(form)
>>> AttributeError: 'IncomingBillOfLadingRowFormFormSet' object has no
>>> attribute 'saved_forms'
>>>
>>> Is there something I'm doing wrong?
>>>
>>> --
>>> 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.

Re: AttributeError overriding save_existing_objects in Formset class

2016-08-10 Thread Vincenzo
The Django version I'm using is the 1.9.4

Il giorno martedì 9 agosto 2016 22:04:57 UTC+2, Constantine Covtushenko ha 
scritto:
>
> Hi Vincenzo,
>
> Can you please specify Django version that you are using.
>
> Regards,
>
> On Tue, Aug 9, 2016 at 6:06 PM, Vincenzo > 
> wrote:
>
>> Hi there,
>> I'm using the admin and I have a form admin  and an inline admin form. 
>> For this inline admin, I need to ignore modifications done for existing 
>> items: for this task I have done an override of save_existing_objects 
>> method for a Formset which inherit from forms.models.BaseInlineFormset. In 
>> this function I simply call the super with commit=False but doing that 
>> cause the following error:
>>
>> traceback (most recent call last):
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/core/handlers/base.py"
>> , line 149, in get_response
>> response = self.process_exception_by_middleware(e, request)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/core/handlers/base.py"
>> , line 147, in get_response
>> response = wrapped_callback(request, *callback_args, **
>> callback_kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/options.py"
>> , line 541, in wrapper
>> return self.admin_site.admin_view(view)(*args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/utils/decorators.py"
>> , line 149, in _wrapped_view
>> response = view_func(request, *args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/views/decorators/cache.py"
>> , line 57, in _wrapped_view_func
>> response = view_func(request, *args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/sites.py"
>> , line 244, in inner
>> return view(request, *args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/reversion/admin.py"
>> , line 186, in change_view
>> return super(VersionAdmin, self).change_view(request, object_id, 
>> form_url, extra_context)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/options.py"
>> , line 1440, in change_view
>> return self.changeform_view(request, object_id, form_url, 
>> extra_context)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/utils/decorators.py"
>> , line 67, in _wrapper
>> return bound_func(*args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/utils/decorators.py"
>> , line 149, in _wrapped_view
>> response = view_func(request, *args, **kwargs)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/utils/decorators.py"
>> , line 63, in bound_func
>> return func.__get__(self, type(self))(*args2, **kwargs2)
>>   File "/usr/lib/python3.4/contextlib.py", line 30, in inner
>> return func(*args, **kwds)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/options.py"
>> , line 1379, in changeform_view
>> self.save_related(request, form, formsets, not add)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/options.py"
>> , line 1015, in save_related
>> self.save_formset(request, form, formset, change=change)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/contrib/admin/options.py"
>> , line 1003, in save_formset
>> formset.save()
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/forms/models.py"
>> , line 645, in save
>> return self.save_existing_objects(commit) + self.save_new_objects(
>> commit)
>>   File "/home/vincenzo/workspace/mynetgest2/warehouse/forms.py", line 118
>> , in save_existing_objects
>> instances_not_saved = super(IncomingBillOfLadingRowFormset, self).
>> save_existing_objects(commit=False)
>>   File 
>> "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-packages/django/forms/models.py"
>> , line 763, in save_existing_objects
>> self.saved_forms.append(form)
>> AttributeError: 'IncomingBillOfLadingRowFormFormSet' object has no 
>> attribute 'saved_forms'
>>
>> Is there something I'm doing wrong?
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/cc82fa71-3edb-49f7-b46b-c1f043eafd2a%40googlegroups.com
>>

Re: AttributeError overriding save_existing_objects in Formset class

2016-08-09 Thread Constantine Covtushenko
Hi Vincenzo,

Can you please specify Django version that you are using.

Regards,

On Tue, Aug 9, 2016 at 6:06 PM, Vincenzo  wrote:

> Hi there,
> I'm using the admin and I have a form admin  and an inline admin form. For
> this inline admin, I need to ignore modifications done for existing items:
> for this task I have done an override of save_existing_objects method for a
> Formset which inherit from forms.models.BaseInlineFormset. In this
> function I simply call the super with commit=False but doing that cause the
> following error:
>
> traceback (most recent call last):
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/core/handlers/base.py", line 149, in get_response
> response = self.process_exception_by_middleware(e, request)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/core/handlers/base.py", line 147, in get_response
> response = wrapped_callback(request, *callback_args, **callback_kwargs
> )
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/options.py", line 541, in wrapper
> return self.admin_site.admin_view(view)(*args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/utils/decorators.py", line 149, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
> response = view_func(request, *args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/sites.py", line 244, in inner
> return view(request, *args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/reversion/admin.py", line 186, in change_view
> return super(VersionAdmin, self).change_view(request, object_id,
> form_url, extra_context)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/options.py", line 1440, in change_view
> return self.changeform_view(request, object_id, form_url,
> extra_context)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/utils/decorators.py", line 67, in _wrapper
> return bound_func(*args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/utils/decorators.py", line 149, in _wrapped_view
> response = view_func(request, *args, **kwargs)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/utils/decorators.py", line 63, in bound_func
> return func.__get__(self, type(self))(*args2, **kwargs2)
>   File "/usr/lib/python3.4/contextlib.py", line 30, in inner
> return func(*args, **kwds)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/options.py", line 1379, in changeform_view
> self.save_related(request, form, formsets, not add)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/options.py", line 1015, in save_related
> self.save_formset(request, form, formset, change=change)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/contrib/admin/options.py", line 1003, in save_formset
> formset.save()
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/forms/models.py", line 645, in save
> return self.save_existing_objects(commit) + self.save_new_objects(
> commit)
>   File "/home/vincenzo/workspace/mynetgest2/warehouse/forms.py", line 118,
> in save_existing_objects
> instances_not_saved = super(IncomingBillOfLadingRowFormset, self).
> save_existing_objects(commit=False)
>   File "/opt/virtualenv/Environments/mynetgest2/lib/python3.4/site-
> packages/django/forms/models.py", line 763, in save_existing_objects
> self.saved_forms.append(form)
> AttributeError: 'IncomingBillOfLadingRowFormFormSet' object has no
> attribute 'saved_forms'
>
> Is there something I'm doing wrong?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/cc82fa71-3edb-49f7-b46b-c1f043eafd2a%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django u

Re: AttributeError: 'Post' object has no attribute 'get_absolute_url'

2016-07-18 Thread ludovic coues
The code of your model would be more interesting. According to the
error, Post have no method get_absolute_url. That method isn't
provided by models.Model, you have to write it. A way to do it is like
that:

from django.db import models
from django.urls import reverse

class Item(models.Model):
name = models.CharField(max_length=32)

def get_absolute_url(self):
return reverse('app:item', kwargs={'pk':self.pk})


Also, I would suggest you to have a look at class based view,
especially those handling form [1]. That's unrelated to your problem
but might save you time in the future :)

[1] 
https://docs.djangoproject.com/en/1.9/topics/class-based-views/generic-editing/

2016-07-18 14:25 GMT+02:00 Mayur Pabari :
>
> Below is the code of views.py. I am getting error when calling
> HttpResponseRedirect in update and create method. So please let me know
> how can i solve this ?
>
> from django.shortcuts import render, get_object_or_404
> from django.http import HttpResponse, HttpResponseRedirect
>
> from .forms import PostForm
> from . models import Post
>
> def post_create(request): #create Method
> form = PostForm(request.POST or None)
> if form.is_valid():
> instance = form.save(commit=False)
> instance.save()
> return HttpResponseRedirect(instance.get_absolute_url())
>
> context = {
> "form" : form,
> }
> return render(request, "post_form.html", context)
> def post_list(request): #list method
> queryset = Post.objects.all()
> context = {
> "object_list": queryset,
> "title": "List"
> }
> return render(request, "index.html", context)
>
> def post_update(request, id=None): #update Method
> instance = get_object_or_404(Post, id=id)
> form = PostForm(request.POST or None, instance=instance)
> if form.is_valid():
> instance = form.save(commit=False)
> instance.save()
> return HttpResponseRedirect(instance.get_absolute_url()) #i am
> getting error here
>
> context = {
> "title": instance.title,
> "instance": instance,
> "form": form,
> }
> return render(request, "post_form.html", context)
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5486d915-3589-43c8-8d39-943b299f1a20%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Coues Ludovic
+336 148 743 42

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTb0Y551wmD3BswseYfWCmFNDmop-vSPZX87LiO95zYqEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'module' object has no attribute 'index'

2016-03-13 Thread James Schneider
On Mar 13, 2016 11:42 AM, "kashif Nawaz"  wrote:
>
> I read the documentation of Django i followed till page 17 then I have
got an error
> i do exactly the same as the tutorials in docs
> please help me
>

>   File "", line 321, in
_call_with_frames_removed
>   File "/home/kashif/Desktop/mysite/mysite/polls/urls.py", line 5, in

> url(r'^$', views.index, name ='index'),
> AttributeError: 'module' object has no attribute 'index'
>
>

What does your urls.py look like? Did you do something like 'import
myapp.views'? Do you have a function called index in you views.py?

-James

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciXVF0gUjd9S941KWnhjguSnVtANCYUcQxVA-62UDO%2BFvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError at /sitemap.xml

2016-02-10 Thread Michal Petrucha
On Wed, Feb 10, 2016 at 06:01:28AM -0800, Kelvin Jayanoris wrote:
> It seems that django/contrib/sitemaps/__init__.py line 146 causes an 
> attribute error sometimes as such:
> 
> AttributeError: 'list' object has no attribute 'filter'
> 
> I think this is because it always expects a queryset and fails when a list 
> is provided.
> 
> Is this a known issue, or not an issue at all?

Hi Kelvin,

I'm assuming that the AttributeError occurs in cases where you pass a
list into the "queryset" key of a GenericSitemap's "info_dict". Is
there any indication in the docs that a list should be supported
there? If that's the case, then it is a bug (either in the docs, or
with the implementation), but according to
https://docs.djangoproject.com/en/1.9/ref/contrib/sitemaps/#django.contrib.sitemaps.GenericSitemap
only a queryset is supported there, not a regular list of objects.

If you need to create a sitemap with a regular list instead of a
queryset, you might want to consider creating your own subclass of
Sitemap, and override its "items" method.

Good luck,

Michal

> 
> Thank you guys.
> 
> Sorry if I broke any rules (I'm new here)
> 
> 
> Kelvin
> 
> -- 
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/8e12c895-f697-424c-bf09-ef658a8033eb%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20160210155524.GH2245%40konk.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: Digital signature


Re: AttributeError: type object 'Product' has no attribute '_meta'

2015-12-02 Thread Lucas Vieira May
try this:


from django.db import models

# Create your models here.
class Product(models.Model):
item_name = models.CharField(max_length=100)
item_price = models.IntegerField()
item_image = models.ImageField()


def __unicode__(self):
return self.item_name


class Meta:
# Do not Forget the sign in front of the field
ordering = [-'item_name']

-- 
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/0817402d-7f7f-4c51-828f-548650d07aa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

2015-11-23 Thread knbk
Python 3 displays the original exception alongside the new exception when a 
new exception occurs in an except block. The AttributeError is expected, so 
this doesn't tell you anything about what goes wrong. The second error 
occurs when importing `self.urlconf_name`. The traceback should point you 
to the exact cause of this second error, that's the error you will have to 
solve to resolve this issue. 

On Monday, November 23, 2015 at 1:07:29 PM UTC+1, KwangYoun Jung wrote:
>
> Did you solve the issue?
>
> On Tuesday, July 2, 2013 at 8:14:00 PM UTC+9, Pratik Mandrekar wrote:
>>
>> Hello,
>>
>>
>> I keep getting the error *AttributeError: 'RegexURLResolver' object has 
>> no attribute '_urlconf_module' *and the only trace available is as shown 
>> below:
>>
>> 'RegexURLResolver' object has no attribute '_urlconf_module'
>>
>> My Sentry Error reporting normally shows the above error along with 
>> another error, both of which seem to happen simultaneously
>>
>>
>> django.core.urlresolvers in urlconf_module 
>> 
>>
>> AttributeError: 'RegexURLResolver' object has no attribute 
>> '_urlconf_module'
>>
>>
>> The trace for which is
>>
>>
>>
>>1. 
>>
>> @property
>>
>>2. 
>>
>>def urlconf_module(self):
>>
>>3. 
>>
>>try:
>>
>>4. 
>>
>>return self._urlconf_module
>>
>>5. 
>>
>>except AttributeError:
>>
>>6. 
>>
>>self._urlconf_module = import_module(self.urlconf_name)
>>
>>7. 
>>
>>return self._urlconf_module
>>
>>8. 
>>
>>9. 
>>
>>@property
>>
>>
>>
>> 'self'
>>
>> 
>>
>>
>> I'm on Django 1.4. I have been unable to debug this for weeks. Any help 
>> would be appreciated. 
>>
>>
>> Thanks,
>>
>> Pratik
>>
>>

-- 
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/5a1ab7e7-16cd-4c54-8ad1-ce3978813682%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

2015-11-23 Thread KwangYoun Jung
Did you solve the issue?

On Tuesday, July 2, 2013 at 8:14:00 PM UTC+9, Pratik Mandrekar wrote:
>
> Hello,
>
>
> I keep getting the error *AttributeError: 'RegexURLResolver' object has 
> no attribute '_urlconf_module' *and the only trace available is as shown 
> below:
>
> 'RegexURLResolver' object has no attribute '_urlconf_module'
>
> My Sentry Error reporting normally shows the above error along with 
> another error, both of which seem to happen simultaneously
>
>
> django.core.urlresolvers in urlconf_module 
> 
>
> AttributeError: 'RegexURLResolver' object has no attribute 
> '_urlconf_module'
>
>
> The trace for which is
>
>
>
>1. 
>
> @property
>
>2. 
>
>def urlconf_module(self):
>
>3. 
>
>try:
>
>4. 
>
>return self._urlconf_module
>
>5. 
>
>except AttributeError:
>
>6. 
>
>self._urlconf_module = import_module(self.urlconf_name)
>
>7. 
>
>return self._urlconf_module
>
>8. 
>
>9. 
>
>@property
>
>
>
> 'self'
>
> 
>
>
> I'm on Django 1.4. I have been unable to debug this for weeks. Any help 
> would be appreciated. 
>
>
> Thanks,
>
> Pratik
>
>

-- 
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/db8cc652-ae35-4561-b7a8-647bd86ffc01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError raised when calling form's superclass clean() method, however the form doesn't get filled with errors

2014-12-17 Thread Collin Anderson
Hi Hector,

I think your clean() method needs to return cleaned_data.

Collin

On Monday, December 15, 2014 2:39:35 PM UTC-5, Héctor Urbina wrote:
>
> This is my view:
>
> def perfilInversionCliente(request, cliente_pk):
>   objetos = {}
>   cliente = get_object_or_404(Cliente, pk=cliente_pk)
>   targetAllocationsForm = TargetAllocationsForm(cliente=cliente)
>
>   if request.method == "POST":
> targetAllocationsForm = TargetAllocationsForm(request.POST)
> if targetAllocationsForm.is_valid():
>   data = targetAllocationsForm.cleaned_data
>   for k in data:
> editar = False
> if isinstance(k, CategoriaActivo):
>   try:
> currentAlloc = cliente.targetCategoriaAllocations.filter(
> categoria=k).latest("fecha")
> if currentAlloc.allocation != data[k]:
>   editar = True
>   except DoesNotExist:
> editar = True
>   if editar:
> newAlloc = TargetCategoriaAllocation(cliente=cliente, 
> categoria=k, allocation=data[k], fecha=datetime.datetime.now(), editor=
> request.user)
> newAlloc.save()
> if isinstance(k, SubcategoriaActivo):
>   try:
> currentAlloc = cliente.targetSubcategoriaAllocations.filter(
> subcategoria=k).latest("fecha")
> if currentAlloc.allocation != data[k]:
>   editar = True
>   except DoesNotExist:
> editar = True
>   if editar:
> newAlloc = TargetSubcategoriaAllocation(cliente=cliente, 
> subcategoria=k, allocation=data[k], fecha=datetime.datetime.now(), editor=
> request.user)
> newAlloc.save()
> else:
>   pdb.set_trace()
>
>   objetos["targetAllocationsForm"] = targetAllocationsForm
>   categorias = {}
>   for cat in CategoriaActivo.objects.all():
> categorias[cat] = cat.subcategorias.all()
>   objetos["categorias"] = categorias
>   objetos["cliente"] = cliente
>   template = loader.get_template('carteras/perfilInversionista.html')
>   context = RequestContext(request, objetos)
>   return HttpResponse(template.render(context))
>
>
> The keys of the form's fields are not strings, they are python objects... 
> At first I though that wouldn't work, but I tested the form in a shell and 
> it seems to work just fine.
>
> On Monday, December 15, 2014 4:23:36 PM UTC-3, Daniel Roseman wrote:
>>
>> You should show your view. 
>>
>> You should not call clean directly: it is called automatically by 
>> is_valid. 
>>
>> Also note that the keys of self.fields are strings, so neither your if 
>> nor your elif will ever execute. 
>> -- 
>> DR.
>
>

-- 
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/7acb5d42-bd6b-4cef-b044-040c93b1418f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError raised when calling form's superclass clean() method, however the form doesn't get filled with errors

2014-12-15 Thread Héctor Urbina
This is my view:

def perfilInversionCliente(request, cliente_pk):
  objetos = {}
  cliente = get_object_or_404(Cliente, pk=cliente_pk)
  targetAllocationsForm = TargetAllocationsForm(cliente=cliente)

  if request.method == "POST":
targetAllocationsForm = TargetAllocationsForm(request.POST)
if targetAllocationsForm.is_valid():
  data = targetAllocationsForm.cleaned_data
  for k in data:
editar = False
if isinstance(k, CategoriaActivo):
  try:
currentAlloc = cliente.targetCategoriaAllocations.filter(
categoria=k).latest("fecha")
if currentAlloc.allocation != data[k]:
  editar = True
  except DoesNotExist:
editar = True
  if editar:
newAlloc = TargetCategoriaAllocation(cliente=cliente, categoria=
k, allocation=data[k], fecha=datetime.datetime.now(), editor=request.user)
newAlloc.save()
if isinstance(k, SubcategoriaActivo):
  try:
currentAlloc = cliente.targetSubcategoriaAllocations.filter(
subcategoria=k).latest("fecha")
if currentAlloc.allocation != data[k]:
  editar = True
  except DoesNotExist:
editar = True
  if editar:
newAlloc = TargetSubcategoriaAllocation(cliente=cliente, 
subcategoria=k, allocation=data[k], fecha=datetime.datetime.now(), editor=
request.user)
newAlloc.save()
else:
  pdb.set_trace()

  objetos["targetAllocationsForm"] = targetAllocationsForm
  categorias = {}
  for cat in CategoriaActivo.objects.all():
categorias[cat] = cat.subcategorias.all()
  objetos["categorias"] = categorias
  objetos["cliente"] = cliente
  template = loader.get_template('carteras/perfilInversionista.html')
  context = RequestContext(request, objetos)
  return HttpResponse(template.render(context))


The keys of the form's fields are not strings, they are python objects... 
At first I though that wouldn't work, but I tested the form in a shell and 
it seems to work just fine.

On Monday, December 15, 2014 4:23:36 PM UTC-3, Daniel Roseman wrote:
>
> You should show your view. 
>
> You should not call clean directly: it is called automatically by 
> is_valid. 
>
> Also note that the keys of self.fields are strings, so neither your if nor 
> your elif will ever execute. 
> -- 
> DR.

-- 
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/4e60abe9-1955-4034-9e37-83179b9af03b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError | 'Template' object has no attribute 'render'

2014-11-08 Thread Nakaya Mitsuo
It resolved.

I used "Template" in Database.
It was the cause.
It was a simple mistake.


Thank you.


2014年11月5日水曜日 11時25分27秒 UTC+9 Nakaya Mitsuo:
>
> I got AttributeError.
> Exception Value: 'Template' object has no attribute 'render'
>
> How can I fix it?
> Please help me.
>
> --- CODE --
>
> from django.shortcuts import render
> from django.template import Context, Template
>
> class US_AccountManager(models.Manager):
>def update_account(self, auth_user, email):
>us_profile = auth_user.us_profile
>if auth_user.email == email:
>pass
>else:
>try:
>mail_template = Mail_Template.objects.get(position = 'MC')
>context = Context({'site_root':site_root,
>'app_name':app_name})
>message = Template(mail_template.message).render(context)
>subject = mail_template.subject
>send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, 
> [auth_user.email])
>except Mail_Template.DoesNotExist:
>try:
>send_mail_dict = {'site_root':site_root,
>'app_name':app_name}
>subject = 'From' + app_name
>message = 
> render_to_string('txt/change_email.txt',send_mail_dict)
>send_mail(subject, message, 
> settings.DEFAULT_FROM_EMAIL, [auth_user.email])
>except:
>pass
>return auth_user
>
>
> I want to send mail from template ( contain in database ).
> And render the template.
>
> Sorry my poor English.
>

-- 
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/3627d0c9-b046-4e7a-a9c9-6910ed5fd5b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError when trying to reference ForeignKey attributes

2014-05-25 Thread Robbie Edwards
That should work.  Thanks for the suggestion.

robbie

On Sunday, May 25, 2014 1:31:20 AM UTC-4, WongoBongo wrote:
>
> Might try removing the default from x_pos then try setting it by 
> overriding the save method
>
>
> https://docs.djangoproject.com/en/1.4/topics/db/models/#overriding-predefined-model-methods
>
> K
>
> On Saturday, May 24, 2014 8:28:17 PM UTC-7, Robbie Edwards wrote:
>>
>> Hi, I have some code like such...
>>
>>
>> def gen_planet_pos( max_dim ):
>> return random.randint( 0, max_dim )
>>
>>
>> class Universe( models.Model ):
>> width = models.IntegerField( default=100 )
>> ...
>>
>>
>> class Planet( models.Model ):
>> universe = models.ForeignKey( Universe )
>> ...
>> x_pos = models.IntegerField( default=gen_planet_pos( universe.width ) 
>> )
>>
>>
>> When I try to use this, I get "AttributeError: 'ForeignKey' object has no 
>> attribute 'width'".  That message appears when I try to even enter the 
>> shell.  I'm not sure what to do to prevent this error.  Your help is 
>> appreciated.
>>
>> robbie 
>>
>

-- 
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/fa099ba1-5c4d-49e0-b0ab-c19bcda2e1b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError when trying to reference ForeignKey attributes

2014-05-24 Thread Kelvin Wong
Might try removing the default from x_pos then try setting it by overriding 
the save method

https://docs.djangoproject.com/en/1.4/topics/db/models/#overriding-predefined-model-methods

K

On Saturday, May 24, 2014 8:28:17 PM UTC-7, Robbie Edwards wrote:
>
> Hi, I have some code like such...
>
>
> def gen_planet_pos( max_dim ):
> return random.randint( 0, max_dim )
>
>
> class Universe( models.Model ):
> width = models.IntegerField( default=100 )
> ...
>
>
> class Planet( models.Model ):
> universe = models.ForeignKey( Universe )
> ...
> x_pos = models.IntegerField( default=gen_planet_pos( universe.width ) )
>
>
> When I try to use this, I get "AttributeError: 'ForeignKey' object has no 
> attribute 'width'".  That message appears when I try to even enter the 
> shell.  I'm not sure what to do to prevent this error.  Your help is 
> appreciated.
>
> robbie 
>

-- 
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/c6856a3e-6be2-407e-9f23-d3e815733552%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: AttributeError: 'TaggableManager' object has no attribute 'primary_key'

2014-01-21 Thread Jonathan Pentecost
I think there is a problem with the taggit library, possibly similar to
 
https://github.com/alex/django-taggit/issues/186
?

On Tuesday, 21 January 2014 19:21:08 UTC+11, vinoth kumar renganathan wrote:
>
> When i making new migration with this command "python manage.py 
> schemamigration blogger --auto" it shows " You cannot use --auto on an 
> app with no migrations. Try --initial."
>
> so i try to run "python manage.py schemamigration blogger --initial" . And 
> i got this in my terminal
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 399, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", 
> line 392, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 242, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File 
> "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", 
> line 285, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/management/commands/schemamigration.py",
>  
> line 151, in handle
> for action_name, params in change_source.get_changes():
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/creator/changes.py",
>  
> line 460, in get_changes
> model_defs = freeze_apps([self.migrations.app_label()])
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/creator/freezer.py",
>  
> line 32, in freeze_apps
> frozen_models.update(model_dependencies(model))
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/creator/freezer.py",
>  
> line 96, in model_dependencies
> depends.update(field_dependencies(field, checked_models))
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/creator/freezer.py",
>  
> line 132, in field_dependencies
> value = get_attribute(field, attrname)
>   File 
> "/usr/local/lib/python2.7/dist-packages/South-0.8.1-py2.7.egg/south/utils/__init__.py",
>  
> line 38, in get_attribute
> value = getattr(value, part)
> AttributeError: 'TaggableManager' object has no attribute 'primary_key'
>
> Herewith attached detail about my project.
>
> urls.py   http://pastebin.com/Cibt5a9L
> models.py  http://pastebin.com/prYeigN9 
> views.pyhttp://pastebin.com/AJu2PXkJ
> tagpage.html  http://pastebin.com/MBaj23cx
>
> Also installed 'taggit'  in settings.py
>
>
>  
>

-- 
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/c7e13d54-9543-4e13-b6db-085384f749a6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

2013-11-20 Thread burak . kuyucakli
Hello,

Is there an answer to this problem?

On Tuesday, July 2, 2013 4:56:08 PM UTC+3, Pratik Mandrekar wrote:
>
> Hey Tom,
>
> My ROOT_URLCONF points to 'urls' which is the top level urlconf for my 
> site. Besides all my urls do work. This error keeps coming intermittently 
> but does not affect my application logic in any way I know. So I need to 
> know why this error keeps getting reported and how to fix it.
>
> Thanks,
> Pratik
>
> On Tuesday, July 2, 2013 4:53:09 PM UTC+5:30, Tom Evans wrote:
>>
>> On Tue, Jul 2, 2013 at 12:14 PM, Pratik Mandrekar 
>>  wrote: 
>> > 
>> > Hello, 
>> > 
>> > 
>> > I keep getting the error AttributeError: 'RegexURLResolver' object has 
>> no 
>> > attribute '_urlconf_module' and the only trace available is as shown 
>> below: 
>> > 
>> > 'RegexURLResolver' object has no attribute '_urlconf_module' 
>> > 
>> > My Sentry Error reporting normally shows the above error along with 
>> > another error, both of which seem to happen simultaneously 
>> > 
>> > 
>> > django.core.urlresolvers in urlconf_module 
>> > 
>> > AttributeError: 'RegexURLResolver' object has no attribute 
>> > '_urlconf_module' 
>> > 
>> > 
>> > The trace for which is 
>> > 
>> > 
>> >  @property 
>> > 
>> > def urlconf_module(self): 
>> > 
>> > try: 
>> > 
>> > return self._urlconf_module 
>> > 
>> > except AttributeError: 
>> > 
>> > self._urlconf_module = import_module(self.urlconf_name) 
>> > 
>> > return self._urlconf_module 
>> > 
>> > @property 
>> > 
>> > 
>> > 'self' 
>> > 
>> >  
>> > 
>> > 
>> > I'm on Django 1.4. I have been unable to debug this for weeks. Any help 
>> > would be appreciated. 
>> > 
>> > 
>> > Thanks, 
>> > 
>> > Pratik 
>> > 
>>
>> Sounds like your ROOT_URLCONF is incorrectly specified in settings. 
>>
>> Cheers 
>>
>> Tom 
>>
>

-- 
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/451bd362-f0c2-4d00-a843-1b205880da5c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Darion Yaphet
Great !!!
It's the point  and now successful

helloworld ➤ tree

.
|-- helloworld
|   |-- __init__.py
|   |-- __init__.pyc
|   |-- settings.py
|   |-- settings.pyc
|   |-- urls.py
|   `-- wsgi.py
`-- manage.py

1 directory, 7 files

thanks a lot


2013/10/15 Leonardo Giordani 

> As I suspected, there is a problem with the logging module, which is
> probably shadowed, i.e. when Django performs "import logging" it imports a
> different module.
> Try the following: exactly where you execute the manage.py open an
> interactive Python shell and do
>
> >>> import logging
> >>> print logging.__file__
>
> This should hopefully show us what logging is working behind the scenes.
> Try and post the results
>
> Leo
>
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/15 Darion Yaphet 
>
>>  the output  exception info as following :
>>
>> ~ ➤ python /usr/bin/django-admin.py startproject hello --traceback
>>
>> Traceback (most recent call last):
>>   File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
>> line 222, in run_from_argv
>> self.execute(*args, **options.__dict__)
>>File
>> "/usr/lib/python2.7/site-packages/django/core/management/base.py", line
>> 255, in execute
>> output = self.handle(*args, **options)
>>   File
>> "/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
>> line 31, in handle
>> super(Command, self).handle('project', project_name, target,
>> **options)
>>   File
>> "/usr/lib/python2.7/site-packages/django/core/management/templates.py",
>> line 123, in handle
>> settings.configure()
>>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
>> 98, in configure
>> self._configure_logging()
>>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
>> 77, in _configure_logging
>> logging_config_func(DEFAULT_LOGGING)
>>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py",
>> line 555, in dictConfig
>> dictConfigClass(config).configure()
>>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py",
>> line 323, in configure
>> del logging._handlerList[:]
>> AttributeError: 'module' object has no attribute '_handlerList'
>>
>> and is  something missing or any package is missing
>>
>>
>> 2013/10/15 Leonardo Giordani 
>>
>>>  Ok, can you please try to traceback the command and post the results?
>>>
>>> python django-admin.py startproject hello --traceback
>>>
>>>
>>>
>>>  Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/15 Darion Yaphet 
>>>
  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv


 2013/10/14 Leonardo Giordani 

> Please give me the information I asked you, otherwise I cannot figure
> out what kind of problem you have.
>
> Are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on?
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>>  Python  2.7.3 and Django is 1.5.3 ..
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Hi, are you using a virtualenv? In that case, can you post the list
>>> of packages you installed? If not, can you give details about the OS you
>>> are working on, Django version, and so on?
>>>
>>> Regards,
>>>
>>> Leo
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
 Hi all :

 when I use django-admin.py to init django project
 django-admin.py  startproject hello

 Got a exception ..
  AttributeError: 'module' object has no attribute '_handlerList'

 what is 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, 

Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Leonardo Giordani
As I suspected, there is a problem with the logging module, which is
probably shadowed, i.e. when Django performs "import logging" it imports a
different module.
Try the following: exactly where you execute the manage.py open an
interactive Python shell and do

>>> import logging
>>> print logging.__file__

This should hopefully show us what logging is working behind the scenes.
Try and post the results

Leo


Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/15 Darion Yaphet 

> the output  exception info as following :
>
> ~ ➤ python /usr/bin/django-admin.py startproject hello --traceback
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 222, in run_from_argv
> self.execute(*args, **options.__dict__)
>File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
> line 255, in execute
> output = self.handle(*args, **options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
> line 31, in handle
> super(Command, self).handle('project', project_name, target, **options)
>   File
> "/usr/lib/python2.7/site-packages/django/core/management/templates.py",
> line 123, in handle
> settings.configure()
>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
> 98, in configure
> self._configure_logging()
>   File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line
> 77, in _configure_logging
> logging_config_func(DEFAULT_LOGGING)
>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
> 555, in dictConfig
> dictConfigClass(config).configure()
>   File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
> 323, in configure
> del logging._handlerList[:]
> AttributeError: 'module' object has no attribute '_handlerList'
>
> and is  something missing or any package is missing
>
>
> 2013/10/15 Leonardo Giordani 
>
>> Ok, can you please try to traceback the command and post the results?
>>
>> python django-admin.py startproject hello --traceback
>>
>>
>>
>>  Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/15 Darion Yaphet 
>>
>>>  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>>>
>>>
>>> 2013/10/14 Leonardo Giordani 
>>>
 Please give me the information I asked you, otherwise I cannot figure
 out what kind of problem you have.

 Are you using a virtualenv? In that case, can you post the list of
 packages you installed? If not, can you give details about the OS you are
 working on?

 Leonardo Giordani
 Author of The Digital Cat 
 My profile on About.me  - My GitHub
 page  - My Coderwall 
 profile


 2013/10/14 Darion Yaphet 

>  Python  2.7.3 and Django is 1.5.3 ..
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Hi, are you using a virtualenv? In that case, can you post the list
>> of packages you installed? If not, can you give details about the OS you
>> are working on, Django version, and so on?
>>
>> Regards,
>>
>> Leo
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>> Hi all :
>>>
>>> when I use django-admin.py to init django project
>>> django-admin.py  startproject hello
>>>
>>> Got a exception ..
>>>  AttributeError: 'module' object has no attribute '_handlerList'
>>>
>>> what is 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> You received this message because you are subs

Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-15 Thread Darion Yaphet
the output  exception info as following :

~ ➤ python /usr/bin/django-admin.py startproject hello --traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
line 222, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/site-packages/django/core/management/base.py",
line 255, in execute
output = self.handle(*args, **options)
  File
"/usr/lib/python2.7/site-packages/django/core/management/commands/startproject.py",
line 31, in handle
super(Command, self).handle('project', project_name, target, **options)
  File
"/usr/lib/python2.7/site-packages/django/core/management/templates.py",
line 123, in handle
settings.configure()
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 98,
in configure
self._configure_logging()
  File "/usr/lib/python2.7/site-packages/django/conf/__init__.py", line 77,
in _configure_logging
logging_config_func(DEFAULT_LOGGING)
  File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
555, in dictConfig
dictConfigClass(config).configure()
  File "/usr/lib/python2.7/site-packages/django/utils/dictconfig.py", line
323, in configure
del logging._handlerList[:]
AttributeError: 'module' object has no attribute '_handlerList'

and is  something missing or any package is missing


2013/10/15 Leonardo Giordani 

> Ok, can you please try to traceback the command and post the results?
>
> python django-admin.py startproject hello --traceback
>
>
>
>  Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/15 Darion Yaphet 
>
>>  ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Please give me the information I asked you, otherwise I cannot figure
>>> out what kind of problem you have.
>>>
>>> Are you using a virtualenv? In that case, can you post the list of
>>> packages you installed? If not, can you give details about the OS you are
>>> working on?
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
  Python  2.7.3 and Django is 1.5.3 ..


 2013/10/14 Leonardo Giordani 

> Hi, are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on, Django version, and so on?
>
> Regards,
>
> Leo
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>> Hi all :
>>
>> when I use django-admin.py to init django project
>> django-admin.py  startproject hello
>>
>> Got a exception ..
>>  AttributeError: 'module' object has no attribute '_handlerList'
>>
>> what is 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>> .
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



 --




 long is the way and hard  that out of Hell leads up to light

  --
 You received this message because you are subscribed to the Google
 Groups "Django users" group

Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Leonardo Giordani
Ok, can you please try to traceback the command and post the results?

python django-admin.py startproject hello --traceback



Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/15 Darion Yaphet 

> ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Please give me the information I asked you, otherwise I cannot figure out
>> what kind of problem you have.
>>
>> Are you using a virtualenv? In that case, can you post the list of
>> packages you installed? If not, can you give details about the OS you are
>> working on?
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>>  Python  2.7.3 and Django is 1.5.3 ..
>>>
>>>
>>> 2013/10/14 Leonardo Giordani 
>>>
 Hi, are you using a virtualenv? In that case, can you post the list of
 packages you installed? If not, can you give details about the OS you are
 working on, Django version, and so on?

 Regards,

 Leo

 Leonardo Giordani
 Author of The Digital Cat 
 My profile on About.me  - My GitHub
 page  - My Coderwall 
 profile


 2013/10/14 Darion Yaphet 

> Hi all :
>
> when I use django-admin.py to init django project
> django-admin.py  startproject hello
>
> Got a exception ..
>  AttributeError: 'module' object has no attribute '_handlerList'
>
> what is 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
> .
> 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>
>>>
>>> --
>>>
>>>
>>>
>>> long is the way and hard  that out of Hell leads up to light
>>>
>>>  --
>>> 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/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
>>> .
>>>
>>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
>
>
> long is the way and hard  that out of Hell leads up to light
>
>  --
> 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

Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Darion Yaphet
ok I built Django 1.5.3  on  fedora 18  and  don't use virtualenv


2013/10/14 Leonardo Giordani 

> Please give me the information I asked you, otherwise I cannot figure out
> what kind of problem you have.
>
> Are you using a virtualenv? In that case, can you post the list of
> packages you installed? If not, can you give details about the OS you are
> working on?
>
> Leonardo Giordani
> Author of The Digital Cat 
> My profile on About.me  - My GitHub
> page  - My Coderwall 
> profile
>
>
> 2013/10/14 Darion Yaphet 
>
>>  Python  2.7.3 and Django is 1.5.3 ..
>>
>>
>> 2013/10/14 Leonardo Giordani 
>>
>>> Hi, are you using a virtualenv? In that case, can you post the list of
>>> packages you installed? If not, can you give details about the OS you are
>>> working on, Django version, and so on?
>>>
>>> Regards,
>>>
>>> Leo
>>>
>>> Leonardo Giordani
>>> Author of The Digital Cat 
>>> My profile on About.me  - My GitHub
>>> page  - My Coderwall 
>>> profile
>>>
>>>
>>> 2013/10/14 Darion Yaphet 
>>>
 Hi all :

 when I use django-admin.py to init django project
 django-admin.py  startproject hello

 Got a exception ..
  AttributeError: 'module' object has no attribute '_handlerList'

 what is 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.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
 .
 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
>>> .
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> --
>>
>>
>>
>> long is the way and hard  that out of Hell leads up to light
>>
>>  --
>> 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/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
>> .
>>
>> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 


long is the way and hard  that out of Hell leads up to light

-- 
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/CAOHWcCLGk_MTSTd%2BLXPdu90kYva%3D5v2Gmgp85QxGtU%2BE4EH%2B8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: AttributeError: 'module' object has no attribute '_handlerList'

2013-10-14 Thread Leonardo Giordani
Please give me the information I asked you, otherwise I cannot figure out
what kind of problem you have.

Are you using a virtualenv? In that case, can you post the list of packages
you installed? If not, can you give details about the OS you are working on?

Leonardo Giordani
Author of The Digital Cat 
My profile on About.me  - My GitHub
page- My Coderwall
profile 


2013/10/14 Darion Yaphet 

> Python  2.7.3 and Django is 1.5.3 ..
>
>
> 2013/10/14 Leonardo Giordani 
>
>> Hi, are you using a virtualenv? In that case, can you post the list of
>> packages you installed? If not, can you give details about the OS you are
>> working on, Django version, and so on?
>>
>> Regards,
>>
>> Leo
>>
>> Leonardo Giordani
>> Author of The Digital Cat 
>> My profile on About.me  - My GitHub
>> page  - My Coderwall 
>> profile
>>
>>
>> 2013/10/14 Darion Yaphet 
>>
>>> Hi all :
>>>
>>> when I use django-admin.py to init django project
>>> django-admin.py  startproject hello
>>>
>>> Got a exception ..
>>>  AttributeError: 'module' object has no attribute '_handlerList'
>>>
>>> what is 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a6024b53-9203-4e25-9202-d2cdf017e5a0%40googlegroups.com
>>> .
>>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3Dr_nPHCA4T3N1hX8--be1R9SMtB%3Deaa_5cFsPCravawg%40mail.gmail.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
>
>
> long is the way and hard  that out of Hell leads up to light
>
>  --
> 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/CAOHWcC%2BjyqOZBjqSYVHYNZm7vbixRiWtBQ2dvteYLdv%3DNhyi6w%40mail.gmail.com
> .
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEhE%2BO%3D-D_WzBa4_Lis4Bppak-czSKG9D60b91b7GFSWvnWM%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


  1   2   >