Hello,
I am studying on django tutorials 3 and 4.
I have polls/model.py is as follows
import datetime
from django.utils import timezone
from django.db import models
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeF
Hello,
I am studying tutorial 4. I have a page not found error. My mysite/urls.py
is as follows :
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView
from polls.models import Poll
from django.contrib import admin
admin.autodiscover()
#urlpatter
Hello,
How can I develop web service using django?
Is there edit and continue feature in django/python like Microsoft Visual
Studio/CSharp?
Thank you.
--
SEYFULLAH TIKIÇ
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Could you give us the fill error message displaying what ended up being
passed to the view?
Also, are you sure a car exists with the id / pk you're passing?
Le 7 juil. 2012 23:10, "Soviet" a écrit :
> But the ListView is working fine. And they don't use in the
> documentation, just this, which
This comes down to a simple middleware that intercepts http requests and
redirects them to https. This is very to do in django.
You can find plenty of such middleware on djangosnippets.
Now, if your app is running behind a reverse proxy (e.g. nginx + gunicorn)
, things get a little bit more comp
What is kills the whole app supposed to mean?
Just pulling this out of thin air, but do you have a record in your
database (sites) that corresponds to your SITE_ID setting (when you add
it)
Le 6 juil. 2012 13:43, "Melvyn Sopacua" a écrit :
> On 6-7-2012 7:38, DF wrote:
>
> > Hi. I just delayed
I think you're going to need to provide more context here.
Are you telling us that reading from your database takes minutes?
Do your remote clients periodically poll your api?
What's the overall flow and what's the issue you have?
I hardly believe that caching is useful here, unless you're te
Which url are you trying to access when you get that 404?
On Jul 8, 2012 5:36 PM, "Seyfullah Tıkıç" wrote:
--
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 t
> Also, are you sure a car exists with the id / pk you're passing?
Turns out that's the problem. I wanted to use a field from my Car model:
car_id, so the link on the website would look like:
www.blablabla.com/cars/3421, where 3421 is the car_id. Unfortunately, the
car_id is not the same as .
More data would be nice. What url are you goimg to that's failing, exactly? Are
you clicking a link from your ListView? If so, could you show your template?
-Mensaje original-
De: Soviet
Enviados: 07/07/2012 18:10:17
Asunto: Re: Problem with DetailView
But the ListView is working fine
http://127.0.0.1:8000/polls/34/
http://127.0.0.1:8000/polls/
http://127.0.0.1:8000/polls/34/results/
2012/7/8 Mario Gudelj
> Which url are you trying to access when you get that 404?
> On Jul 8, 2012 5:36 PM, "Seyfullah Tıkıç" wrote:
>
> --
> You received this message because you are subscribed
But you've commented out all your URLs that start with /polls/, like
url(r'^polls/$',
'index')... r'^polls/$' will resolve to http://127.0.0.1:8000/polls/, for
example.
-m
On 8 July 2012 23:01, Seyfullah Tıkıç wrote:
> http://127.0.0.1:8000/polls/34/
> http://127.0.0.1:8000/polls/
> http://127.
Django has list_editable. I need to edit is_active flag.
class MyUserAdminForm(ModelForm):
class Meta:
model = User
def clean_is_active(self):
# do something that validates your data
print ' I am here... '
print self.cleaned_data
print self
cla
I agree, but I think at the web server level is much better. Middlewares
can break if Django core changes a lot, and since they are third-party hack
code, so unless you are confident how to maintain it yourself, don't use
them. Apache, Nginx configurations are widely used so they are easier to
You run the development server right out of the box such as python
manage.py runserver
But for real deployment you don't use the development servers. It doesn't
support multiple requests. It will break. It's a toy, basically.
Watch some youtube videos on getting started with Django. Then look at
Django has list_editable. I need to edit is_active flag.
class MyUserAdminForm(ModelForm):
class Meta:
model = User
def clean_is_active(self):
# do something that validates your data
print ' I am here... '
print self.cleaned_data
print self
cla
> Turns out that's the problem. I wanted to use a field from my Car model:
> car_id, so the link on the website would look like:
> www.blablabla.com/cars/3421, where 3421 is the car_id. Unfortunately, the
> car_id is not the same as . Can I achieve something like that with class
what's car_id and
Are you importing your listeners.py from anywhere?
--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde
|_|0|_|
|_|_|0|
|0|0|0|
(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.
--
You received t
No, I'm not. I didn't think I need to...
On 9 July 2012 00:04, Tomas Neme wrote:
> Are you importing your listeners.py from anywhere?
>
> --
> "The whole of Japan is pure invention. There is no such country, there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (
> No, I'm not. I didn't think I need to...
the only things that are automatically included are your settings
file, your site urls file, and your apps' models file, everything else
depends on you (or them) to include them. For example, if you don't
call admin.autodiscover() sometime soon (your site
That's because of my example. I have a LEGO Set model:
class Set(models.Model):
lego_id = models.CharField(max_length=32, primary_key=True, blank=True)
#lego_id stores the unique number that's on every Lego box
text_name = models.CharField(max_length=64)
#...
And I resolved my proble
That's because of my example. I have a LEGO Set model:
class Set(models.Model):
lego_id = models.CharField(max_length=
32, primary_key=True, blank=True) #lego_id stores the unique number that's
on every Lego box
text_name = models.CharField(max_length=64)
#...
And I resolved my probl
I haven't played much with annotation/aggregation, so I may be barking up
the wrong tree. but on:
https://docs.djangoproject.com/en/1.4/topics/db/aggregation/
I find:
"the original results are grouped according to the unique combinations of
the fields specified in the values() clause"
I t
Man...
> (r'^sets/(?P\d+)/$', SetDetailView.as_view(
> model=Set,
> context_object_name="set_details",
> template_name='data/set_details.html',
> )),
>
> But the site is empty. Here's my extremely simple template:
>
> {% block title %}{{ set.text_name }}{% endblock %}
>
> {% block
Ah. I think the method is overriding the edit page. In other words, you
have click on the editpage to see the effect of my fail code. So it doesn't
trigger if you are on the list view page. Does anyone know what to do with
the editable submission?
It should use the same clean_ method, shouldn't
Yes, in tutorial it is said to be done so. I expect it works as follows,
after the commented lines.
urlpatterns = patterns('',
url(r'^$',
ListView.as_view(
queryset=Poll.objects.order_by('-pub_date')[:5],
context_object_name='latest_poll_list',
templa
Ha! Thank you and sorry for my stupidity. I was confused by the fact that I
didn't had to do this in {for ... in ...}.
W dniu niedziela, 8 lipca 2012 19:05:17 UTC+2 użytkownik Tomas Neme napisał:
>
> Man...
>
> > (r'^sets/(?P\d+)/$', SetDetailView.as_view(
> > model=Set,
> > context_ob
Django isn't able to guess you want your polls urls under a /poll/ path.
To achieve this, you do url inclusion
you define something like polls/urls.py like you did and then do
url(r'^polls/', include('polls.urls'))
then your defined urls will work when prepended with a polls/ path.
You can chan
That's indeed a valid point, if you're going to deploy multiple services
behind a webserver it does make sense to do it at webserver level as you'll
avoid duplicating your efforts.
Now, using middleware that redirects to https does not have to be "a hack",
andif django changes to the point that y
On 7-7-2012 14:13, Smaran Harihar wrote:
> Thanks for the reply Melvyn.
>
> So by multiple model instances you mean the multiple records that poll app
> has in it's database?
Yes, the class definition corresponds to a table definition in the
database. An instance of that model corresponds to a re
Hello All,
I am new to Django and I'm trying to create a simple website. I am
trying to get an jpg to appear in the base template but I cant get it
to show up.
In setting.py
MEDIA_ROOT = '/Users/Jak/projects/fap/mysite/media',
MEDIA_URL = '/media/'
urls.py
(r'^media/(?P.*)$', 'django.views.stati
Ok thank you. It worked :)
I insertes polls/ like you said.
2012/7/8 Tomas Neme
> Django isn't able to guess you want your polls urls under a /poll/ path.
>
> To achieve this, you do url inclusion
>
> you define something like polls/urls.py like you did and then do
>
> url(r'^polls/', include('p
To do what? I'm trying to lead you to conclussions, but i seem to be leading
you to confusion instead.
You should read the generic views docs again. For any single object view, the
default object name is 'object', unless you set the context_object_name
parameter. The list view calls it 'object
Update:
I'm now using requestcontext in my view.
my new view is
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.loader import get_template
from django.template import RequestContext
def homepage(request):
return render_to_response ('i
> A queryset returns a /list/ of model instances. Thus you should queryset
> when you want more then one instance of the model displayed.
well, slightly wrong, let's clarify. While it's true a queryset
represents a list of model instances (it's not EXACTLY that, it's,
more like, a partially set up
Oh, and setting up a queryset in a DetailView means that it won't work
for instances that are not inside the queryset, if we did
url(r'/books/shakespeare/(P\d+)/$',
queryset=Book.objects.filter(author='shakespeare')), then
/books/shakespeare/1/ would work if the book with pk=1 was Romeo and
Juliet
> Ah. I think the method is overriding the edit page. In other words, you have
> click on the editpage to see the effect of my fail code. So it doesn't
> trigger if you are on the list view page. Does anyone know what to do with
> the editable submission?
> It should use the same clean_ method, sho
I have a template in a 3rd party app that i'm trying to override, but only
a single block.
Is there any way that I can do this without copy-pasting the entire
template into the global templates dir just to change a few lines?
Is there any way to create a template that "extends" itself from furth
I'm not sure by what you mean; There has always been template inheritance
in Django :) Just specify the template you want to extend as the first
statement in the template and to override a block in the template, just
start a block with the same name as the block you want to override. For
example, t
Sorry, I should have been clearer. What I have is an external project that
is included "as-is". It has it's templates and it's views are hardcoded
against the template names.
I want to know if it's possible to create a template called, say,
"app/dashboard.html" in the global template dir that th
40 matches
Mail list logo