Re: why get_object_or_404 error is not using translation?

2024-05-19 Thread Natraj Kavander
Thank you On Sun, May 19, 2024, 1:48 AM Hossein Mahdavipour wrote: > Hi. > I am using DRF with django. In views I use get_object_or_404. When I get > a 404, the exception detail is "No %s matches the given query." > You can see the code here: > https://gith

why get_object_or_404 error is not using translation?

2024-05-18 Thread Hossein Mahdavipour
Hi. I am using DRF with django. In views I use get_object_or_404. When I get a 404, the exception detail is "No %s matches the given query." You can see the code here: https://github.com/django/django/blob/8f205acea94e93a463109e08814f78c09307f2b9/django/shortcuts.py#L88 My quest

Re: Testing - get_object_or_404 returns 200 status code

2019-06-10 Thread Cristhiam Gabriel Fernández
Hi RyuCoder Should not get_object_or_404 shortcut retry 404 status code? El lunes, 10 de junio de 2019, 15:29:24 (UTC-5), RyuCoder escribió: > > Whats your question? > I failed to understand that  > > On Tue, Jun 11, 2019, 1:45 AM Cristhiam Gabriel Fernández < > cristh

Re: Testing - get_object_or_404 returns 200 status code

2019-06-10 Thread Chetan Ganji
Whats your question? I failed to understand that  On Tue, Jun 11, 2019, 1:45 AM Cristhiam Gabriel Fernández < cristhiang...@gmail.com> wrote: > Hi Django super heroes > > I'm making of test cases for my simple Django application. When I test a > view with get_object_or_404 s

Testing - get_object_or_404 returns 200 status code

2019-06-10 Thread Cristhiam Gabriel Fernández
Hi Django super heroes I'm making of test cases for my simple Django application. When I test a view with get_object_or_404 shortcut it returns 200 status code. def my_view(self, request): obj_id = request.POST.get('id') obj = get_object_or_404(MyModel, pk=id) # Test case ...data

Re: PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Nikoleta Misheva
> I am querying PostgreSQL using *get_object_or_404 * but it throws and >> exception *PairUsers matching query does not exist *and after that *During >> handling of the above exception, another exception >> occurred:django.http.response.Http404: No PairUsers matches the given qu

Re: PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Daniel Roseman
On Saturday, 18 February 2017 17:37:49 UTC, Nikoleta Misheva wrote: > > I am querying PostgreSQL using *get_object_or_404 * but it throws and > exception *PairUsers matching query does not exist *and after that *During > handling of the above exception, anoth

PostgreSQL get_object_or_404 matching query does not exist when indeed it does?

2017-02-18 Thread Nikoleta Misheva
I am querying PostgreSQL using *get_object_or_404 * but it throws and exception *PairUsers matching query does not exist *and after that *During handling of the above exception, another exception occurred:django.http.response.Http404: No PairUsers matches the given query *when indeed I

Django Unleashed - use of get_object_or_404 on page 154-155

2017-02-17 Thread John Boyd
Hello, Going through Django Unleashed book right now. Line 12 in blog/views.py page 155 reads: slug=slug shouldn't it be: slug__iexact=slug Best Regards, John. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: how make a template's link using get_object_or_404 by pk=id

2013-05-10 Thread Federico Erbea
ok i'm totaly stupid {% extends "Base.html" %} {% block titolo %}Attore{% endblock %} {% block contenuto %} {{ attore.nome }} {{ attore.cognome }} {% endblock %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this

Re: how make a template's link using get_object_or_404 by pk=id

2013-05-10 Thread Federico Erbea
In this way there isn't an exception but it doesn't load attore.nome e attore.cognome *Attore.html :* {% extends "Base.html" %} {% block titolo %}Attore{% endblock %} {% block contenuto %} {% for attore in film %} {{ attore.nome }} {{ attore.cognome }} {% endfor %}{% endblock %} --

Re: how make a template's link using get_object_or_404 by pk=id

2013-05-10 Thread Federico Erbea
'Film.html', { 'film': film, }) def film_attore(request, id): attore = get_object_or_404( Attore, pk=id ) return render_to_response('Attore.html', { 'film': Film.objects.filter( attori=attore ), 'attore': attore }) *Attore.html : this is what i tried, but it doesn't work. * {% extends

Re: how make a template's link using get_object_or_404 by pk=id

2013-05-10 Thread Daniel Roseman
or_404from > django.template import RequestContextfrom models import * > def film(request): > film = Film.objects.order_by("titolo") > return render_to_response('Film.html', { 'film': film, }) > def film_attore(request, id): > get_attore_id = get_object_or_4

how make a template's link using get_object_or_404 by pk=id

2013-05-10 Thread Federico Erbea
django.shortcuts import render_to_response, get_object_or_404from django.template import RequestContextfrom models import * def film(request): film = Film.objects.order_by("titolo") return render_to_response('Film.html', { 'film': film, }) def film_attore(request, id): get

Re: get_object_or_404 Tutorial part 3

2011-04-13 Thread Yuka Poppe
> I believe that the cutoff is 512 bytes, but you may want to test in > different browsers to be sure. I suspected as much but wasnt quite sure, it didn't matter as much at the time I had to deal with it, and the problem went away by itself. None the less its nice to have this information

Re: get_object_or_404 Tutorial part 3

2011-04-13 Thread Jacob Kaplan-Moss
On Wed, Apr 13, 2011 at 6:41 AM, Yuka Poppe wrote: > I noticed this myself a while back; It was'nt django specific, and I dont > know about IE, I generally try to avoid using that; But in case of Chrome, > whenever it encounters a 404 error (or certain other conditions) it seems

Re: get_object_or_404 Tutorial part 3

2011-04-13 Thread Yuka Poppe
variation to it when it did and didnt occur, but I'll have to say I didnt put a lot of energy into finding out. -- Regards, Yuka On Wed, Apr 13, 2011 at 3:02 PM, darekodz <darek...@gmail.com> wrote: > I've very strange error in part 3. I want to test using function > get_object_or_404. I've

get_object_or_404 Tutorial part 3

2011-04-13 Thread darekodz
I've very strange error in part 3. I want to test using function get_object_or_404. I've 3 polls, so in that adress: http://localhost:8000/polls/1/ http://localhost:8000/polls/2/ http://localhost:8000/polls/3/ everything is OK. In that adress: http://localhost:8000/polls/4/ Should be exeptions 404

Re: get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-02 Thread Tom Evans
<bruno.desthuilli...@gmail.com> wrote: >> On 1 déc, 19:20, Pranav <pranav...@gmail.com> wrote: >> >> > Hi all, >> >> > I'm new to django and python and i'm working on a project that works >> > with a legacy database. >> > I've a partic

Re: get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-01 Thread Pranav
database. > > I've a particular problem with a "composite key" and "get" or > > "get_object_or_404". > > > i generated the below model form the legacy database using inspectdb > > > model: > > -- > > cla

Re: get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-01 Thread bruno desthuilliers
On 1 déc, 19:20, Pranav <pranav...@gmail.com> wrote: > Hi all, > > I'm new to django and python and i'm working on a project that works > with a legacy database. > I've a particular problem with a "composite key" and "get" or > "get_object_or_404&

Re: get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-01 Thread Daniel Roseman
On Dec 1, 6:20 pm, Pranav <pranav...@gmail.com> wrote: > Hi all, > > I'm new to django and python and i'm working on a project that works > with a legacy database. > I've a particular problem with a "composite key" and "get" or > "get_object_or_404&

get_object_or_404 on composite key and Value Error:Invalid Literal for int with base 10

2010-12-01 Thread Pranav
Hi all, I'm new to django and python and i'm working on a project that works with a legacy database. I've a particular problem with a "composite key" and "get" or "get_object_or_404". i generated the below model form the legacy database using inspectdb model: -

Re: get_object_or_404

2010-11-15 Thread Colin Bean
On Sun, Nov 14, 2010 at 9:23 PM, Akn wrote: > Hi, > I would like to use get_object to retrieve an object form the > database, but if the object does not exist I do not want to display an > error page(404). Is there any command that does that. > > ob=get_object(Table,x=y) >

Re: get_object_or_404

2010-11-14 Thread Knut Ivar Nesheim
try: obj = Model.objects.get(x = y) except Model.DoesNotExist: On Mon, Nov 15, 2010 at 6:23 AM, Akn wrote: > Hi, > I would like to use get_object to retrieve an object form the > database, but if the object does not exist I do not want to display an > error

get_object_or_404

2010-11-14 Thread Akn
Hi, I would like to use get_object to retrieve an object form the database, but if the object does not exist I do not want to display an error page(404). Is there any command that does that. ob=get_object(Table,x=y) if not ob -- You received this message because you are subscribed to

Re: FieldError with get_object_or_404

2010-02-04 Thread Andy McKay
On 2010-02-04, at 7:36 AM, harryos wrote: > In the shell I tried this > from django.shortcuts import get_object_or_404 as gtobj > e1=gtobj(MyEntry,posted_time__year=2010,posted_time__month=2,posted_time__day=1) > This is successful ,it gives this message > MultipleObjectsReturned:

FieldError with get_object_or_404

2010-02-04 Thread harryos
hi I was trying out in django's python shell the get_object_or_404 method on a set of entries I created in the db.I created an entry with a DateTimeField called 'posted_time'.I used datetime.datetime.now as default value and it created Date:2010-02-01 Time:10:02:22 I also created many other

Re: get_object_or_404 and foreignkey

2009-03-08 Thread Jamie Pittock
Thanks again. I'm still new to all this. On Mar 7, 9:37 pm, Daniel Roseman wrote: > On Mar 7, 8:21 pm, Jamie Pittock wrote: > > > Thanks Daniel.  Yeah it's just a way of getting the county so I'll try > > your second option.  Could you

Re: get_object_or_404 and foreignkey

2009-03-07 Thread Daniel Roseman
On Mar 7, 8:21 pm, Jamie Pittock wrote: > Thanks Daniel.  Yeah it's just a way of getting the county so I'll try > your second option.  Could you possibly point me to the docs that > explain the double underscore? It's the standard syntax for lookups across relationships.

Re: get_object_or_404 and foreignkey

2009-03-07 Thread Jamie Pittock
        def __unicode__(self): > >                 return self.name > > > The url for a county would be of the format domain.com/country/ > > country/. > > > On the corresponding view for that url I'm currently doing this... > > > def view_county(request, cou

Re: get_object_or_404 and foreignkey

2009-03-07 Thread Daniel Roseman
            return self.name > > The url for a county would be of the format domain.com/country/ > country/. > > On the corresponding view for that url I'm currently doing this... > > def view_county(request, country_slug, county_slug): >         country = get_object_

Re: get_object_or_404 and foreignkey

2009-03-07 Thread Jamie Pittock
oreignKey(Country) > >         def __unicode__(self): >                 return self.name > > The url for a county would be of the format domain.com/country/ > country/. > > On the corresponding view for that url I'm currently doing this... > > def view_county(request, country_slu

get_object_or_404 and foreignkey

2009-03-07 Thread Jamie Pittock
currently doing this... def view_county(request, country_slug, county_slug): country = get_object_or_404(Country, slug=country_slug) county = get_object_or_404(County, slug=county_slug, country=country.id) 1. First checking to see if a country exists with that slug 2. Then checking to see

Re: get_object_or_404 error

2008-10-16 Thread jseleuco
Yup, you are right. The thing was I started with the google app egine first, then saw I could use the django framework. I think I'll start again just with the Django framework, but anyway I have not seen any solution to that problem... On Oct 16, 6:30 am, Malcolm Tredinnick <[EMAIL

