Thursday, June 27, 2019

Re: invalid literal for int() with base 10: 'admin'

It worked!. Thanks Piotr Duda

On Wednesday, June 26, 2019 at 6:11:24 PM UTC+5:30, Piotr Duda wrote:
Try move first path to end in your main urls.py.

W dniu wtorek, 25 czerwca 2019 17:17:04 UTC+2 użytkownik Harshit napisał:
Here is urls.py of my app

from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static

app_name="music"

urlpatterns=[
#/music/
path('',views.IndexView.as_view(),name='index'),

path('register/',views.UserFormView.as_view(),name='register'),

path('<pk>/',views.DetailView.as_view(),name='detail'),

path('album/add/',views.AlbumCreate.as_view(),name='album-add'),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Here is my main urls.py
from django.contrib import admin
from django.urls import path,include
from . import settings
from django.contrib.staticfiles.urls import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
path('',include('music.urls')),
path('music/',include('music.urls')),
path('admin/', admin.site.urls),
]
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

On Tuesday, June 25, 2019 at 4:14:05 PM UTC+5:30, Sipum wrote:
Can u plz attach your urls.py as functions associated in views.py

Thanks. 

On Mon, 24 Jun, 2019, 8:08 PM Harshit Agarwal, <agarwalh...@gmail.com> wrote:
 Hi guys,
I am currently working on a working on a project. Everything is working fine but i am not able to access my admin. How can i solve this? 
Here is my Stack Trace 
Traceback:

File "C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\exception.py" in inner
  34.             response = get_response(request)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\base.py" in _get_response
  126.                 response = self.process_exception_by_middleware(e, request)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\core\handlers\base.py" in _get_response
  124.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\base.py" in dispatch
  88.         return handler(request, *args, **kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\detail.py" in get
  106.         self.object = self.get_object()

File "C:\ProgramData\Anaconda3\lib\site-packages\django\views\generic\detail.py" in get_object
  36.             queryset = queryset.filter(pk=pk)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\query.py" in filter
  844.         return self._filter_or_exclude(False, *args, **kwargs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\query.py" in _filter_or_exclude
  862.             clone.query.add_q(Q(*args, **kwargs))

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py" in add_q
  1263.         clause, _ = self._add_q(q_object, self.used_aliases)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py" in _add_q
  1287.                     split_subq=split_subq,

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py" in build_filter
  1225.         condition = self.build_lookup(lookups, col, value)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\sql\query.py" in build_lookup
  1096.         lookup = lookup_class(lhs, rhs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\lookups.py" in __init__
  20.         self.rhs = self.get_prep_lookup()

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\lookups.py" in get_prep_lookup
  70.             return self.lhs.output_field.get_prep_value(self.rhs)

File "C:\ProgramData\Anaconda3\lib\site-packages\django\db\models\fields\__init__.py" in get_prep_value
  965.         return int(value)

Exception Type: ValueError at /admin/
Exception Value: invalid literal for int() with base 10: 'admin' 

--
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...@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/CAE%2BC-X-o7sW8m2-DMx4R5CnGrYbYS%2B%2Bx_cYi-BL%3DHwK_b%2BdrHg%40mail.gmail.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+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/9b7d2ada-3107-477c-beb5-48d268ae96c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment