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

2019-06-27 Thread Harshit
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('/',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,  
>>> 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 email

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

2019-06-26 Thread Piotr Duda
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('/',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,  
>> 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

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

2019-06-26 Thread Sipum Mishra
Your problem is, in url you are passing id to detailview, but in views.py
you have done anything with that...

Check this again.

On Wed, 26 Jun, 2019, 4:01 AM onyilimba martins mclaren tochukwu, <
tochimcla...@gmail.com> wrote:

> I guess it's Django 2.2?
>
> --
> 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/bb10db99-0411-468b-aace-e40509c34b51%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/CAGHZBzzi7Lt9u299aGQOhd0e6rYsFeWyDgX%3DM1yB%2BpgWP_v_iQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-25 Thread onyilimba martins mclaren tochukwu
I guess it's Django 2.2?

-- 
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/bb10db99-0411-468b-aace-e40509c34b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-25 Thread Harshit
This is my views.py
from django.views import generic 
from django.views.generic import ListView
from django.views.generic import DetailView,UpdateView,DeleteView
from django.views.generic import CreateView
from django.shortcuts import render,redirect
from django.contrib.auth import authenticate,login
from django.views.generic import View
from .models import Album, Song
from .forms import UserForm

class IndexView(ListView):
template_name="music/index.html"
context_object_name='all_Albums'

def get_queryset(self):
return Album.objects.all() 

class DetailView(DetailView):
model=Album
template_name="music/detail.html" 

class AlbumCreate(CreateView):
model=Album
fields=['artist','album_title','genre','album_logo'] 

class UserFormView(View):
form_class=UserForm
template_name='music/registration_form.html'

#display blank form
def get(self , request):
form=self.form_class(None)
return render(request,self.template_name,{'form':form})

#process from data
def post(self, request):
form=self.form_class(request.POST)

if form.is_valid():
user=form.save(commit=False)

#cleaned (normalized) data
username=form.cleaned_data['username']
password=form.cleaned_data['password']
user.set_password(password)
user.save()

#returns User objects if credentials are correct

user=authenticate(username=username,password=password)

if user is not None:

if user.is_active:
login(request,user)
return redirect('music:index')
return render(request,self.template_name,{'form':form}) 

On Tuesday, June 25, 2019 at 9:37:34 PM UTC+5:30, Sipum wrote:
>
> Plz share views.py as well.. I hvae mentioned two. Kindly share. 
>
> On Tue, 25 Jun, 2019, 8:47 PM Harshit,  > wrote:
>
>> 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('/',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,  
>>> 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.

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

2019-06-25 Thread Sipum Mishra
Plz share views.py as well.. I hvae mentioned two. Kindly share.

On Tue, 25 Jun, 2019, 8:47 PM Harshit,  wrote:

> 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('/',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, 
>> 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

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

2019-06-25 Thread Harshit
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('/',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,  > 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 

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

2019-06-25 Thread Sipum Mishra
Can u plz attach your urls.py as functions associated in views.py

Thanks.

On Mon, 24 Jun, 2019, 8:08 PM Harshit Agarwal, 
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-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/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+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/CAGHZBzy1X-KiMXtLPmQ3V5nC2HBLC%2BpD_Wd8vAjV3nAnGGsFAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Alejandro Pena
Try this instead:

cart_obj, new_obj = Cart.objects.get_or_create(user=request.user)

You originally had:

cart_obj, new_obj = Cart.objects.new_or_get(request)

There is no .new_or_get method in the Django QuerySet API: 
https://docs.djangoproject.com/en/dev/ref/models/querysets/#get-or-create

Also, inside of the parentheses you must specify a field in the Cart model and 
a value to search for in order to identify a specific cart: (user = 
request.user)


 

-- 
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/c2e16937-ebff-4f24-a5bf-469a4353274f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Lutalo Bbosa joseph
it all is not working, i guess i have to write another independent function
for reomving products from the cart
but thx. though i thought, it would workout

On Sat, Jun 22, 2019 at 9:00 PM Alejandro Pena  wrote:

> Which error are you seeing now? Try making this change and let us know
> what the results are.
>
> cart_obj, new_obj = Cart.objects.get(user=request.user)
> if product_obj in cart_obj.products.all():
> cart_obj.products.remove(product_obj)
> added = False
>
> Context:
> http://www.learningaboutelectronics.com/Articles/How-to-check-if-an-object-is-in-a-ManyToManyField-in-Django.php
>
> --
> 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/2b356801-9f78-4d3d-b10e-39b4d5908dcf%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/CAMz%3Dh%3DRqw6k_wopSy2pJCFLx-yLbwbyDLvCeWiiUpGHUTWEb4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Alejandro Pena
Which error are you seeing now? Try making this change and let us know what the 
results are.

cart_obj, new_obj = Cart.objects.get(user=request.user)
if product_obj in cart_obj.products.all():
cart_obj.products.remove(product_obj)
added = False

Context: 
http://www.learningaboutelectronics.com/Articles/How-to-check-if-an-object-is-in-a-ManyToManyField-in-Django.php

-- 
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/2b356801-9f78-4d3d-b10e-39b4d5908dcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Lutalo Bbosa joseph
but the remove function is supposed to work yet it returns the error but
add works
def update(request):
product_id = request.POST.get("product_id")
if product_id is not None :
print(product_id)
product_id = int(product_id)

try:
product_id = int(product_id)
product_obj = Product.objects.get(id=product_id)
#product_obj = Product.objects.get(id=product_id)
except Product.DoesNotExist:
print("message to user, product is gone")
return redirect("carts:home")
cart_obj, new_obj = Cart.objects.new_or_get(request)
if product_obj in cart_obj.products.all():
cart_obj.products.remove(product_obj)
added = False

On Sat, Jun 22, 2019 at 8:18 PM Alejandro Pena  wrote:

> Sweet, looks like your code is working!
>
> You’re still seeing the ‘2’ and that the type of product_id is a string
> because your print statements are placed before you convert product_id into
> an int and then use it to search for product_obj.
>
> The evidence that it’s working is that it didn’t raise an error this time
> and then you see the POST and GET requests successfully completed with
> response codes 302 (return redirect to /carts) and 200 (return render...).
>
> --
> 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/cf4d348f-9955-43f4-81b9-a4cbc98bb8b0%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/CAMz%3Dh%3DRdP2F4sB39ad%2B-r5UQvtobBEoAAmrseW0E0aQtOgUWxg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Alejandro Pena
Sweet, looks like your code is working!

You’re still seeing the ‘2’ and that the type of product_id is a string because 
your print statements are placed before you convert product_id into an int and 
then use it to search for product_obj.

The evidence that it’s working is that it didn’t raise an error this time and 
then you see the POST and GET requests successfully completed with response 
codes 302 (return redirect to /carts) and 200 (return render...).

-- 
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/cf4d348f-9955-43f4-81b9-a4cbc98bb8b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Lutalo Bbosa joseph
This is what happens in the terminal when i use int(product_id)
2

2
[22/Jun/2019 16:56:33] "POST /carts/update/ HTTP/1.1" 302 0
[22/Jun/2019 16:56:33] "GET /carts/ HTTP/1.1" 200 8245



On Sat, Jun 22, 2019 at 7:50 PM Alejandro Pena  wrote:

> I feel you, figuring out such errors for the first time can be infinitely
> frustrating.
>
> I believe that the form is sending you product id numbers as strings, or 1
> as ‘1’.
>
> If the product_id = ‘1’ then product_id is not None.
>
> However, you have defined product_id in the model for Product as an int
> and it’s raising a TypeError because you’re searching for a product_id that
> is a string instead.
>
> To fix the problem, convert the result from the POST request from a string
> into an int.
>
> After you check if product_id is not None:
> product_id = int(product_id)
>
> Regards,
> Alejandro Peña
>
> --
> 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/5ccf02f4-9d1c-4363-85cc-feb39b5326e3%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/CAMz%3Dh%3DS_e2UFY5EZCgZ32epGiSYTk1d-4ziu-nHv2Q-HphYEBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Lutalo Bbosa joseph
kk will do that,

On Sat, Jun 22, 2019 at 7:29 PM Amiya Dash 
wrote:

> Can u send me the full project.share me the github link
>
> --
> 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/ec4e7699-f6a0-4689-9611-fb005db3727b%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/CAMz%3Dh%3DT%3Dqm94mK4eSw2CziF%3Dv_c6JB9Rb7YTX0nF8%2BvuK5CaTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Alejandro Pena
I feel you, figuring out such errors for the first time can be infinitely 
frustrating.

I believe that the form is sending you product id numbers as strings, or 1 as 
‘1’. 

If the product_id = ‘1’ then product_id is not None.

However, you have defined product_id in the model for Product as an int and 
it’s raising a TypeError because you’re searching for a product_id that is a 
string instead.

To fix the problem, convert the result from the POST request from a string into 
an int.

After you check if product_id is not None:
product_id = int(product_id)

Regards,
Alejandro Peña

-- 
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/5ccf02f4-9d1c-4363-85cc-feb39b5326e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-22 Thread Amiya Dash
Can u send me the full project.share me the github link

-- 
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/ec4e7699-f6a0-4689-9611-fb005db3727b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Héctor Alonso Lozada Echezuría
Of course,

Share your source code and stack trace through pastebin



El vie., 21 jun. 2019 a las 13:34, Lutalo Bbosa joseph ()
escribió:

> am trying to figure it out but when i
> print(product_id)
> print(type(product_id)) i get this output
> 1
> , so probably its because i cant iterate over a string but am
> still failing to figure it out
>
>
> On Fri, Jun 21, 2019 at 10:16 PM Lutalo Bbosa joseph 
> wrote:
>
>> hi hector, can u help me fix it, coz am kinda puzzled
>>
>>
>>
>>
>> On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <
>> ima...@gmail.com> wrote:
>>
>>> Apparently product_id has no value
>>>
>>> product_id = request.POST.get("product_id")
>>> print(product_id)
>>> print(type(product_id))
>>>
>>>
>>> El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph (<
>>> bbos...@gmail.com>) escribió:
>>>
 hi guys, am working on an ecommerce system, which has cart as an app,
 but i keep on getting this error and cant move on any help, here is my
 views.py ,
 from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>> Héctor Alonso Lozada Echezuría
>>>
>>> --
>>> 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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%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+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/CAMz%3Dh%3DR2YMJitLizXQg2_a8tyTUF2%2B46im%2B4MvoGyzyHQayrCw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Héctor Alonso Lozada Echezuría

-- 
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/CADTS2YwVg4%3D3brJr%2BZFxxbM-fBn_vkWHGQno%3DDyyfHij6atpaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Lutalo Bbosa joseph
am trying to figure it out but when i
print(product_id)
print(type(product_id)) i get this output
1
, so probably its because i cant iterate over a string but am
still failing to figure it out


On Fri, Jun 21, 2019 at 10:16 PM Lutalo Bbosa joseph 
wrote:

> hi hector, can u help me fix it, coz am kinda puzzled
>
>
>
>
> On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <
> ima...@gmail.com> wrote:
>
>> Apparently product_id has no value
>>
>> product_id = request.POST.get("product_id")
>> print(product_id)
>> print(type(product_id))
>>
>>
>> El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph ()
>> escribió:
>>
>>> hi guys, am working on an ecommerce system, which has cart as an app,
>>> but i keep on getting this error and cant move on any help, here is my
>>> views.py ,
>>> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Héctor Alonso Lozada Echezuría
>>
>> --
>> 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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%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+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/CAMz%3Dh%3DR2YMJitLizXQg2_a8tyTUF2%2B46im%2B4MvoGyzyHQayrCw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Lutalo Bbosa joseph
hi hector, can u help me fix it, coz am kinda puzzled




On Fri, Jun 21, 2019 at 9:56 PM Héctor Alonso Lozada Echezuría <
ima...@gmail.com> wrote:

> Apparently product_id has no value
>
> product_id = request.POST.get("product_id")
> print(product_id)
> print(type(product_id))
>
>
> El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph ()
> escribió:
>
>> hi guys, am working on an ecommerce system, which has cart as an app, but
>> i keep on getting this error and cant move on any help, here is my views.py
>> ,
>> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Héctor Alonso Lozada Echezuría
>
> --
> 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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%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+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/CAMz%3Dh%3DTYjC9WSGBsTyzfW7%2BBbq6a2cD0H%3DsdXgrnM6gyPhf30Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Héctor Alonso Lozada Echezuría
Apparently product_id has no value

product_id = request.POST.get("product_id")
print(product_id)
print(type(product_id))


El vie., 21 jun. 2019 a las 6:33, Lutalo Bbosa joseph ()
escribió:

> hi guys, am working on an ecommerce system, which has cart as an app, but
> i keep on getting this error and cant move on any help, here is my views.py
> ,
> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Héctor Alonso Lozada Echezuría

-- 
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/CADTS2YynLDDPoDa3h_Ks%2B6dTQY9Fs4y42yLCdszJONoz3BzXmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Lutalo Bbosa joseph
ValueError at /carts/update/

invalid literal for int() with base 10: '' thats the error


On Fri, Jun 21, 2019 at 7:46 PM Jorge Gimeno  wrote:

> Would you be able to copy and paste the stack trace here? Without that,
> it's really hard to see where this exception is coming from.
>
> -Jorge
>
> On Fri, Jun 21, 2019 at 9:13 AM Lutalo Bbosa joseph 
> wrote:
>
>> here is my template that handles that bit, and i have as well attached
>> atemplate in which its used
>>
>> On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady 
>> wrote:
>>
>>> Does the stack trace mention a template variable name?  It looks like a
>>> template variable that is expected to have integer value is not properly
>>> initialized.
>>>
>>> Regards,
>>>
>>> Aldian Fazrihady
>>>
>>> On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, 
>>> wrote:
>>>
 i as well have a models.py file for carts, and products which is
 attached, when i try to search for a solution on stack overflow,all
 solutions insist on problem with integers and strings in my code. though
 these were passed solutions and not too similar to this one

 On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph 
 wrote:

> on pressing remove the product is supposed to be removed from the
> cart, but it instead displays an error
>
> On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph 
> wrote:
>
>> well here is apic of what am doing,
>>
>> On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <
>> ahmedisht...@gmail.com> wrote:
>>
>>> Hi Lutalo,
>>>
>>> Could you also share the stacktrace of the error and when it
>>> happens? It would help us decipher what's really going on in relation to
>>> what you're trying to do.
>>>
>>> Best,
>>> Ahmed
>>>
>>> On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <
>>> bbos...@gmail.com> wrote:
>>>
 hi guys, am working on an ecommerce system, which has cart as an
 app, but i keep on getting this error and cant move on any help, here 
 is my
 views.py ,
 from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%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+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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%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+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at 

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

2019-06-21 Thread Jorge Gimeno
Would you be able to copy and paste the stack trace here? Without that,
it's really hard to see where this exception is coming from.

-Jorge

On Fri, Jun 21, 2019 at 9:13 AM Lutalo Bbosa joseph 
wrote:

> here is my template that handles that bit, and i have as well attached
> atemplate in which its used
>
> On Fri, Jun 21, 2019 at 6:59 PM Aldian Fazrihady 
> wrote:
>
>> Does the stack trace mention a template variable name?  It looks like a
>> template variable that is expected to have integer value is not properly
>> initialized.
>>
>> Regards,
>>
>> Aldian Fazrihady
>>
>> On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph, 
>> wrote:
>>
>>> i as well have a models.py file for carts, and products which is
>>> attached, when i try to search for a solution on stack overflow,all
>>> solutions insist on problem with integers and strings in my code. though
>>> these were passed solutions and not too similar to this one
>>>
>>> On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph 
>>> wrote:
>>>
 on pressing remove the product is supposed to be removed from the cart,
 but it instead displays an error

 On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph 
 wrote:

> well here is apic of what am doing,
>
> On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque <
> ahmedisht...@gmail.com> wrote:
>
>> Hi Lutalo,
>>
>> Could you also share the stacktrace of the error and when it happens?
>> It would help us decipher what's really going on in relation to what 
>> you're
>> trying to do.
>>
>> Best,
>> Ahmed
>>
>> On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph <
>> bbos...@gmail.com> wrote:
>>
>>> hi guys, am working on an ecommerce system, which has cart as an
>>> app, but i keep on getting this error and cant move on any help, here 
>>> is my
>>> views.py ,
>>> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%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+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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%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+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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com
>> 

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

2019-06-21 Thread Aldian Fazrihady
Does the stack trace mention a template variable name?  It looks like a
template variable that is expected to have integer value is not properly
initialized.

Regards,

Aldian Fazrihady

On Fri, 21 Jun 2019, 22:42 Lutalo Bbosa joseph,  wrote:

> i as well have a models.py file for carts, and products which is attached,
> when i try to search for a solution on stack overflow,all solutions insist
> on problem with integers and strings in my code. though these were passed
> solutions and not too similar to this one
>
> On Fri, Jun 21, 2019 at 6:35 PM Lutalo Bbosa joseph 
> wrote:
>
>> on pressing remove the product is supposed to be removed from the cart,
>> but it instead displays an error
>>
>> On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph 
>> wrote:
>>
>>> well here is apic of what am doing,
>>>
>>> On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque 
>>> wrote:
>>>
 Hi Lutalo,

 Could you also share the stacktrace of the error and when it happens?
 It would help us decipher what's really going on in relation to what you're
 trying to do.

 Best,
 Ahmed

 On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph 
 wrote:

> hi guys, am working on an ecommerce system, which has cart as an app,
> but i keep on getting this error and cant move on any help, here is my
> views.py ,
> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%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+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/CAMz%3Dh%3DR7b_mpnBw_xLKW%2BX5jyVk4CKXm7jwVG37R8BsSPQQegg%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+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/CAN7EoAbag_or9TPOb-KiYCmaD%2B4DDyG%2ByUfU%3DPzVRfacU09GNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Lutalo Bbosa joseph
on pressing remove the product is supposed to be removed from the cart, but
it instead displays an error

On Fri, Jun 21, 2019 at 6:34 PM Lutalo Bbosa joseph 
wrote:

> well here is apic of what am doing,
>
> On Fri, Jun 21, 2019 at 6:20 PM Ahmed Ishtiaque 
> wrote:
>
>> Hi Lutalo,
>>
>> Could you also share the stacktrace of the error and when it happens? It
>> would help us decipher what's really going on in relation to what you're
>> trying to do.
>>
>> Best,
>> Ahmed
>>
>> On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph 
>> wrote:
>>
>>> hi guys, am working on an ecommerce system, which has cart as an app,
>>> but i keep on getting this error and cant move on any help, here is my
>>> views.py ,
>>> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%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+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/CAMz%3Dh%3DT-Gp4AYzdaL_otXru--naTAoQErJbzQxCSiS4a0Tn2iw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread Ahmed Ishtiaque
Hi Lutalo,

Could you also share the stacktrace of the error and when it happens? It
would help us decipher what's really going on in relation to what you're
trying to do.

Best,
Ahmed

On Fri, Jun 21, 2019 at 8:33 AM Lutalo Bbosa joseph 
wrote:

> hi guys, am working on an ecommerce system, which has cart as an app, but
> i keep on getting this error and cant move on any help, here is my views.py
> ,
> from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%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+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/CAKizqR54L-dC46wx--DD4BL%2Biko_itWk-fPs%2B9haibZJ_LnTvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2019-06-21 Thread anchal agarwal
Hello lutalo
I am also facing the same issue. If you find any solution please let me
know . It would be very helpful.
Thank you
hi guys, am working on an ecommerce system, which has cart as an app, but i
keep on getting this error and cant move on any help, here is my views.py ,
from the commandline the error is on line 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/CAMz%3Dh%3DTQikVLrVTnwQse3r5P-rxCvaHFRP-qnYWrYSWGHPSGgw%
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+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/CAMT%3DisUkQszjKE0GjvQsi5czm77wbfjd906w8kepKd4nXFv--Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2018-07-25 Thread Jorge Gimeno
Can you please post your view?

On Tue, Jul 24, 2018 at 9:02 PM, Nitesh Chaudhary 
wrote:

> I got the error on  "Writinh your first Django app, part4, in the view of
> 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 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/e4b3a229-a85e-4281-902c-fbc2872c7690%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/CANfN%3DK9AEo%3DPTLHOWVQbu1g4NMcB4xrvt-Ac8iBbFg7BGCg89g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10: '' using FormSet with File Upload

2016-01-12 Thread Luis Zárate
What is the value of pk in

study_form_set = DiagnosticStudyFormSet(request.POST, request.FILES,
prefix='studies',
queryset=DiagnosticStudy.objects.filter(diagnostic__id=pk)). ?

Is pk an int?  try print type(pk)


El martes, 12 de enero de 2016, Néstor Boscán  escribió:
> Hi Django Forum
> I'm working on a web application that has a page with form set that
requires file upload. When I upload the files I get:
> Django Version:1.9.1
> Exception Type:ValueError
> Exception Value:
>
> invalid literal for int() with base 10: ''
>
> Exception
Location:C:\desarrollo\Python27\lib\site-packages\django\db\models\fields\__init__.py
in get_prep_value, line 976
> Python Executable:C:\desarrollo\Python27\python.exe
> Python Version:2.7.3
> On this line of code:
> study_form_set = DiagnosticStudyFormSet(request.POST, request.FILES,
prefix='studies',
queryset=DiagnosticStudy.objects.filter(diagnostic__id=pk))
> My model:
> class DiagnosticStudy(models.Model):
> id = models.AutoField(primary_key=True)
> name = models.CharField(verbose_name='Name', max_length=255)
> link = models.CharField(verbose_name='Link', max_length=255,
blank=True, null=True)
> path = models.FileField(upload_to='files', max_length=255,
blank=True, null=True)
> diagnostic = models.ForeignKey(Diagnostic, blank=True, null=True)
> study_type = models.ForeignKey(StudyType, blank=True, null=True)
> class Meta:
> managed = False
> db_table = 't_udm_diagnostic_study'
> My forms:
> class DiagnosticStudyForm(ModelForm):
> class Meta(object):
> model = DiagnosticStudy
> fields = [ 'id', 'name', 'link', 'path', 'study_type' ]
> widgets = {
>'id': HiddenInput(attrs={ 'class': 'campo' }),
> 'name': TextInput(attrs={ 'class': 'campo', 'size': '40',
'onchange': 'validate(this)' }),
> 'link': TextInput(attrs={ 'class': 'campo', 'size': '40', 'onchange':
'validate(this)' }),
> 'path': FileInput(attrs={ 'class': 'campo', 'size': '40', 'accept':
'image/gif,image/jpeg,image/pjpeg,image/png,image/tiff,image/x-tiff,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation',
'onchange': 'validate(this)' }),
> 'study_type': HiddenInput(attrs={ 'class': 'campo', 'size': '40',
'onchange': 'validate(this)' }),
> }
> DiagnosticStudyFormSet = modelformset_factory(DiagnosticStudy,
form=DiagnosticStudyForm, extra=5, can_delete=True)
> The Form does not have a IntegerField only CharFields and ForeignKeys.
Any ideas on how to know which field is generating the error?
> Regards,
> Néstor
>
> --
> 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/00b3ccfa-d092-4027-97fe-31fd6a828129%40googlegroups.com
.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
"La utopía sirve para caminar" Fernando Birri

-- 
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/CAG%2B5VyMmp%2B7dJNRKCE_KvE%2BQGcV%3DHMOt-mSuU3PihBzy66KL-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10 trying to access uploaded image

2015-04-17 Thread Stephen J. Butler
On Fri, Apr 17, 2015 at 8:16 AM, Jyothi Naidu  wrote:

>
>  if 'audit_info_manage' in request.POST:
> 192 #fullname = Employee.objects.get(emp_id=request.POST['emp_id'])
> 193 audit_manage_key = request.POST.get('audit_info_getdata')
> 194 if audit_manage_key:
> 195 audit_manage_key = request.POST.get('audit_info_getdata')
> 196 if audit_manage_key:
> 197 try:
> 198 audit_info = 
> EmployeeAuditInfo.objects.get(pk=audit_manage_key)
> 199 SUCCESS_MESSAGE = 'Updated Status successfully'
> 200 except EmployeeAuditInfo.DoesNotExist:
> 201 audit_info = EmployeeAuditInfo()
> 202 SUCCESS_MESSAGE = 'Disable an Employee successfully'
> 203
> 204 if audit_info:
> 205 #form_emp_id = int(request.POST['emp_id'])
> 206 employee = 
> Employee.objects.get(emp_id=request.POST['emp_id'])
> 207 employee.save
> 208 audit_info = EmployeeAuditInfo()
> 209 audit_info.emp_id = employee
> 210 audit_info.status = request.POST['status']
> 211 audit_info.updated_by = request.user
> 212 audit_info.created_on = request.POST['created_on']
> 213 audit_info.modified_on = request.POST['modified_on']
> 214 audit_info.reason = request.POST['reason']
> 215 audit_info.save()
>
>
Line 207 doesn't save the employee object. You forgot ().

-- 
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/CAD4ANxU_T7qp2NekkLGFVJ0R8Xh-AXuHHNw15s-2m3i3aZ5rZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: invalid literal for int() with base 10 trying to access uploaded image

2015-04-17 Thread Jyothi Naidu

Hi Kelvin,


I am also having the similar issue where i am not able to solve it

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

Request Method:POSTRequest URL:
http://172.19.7.125:8001/super-admin-dashboard/status-change/Django Version:
1.6Exception Type:ValueErrorException Value:

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

Exception 
Location:/usr/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py
 
in get_prep_value, line 1073Python Executable:/usr/local/bin/pythonPython 
Version:2.7.3Python Path:

['/home/kra/jyothi_pms',
 '/usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_ntlm-1.0.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/cx_Oracle-5.1.2-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/RBTools-0.7.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/six-1.9.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/ReviewBoard-2.0.13-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Whoosh-2.6.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/recaptcha_client-1.0.6-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pytz-2014.10-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_memcached-1.53-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/python_dateutil-1.5-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Pygments-2.0.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/paramiko-1.15.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/mimeparse-0.1.3-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Markdown-2.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/docutils-0.12-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_haystack-2.3.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/Djblets-0.8.15-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_evolution-0.7.4-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/ecdsa-0.13-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pycrypto-2.6.1-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/pillowfight-0.2-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/feedparser-5.1.3-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/django_pipeline-1.3.27-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/futures-2.2.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/mod_wsgi-4.4.8-py2.7-linux-i686.egg',
 '/usr/local/lib/python2.7/site-packages/django_lint-0.0.0-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/pylint-1.4.1-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/astroid-1.3.4-py2.7.egg',
 '/usr/local/lib/python2.7/site-packages/logilab_common-0.63.2-py2.7.egg',
 '/usr/local/lib/python27.zip',
 '/usr/local/lib/python2.7',
 '/usr/local/lib/python2.7/plat-linux2',
 '/usr/local/lib/python2.7/lib-tk',
 '/usr/local/lib/python2.7/lib-old',
 '/usr/local/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/site-packages']








 if 'audit_info_manage' in request.POST:
192 #fullname = Employee.objects.get(emp_id=request.POST['emp_id'])
193 audit_manage_key = request.POST.get('audit_info_getdata')
194 if audit_manage_key:
195 audit_manage_key = request.POST.get('audit_info_getdata')
196 if audit_manage_key:
197 try:
198 audit_info = 
EmployeeAuditInfo.objects.get(pk=audit_manage_key)
199 SUCCESS_MESSAGE = 'Updated Status successfully'
200 except EmployeeAuditInfo.DoesNotExist:
201 audit_info = EmployeeAuditInfo()
202 SUCCESS_MESSAGE = 'Disable an Employee successfully'
203
204 if audit_info:
205 #form_emp_id = int(request.POST['emp_id'])
206 employee = 
Employee.objects.get(emp_id=request.POST['emp_id'])
207 employee.save
208 audit_info = EmployeeAuditInfo()
209 audit_info.emp_id = employee
210 audit_info.status = request.POST['status']
211 audit_info.updated_by = request.user
212 audit_info.created_on = request.POST['created_on']
213 audit_info.modified_on = request.POST['modified_on']
214 audit_info.reason = request.POST['reason']
215 audit_info.save()





















On Thursday, September 18, 2008 at 11:05:02 PM UTC+5:30, kelvin pompey 
wrote:
>
> Is there a way to modify the html for the admin form to display the image 
> using the html img tag instead of having a link to the image?
>
> On Thu, Sep 18, 2008 at 11:50 AM, Lisa Dusseault  > wrote:
>
>> I've seen the same problem with FileFields, so it's not just 
>> ImageFields.  I haven't figured it out yet.  I can make a link to the file 
>> work from the main UI, but I don't know how the admin constructs its link 
>> in an unmodified admin form.
>>  
>> Lisa
>>
>>
>> On Thu, Sep 18, 2008 at 5:17 AM, silk.odyssey  
>> wrote:
>>
>>>
>>> I am using an imagefie

Re: invalid literal for int() with base 10

2012-10-22 Thread Nathan Knight
Just so you know, it is bad practice to use "import * " when importing 
modules in python.
With many modules being used, you can run into conflicting definitions. 
Plus, it increases overhead - potentially an exponential decrease in 
performance! 

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



Re: invalid literal for int() with base 10

2010-04-13 Thread Pankaj Singh
ok

i resolved ..

primary key was the problem

i was using name as pk instead of id

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



Re: invalid literal for int with base 10

2010-04-01 Thread sim
Thanks for your kind reply!
Yes you are right I running two scripts.
I got your point and you are right but my problem is to savde string
which is coming from client script. How I can do this?
here is my code:

client.py
   client.service.is_valid_user('121ABC',2)
server.py
   def get_user(uid, vid):
   vertical_id = vid
   user_id = uid
   print user_id

Now how can i save uid in user_id variable. I use print and it is
showing perfectly in terminal.

I just read that typecast is done by default in python/django.

On Apr 1, 5:31 pm, bruno desthuilliers 
wrote:
> On 1 avr, 16:12, sim  wrote:
>
> > Hello,
> > I am new to Python/Django and working on web services.
> > I have two files client and server both running on different ports
>
> I assume you mean "two scripts" ?
>
> > and
> > working as client server. Problem is this: When I send a string say
> > '121ABC' from client as parameter to server file, it catch perfectly
> > but when I assign to any veriable it raise this error " Server raised
> > fault: 'invalid literal for int() with base 10: '211ABC' ' ".
>
> > Please help in this regard. If there is anything missing please let me
> > know.
>
> As usual : *minimal* working code reproducing the behaviour, full
> traceback, and eventually test data sets.
>
> Anyway: you say "when I assign to any veriable it raise this error",
> but given the error message, it looks like you're doing something like
> this:
>
>   param = "121ABC"
>   var = int(param)
>
> Now please reread the error message and ask yourself whether "ABC" is
> a meaningful textual representation of a base 10 integer ? Hint : no,
> Python *won't* silently skip the non numeric characters here and try
> to build the int from the remaining numeric characters.
>
> HTH

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



Re: invalid literal for int with base 10

2010-04-01 Thread bruno desthuilliers

On 1 avr, 16:12, sim  wrote:
> Hello,
> I am new to Python/Django and working on web services.
> I have two files client and server both running on different ports

I assume you mean "two scripts" ?

> and
> working as client server. Problem is this: When I send a string say
> '121ABC' from client as parameter to server file, it catch perfectly
> but when I assign to any veriable it raise this error " Server raised
> fault: 'invalid literal for int() with base 10: '211ABC' ' ".
>
> Please help in this regard. If there is anything missing please let me
> know.

As usual : *minimal* working code reproducing the behaviour, full
traceback, and eventually test data sets.

Anyway: you say "when I assign to any veriable it raise this error",
but given the error message, it looks like you're doing something like
this:

  param = "121ABC"
  var = int(param)


Now please reread the error message and ask yourself whether "ABC" is
a meaningful textual representation of a base 10 integer ? Hint : no,
Python *won't* silently skip the non numeric characters here and try
to build the int from the remaining numeric characters.

HTH

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



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-10-01 Thread mrtot

Hi Kelvin,

I just ran into that problem, too.
However the hint to MEDIA_URL was correct!

You must add the following to the very bottom of your urls.py:

if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': 'd:sites/sgms/media'}),
)

This is described here:
http://docs.djangoproject.com/en/dev/howto/static-files/

Greetz,
M

On 20 Sep., 16:07, "kelvin pompey" <[EMAIL PROTECTED]> wrote:
> ok I've set the MEDIA_URL and MEDIA_ROOT, but when I click the link I get
> the 404 file not found error message. If i set ADMIN_MEDIA_PREFIX to a blank
> string then I can access the link. But there is a problem, when I try to
> change the image through the form I get a page does not exist error
> message.
> My current settings are
>
> MEDIA_ROOT = 'd:sites/sgms/media/'
> MEDIA_URL = 'http://localhost:8000/media/'
> ADMIN_MEDIA_PREFIX = '/media/'
>
> and the model
>
> class Student(models.Model):
>     photo = models.ImageField(upload_to='photos')
>
> I am using the automatic admin site.
>
> On Sat, Sep 20, 2008 at 7:22 AM, Srik <[EMAIL PROTECTED]> wrote:
>
> > Make sure you have MEDIA_URL set :)
>
> > Run into similar error, setting MEDIA_URL resolved it :)
>
> > On Sep 18, 1:17 pm, "silk.odyssey" <[EMAIL PROTECTED]> wrote:
> > > I am using an imagefield from the admin interface. I can upload images
> > > without problems but when I click the link to view the image, I get
> > > the following error.
>
> > > invalid literal for int() with base 10: '1/photos/desktop.png'
>
> > > Any idea what's wrong? I am using django 1.0.
>
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-20 Thread kelvin pompey
ok I've set the MEDIA_URL and MEDIA_ROOT, but when I click the link I get
the 404 file not found error message. If i set ADMIN_MEDIA_PREFIX to a blank
string then I can access the link. But there is a problem, when I try to
change the image through the form I get a page does not exist error
message.
My current settings are

MEDIA_ROOT = 'd:sites/sgms/media/'
MEDIA_URL = 'http://localhost:8000/media/'
ADMIN_MEDIA_PREFIX = '/media/'

and the model

class Student(models.Model):
photo = models.ImageField(upload_to='photos')

I am using the automatic admin site.

On Sat, Sep 20, 2008 at 7:22 AM, Srik <[EMAIL PROTECTED]> wrote:

>
> Make sure you have MEDIA_URL set :)
>
> Run into similar error, setting MEDIA_URL resolved it :)
>
> On Sep 18, 1:17 pm, "silk.odyssey" <[EMAIL PROTECTED]> wrote:
> > I am using an imagefield from the admin interface. I can upload images
> > without problems but when I click the link to view the image, I get
> > the following error.
> >
> > invalid literal for int() with base 10: '1/photos/desktop.png'
> >
> > Any idea what's wrong? I am using django 1.0.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-20 Thread Srik