Re: get_object_or_404 error

2008-10-15 Thread Malcolm Tredinnick
On Wed, 2008-10-15 at 16:09 -0700, jseleuco wrote: > Hi all, > > Just started today with the Python, Django and Google app engine and > having some novice problems as well :) I just noticed you said it's your first day with everything. So how about cranking back the difficulty level a bit?

Re: get_object_or_404 error

2008-10-15 Thread Malcolm Tredinnick
On Wed, 2008-10-15 at 16:09 -0700, jseleuco wrote: > Hi all, > > Just started today with the Python, Django and Google app engine and > having some novice problems as well :) > > > def detail(request, poll_id): > p = get_object_or_404(Poll, pk=poll_id) >

Re: get_object_or_404 error

2008-10-15 Thread felix
some novice problems as well :) > > > def detail(request, poll_id): > p = get_object_or_404(Poll, pk=poll_id) > return render_to_response('polls/detail.html', {'poll': p}) > > > The get_object_or_404 method is crashing, which i really dont > understand why. >

get_object_or_404 error

2008-10-15 Thread jseleuco
Hi all, Just started today with the Python, Django and Google app engine and having some novice problems as well :) def detail(request, poll_id): p = get_object_or_404(Poll, pk=poll_id) return render_to_response('polls/detail.html', {'poll': p}) The get_object_or_404 method

Re: Can managers take parameters? Or can you chain a filter in get_object_or_404?

2007-05-10 Thread Malcolm Tredinnick
On Thu, 2007-05-10 at 13:52 +, AndyB wrote: > This could quite easily be another dumb question but here goes :( > > Can a model have a manager that either takes a parameter or can access > the current logged in user? > > I simply want to filter any query sets returned from a table called >

Can managers take parameters? Or can you chain a filter in get_object_or_404?

2007-05-10 Thread AndyB
to catch every place in the application where I access the Properties table. Failing that can I still use get_object_or_404 if I want to have two conditions: pk=something and category=somethingelse Is there another way of doing this that hasn't occurred to me? Thanks for anyone's assistance. I'm

Re: What does get_object_or_404 return?

2006-12-27 Thread Nader
of detail function in my views.py model > def detail(request, object_id): > wk-report = get_object_or_404(Report, pk=object_id)Ye > return render_to_response('weekly/weekly_detail.html', > {'object': wk-report}) > Then I reference to the object

Re: What does get_object_or_404 return?

2006-12-27 Thread Adrian Holovaty
On 12/27/06, Nader <[EMAIL PROTECTED]> wrote: This is a definition of detail function in my views.py model def detail(request, object_id): wk-report = get_object_or_404(Report, pk=object_id) return render_to_response('weekly/weekly_detail.html', {'

What does get_object_or_404 return?

2006-12-27 Thread Nader
This is a definition of detail function in my views.py model def detail(request, object_id): wk-report = get_object_or_404(Report, pk=object_id) return render_to_response('weekly/weekly_detail.html', {'object': wk-report}) Then I reference to the object 'wk

Re: get_object_or_404 and select_related?

2006-09-01 Thread Adrian Holovaty
On 8/28/06, Rob Hudson <[EMAIL PROTECTED]> wrote: > Can you use both? I saw a link to a post about this sort of here: > http://groups.google.com/group/django-developers/browse_thread/thread/818c2ee766550426/e311d8fe6a04bb22 > but didn't see a resolution. There's no great solution to this yet.

get_object_or_404 and select_related?

2006-08-28 Thread Rob Hudson
Can you use both? I saw a link to a post about this sort of here: http://groups.google.com/group/django-developers/browse_thread/thread/818c2ee766550426/e311d8fe6a04bb22 but didn't see a resolution. Thanks, Rob --~--~-~--~~~---~--~~ You received this message