Make sure you have MEDIA_URL set :)

Run into similar error, setting MEDIA_URL resolved it :)

On Sep 18, 1:17 pm, "silk.odyssey" <[EMAIL PROTECTED]> wrote:
> I am using an imagefield from the admin interface. I can upload images
> without problems but when I click the link to view the image, I get
> the following error.
>
> invalid literal for int() with base 10: '1/photos/desktop.png'
>
> Any idea what's wrong? I am using django 1.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-19 Thread barbara shaurette

Try logging out your SQL and look for any suspicious INSERTs - I've
run across this error a few times, under different circumstances,
always because my code is trying to insert a string when the column is
expecting an integer.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread kelvin pompey
Is there a way to modify the html for the admin form to display the image
using the html img tag instead of having a link to the image?

On Thu, Sep 18, 2008 at 11:50 AM, Lisa Dusseault
<[EMAIL PROTECTED]>wrote:

> I've seen the same problem with FileFields, so it's not just ImageFields.
> I haven't figured it out yet.  I can make a link to the file work from the
> main UI, but I don't know how the admin constructs its link in an unmodified
> admin form.
>
> Lisa
>
>
> On Thu, Sep 18, 2008 at 5:17 AM, silk.odyssey <[EMAIL PROTECTED]>wrote:
>
>>
>> I am using an imagefield from the admin interface. I can upload images
>> without problems but when I click the link to view the image, I get
>> the following error.
>>
>> invalid literal for int() with base 10: '1/photos/desktop.png'
>>
>> Any idea what's wrong? I am using django 1.0.
>>
>>
>>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread Lisa Dusseault
I've seen the same problem with FileFields, so it's not just ImageFields.  I
haven't figured it out yet.  I can make a link to the file work from the
main UI, but I don't know how the admin constructs its link in an unmodified
admin form.

Lisa

On Thu, Sep 18, 2008 at 5:17 AM, silk.odyssey <[EMAIL PROTECTED]> wrote:

>
> I am using an imagefield from the admin interface. I can upload images
> without problems but when I click the link to view the image, I get
> the following error.
>
> invalid literal for int() with base 10: '1/photos/desktop.png'
>
> Any idea what's wrong? I am using django 1.0.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread Picio

Here is mine, since I don't know how to reference dpaste... ;)
Environment:

Request Method: GET
Request URL: http://localhost:8000/admin/tvsite/areas/1/areas/batzos.jpeg/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'tv.tvsite']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in
get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in root
  158. return self.model_page(request, *url.split('/', 2))
File "C:\Python25\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in model_page
  177. return admin_obj(request, rest_of_url)
File "C:\Python25\Lib\site-packages\django\contrib\admin\options.py" in __call__
  197. return self.change_view(request, unquote(url))
File "C:\Python25\Lib\site-packages\django\db\transaction.py" in
_commit_on_success
  238. res = func(*args, **kw)
File "C:\Python25\Lib\site-packages\django\contrib\admin\options.py"
in change_view
  557. obj = model._default_manager.get(pk=object_id)
File "C:\Python25\Lib\site-packages\django\db\models\manager.py" in get
  93. return self.get_query_set().get(*args, **kwargs)
File "C:\Python25\Lib\site-packages\django\db\models\query.py" in get
  297. clone = self.filter(*args, **kwargs)
File "C:\Python25\Lib\site-packages\django\db\models\query.py" in filter
  483. return self._filter_or_exclude(False, *args, **kwargs)
File "C:\Python25\Lib\site-packages\django\db\models\query.py" in
_filter_or_exclude
  501. clone.query.add_q(Q(*args, **kwargs))
File "C:\Python25\Lib\site-packages\django\db\models\sql\query.py" in add_q
  1224. can_reuse=used_aliases)
File "C:\Python25\Lib\site-packages\django\db\models\sql\query.py" in add_filter
  1167. self.where.add((alias, col, field, lookup_type,
value), connector)
File "C:\Python25\Lib\site-packages\django\db\models\sql\where.py" in add
  48. params = field.get_db_prep_lookup(lookup_type, value)
File "C:\Python25\Lib\site-packages\django\db\models\fields\__init__.py"
in get_db_prep_lookup
  202. return [self.get_db_prep_value(value)]
File "C:\Python25\Lib\site-packages\django\db\models\fields\__init__.py"
in get_db_prep_value
  353. return int(value)

Exception Type: ValueError at /admin/tvsite/areas/1/areas/batzos.jpeg/
Exception Value: invalid literal for int() with base 10: '1/areas/batzos.jpeg'



2008/9/18 kelvin pompey <[EMAIL PROTECTED]>:
> Everything is being handled by the admin application.
>
> Environment:
>
> Request Method: GET
> Request URL:
> http://localhost:8000/admin/grades/student/1/photos/desktop.png/
> Django Version: 1.0-final-SVN-unknown
> Python Version: 2.5.2
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'sgms.grades']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware')
>
>
> Traceback:
> File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in
> get_response
>   86. response = callback(request, *callback_args,
> **callback_kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in
> root
>   158. return self.model_page(request, *url.split('/', 2))
> File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in
> _wrapped_view_func
>   44. response = view_func(request, *args, **kwargs)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in
> model_page
>   177. return admin_obj(request, rest_of_url)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in
> __call__
>   197. return self.change_view(request, unquote(url))
> File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in
> _commit_on_success
>   238. res = func(*args, **kw)
> File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in
> change_view
>   557. obj = model._default_manager.get(pk=object_id)
> File "/usr/lib/python2.5/site-packages/django/db/models/manager.py" in get
>   93. return self.get_query_set().get(*args, **kwargs)
> File "/

Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread Picio

It happens inside the admin interface, so I've little control on It (AFAIK).
This what i have in my urls.py:

from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),
)

I've pasted a traceback on dpaste.com

2008/9/18 Ross <[EMAIL PROTECTED]>:
>
> The error looks like you are passing '1/photos/desktop.png' to int(),
> which converts a string to an integer. How are you creating the link
> to the picture?
>
> Your urls.py could be capturing that entire string and passing it as a
> parameter that you are trying to cast to an integer.
>
> A bigger stack trace would be easier to track down the problem.
>
> On Sep 18, 8:34 am, Picio <[EMAIL PROTECTED]> wrote:
>> I have the same issue, tried:
>> Django 1.0 with sqlite3 (Wiindows)
>> Django 1.0 with Mysql 5.0 (Windows)
>> Django 1.0 with sqlite3 (Mac OS X)
>>
>> Daniele
>>
>> 2008/9/18 silk.odyssey <[EMAIL PROTECTED]>:
>>
>>
>>
>> > I am using an imagefield from the admin interface. I can upload images
>> > without problems but when I click the link to view the image, I get
>> > the following error.
>>
>> > invalid literal for int() with base 10: '1/photos/desktop.png'
>>
>> > Any idea what's wrong? I am using django 1.0.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread kelvin pompey
Everything is being handled by the admin application.

Environment:

Request Method: GET
Request URL:
http://localhost:8000/admin/grades/student/1/photos/desktop.png/
Django Version: 1.0-final-SVN-unknown
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin',
 'sgms.grades']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py" in
get_response
  86. response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in
root
  158. return self.model_page(request, *url.split('/', 2))
File "/usr/lib/python2.5/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  44. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py" in
model_page
  177. return admin_obj(request, rest_of_url)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in
__call__
  197. return self.change_view(request, unquote(url))
File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in
_commit_on_success
  238. res = func(*args, **kw)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/options.py" in
change_view
  557. obj = model._default_manager.get(pk=object_id)
File "/usr/lib/python2.5/site-packages/django/db/models/manager.py" in get
  93. return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in get
  297. clone = self.filter(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in filter
  483. return self._filter_or_exclude(False, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/db/models/query.py" in
_filter_or_exclude
  501. clone.query.add_q(Q(*args, **kwargs))
File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py" in
add_q
  1224. can_reuse=used_aliases)
File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py" in
add_filter
  1167. self.where.add((alias, col, field, lookup_type, value),
connector)
File "/usr/lib/python2.5/site-packages/django/db/models/sql/where.py" in add
  48. params = field.get_db_prep_lookup(lookup_type, value)
File "/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py"
in get_db_prep_lookup
  202. return [self.get_db_prep_value(value)]
File "/usr/lib/python2.5/site-packages/django/db/models/fields/__init__.py"
in get_db_prep_value
  353. return int(value)

Exception Type: ValueError at /admin/grades/student/1/photos/desktop.png/
Exception Value: invalid literal for int() with base 10:
'1/photos/desktop.png'

On Thu, Sep 18, 2008 at 9:47 AM, Ross <[EMAIL PROTECTED]> wrote:

>
> The error looks like you are passing '1/photos/desktop.png' to int(),
> which converts a string to an integer. How are you creating the link
> to the picture?
>
> Your urls.py could be capturing that entire string and passing it as a
> parameter that you are trying to cast to an integer.
>
> A bigger stack trace would be easier to track down the problem.
>
> On Sep 18, 8:34 am, Picio <[EMAIL PROTECTED]> wrote:
> > I have the same issue, tried:
> > Django 1.0 with sqlite3 (Wiindows)
> > Django 1.0 with Mysql 5.0 (Windows)
> > Django 1.0 with sqlite3 (Mac OS X)
> >
> > Daniele
> >
> > 2008/9/18 silk.odyssey <[EMAIL PROTECTED]>:
> >
> >
> >
> > > I am using an imagefield from the admin interface. I can upload images
> > > without problems but when I click the link to view the image, I get
> > > the following error.
> >
> > > invalid literal for int() with base 10: '1/photos/desktop.png'
> >
> > > Any idea what's wrong? I am using django 1.0.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread Ross

The error looks like you are passing '1/photos/desktop.png' to int(),
which converts a string to an integer. How are you creating the link
to the picture?

Your urls.py could be capturing that entire string and passing it as a
parameter that you are trying to cast to an integer.

A bigger stack trace would be easier to track down the problem.

On Sep 18, 8:34 am, Picio <[EMAIL PROTECTED]> wrote:
> I have the same issue, tried:
> Django 1.0 with sqlite3 (Wiindows)
> Django 1.0 with Mysql 5.0 (Windows)
> Django 1.0 with sqlite3 (Mac OS X)
>
> Daniele
>
> 2008/9/18 silk.odyssey <[EMAIL PROTECTED]>:
>
>
>
> > I am using an imagefield from the admin interface. I can upload images
> > without problems but when I click the link to view the image, I get
> > the following error.
>
> > invalid literal for int() with base 10: '1/photos/desktop.png'
>
> > Any idea what's wrong? I am using django 1.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: invalid literal for int() with base 10 trying to access uploaded image

2008-09-18 Thread Picio

I have the same issue, tried:
Django 1.0 with sqlite3 (Wiindows)
Django 1.0 with Mysql 5.0 (Windows)
Django 1.0 with sqlite3 (Mac OS X)

Daniele

2008/9/18 silk.odyssey <[EMAIL PROTECTED]>:
>
> I am using an imagefield from the admin interface. I can upload images
> without problems but when I click the link to view the image, I get
> the following error.
>
> invalid literal for int() with base 10: '1/photos/desktop.png'
>
> Any idea what's wrong? I am using django 1.0.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---