It says at the end of part 3 of the Django tutorial:
"The idea behind include() and URLconf decoupling is to make it easy
to plug-and-play URLs. Now that polls are in their own URLconf, they
can be placed under "/polls/", or under "/fun_polls/", or under "/
content/polls/", or any other path root,
On Wednesday, 2 November 2011 07:24:39 UTC, rihad wrote:
>
> It says at the end of part 3 of the Django tutorial:
>
> "The idea behind include() and URLconf decoupling is to make it easy
> to plug-and-play URLs. Now that polls are in their own URLconf, they
> can be placed under "/polls/", or un
I've started the Django tutorial and I get as far as running python
manage.py runserver, but when I do, nothing happens. I get no messages
and the database connected to the project is still empty. The database
exists and I've made no modifications to any of the files created,
accept for the info to
Sorry, title is supposed to be "python manage.py runserver" creates no
tables (tutorial)
On Nov 2, 10:42 am, angelika wrote:
> I've started the Django tutorial and I get as far as running python
> manage.py runserver, but when I do, nothing happens. I get no messages
> and the database connected
did u do a syncdb ?
On 02-Nov-2011, at 3:12 PM, angelika wrote:
> I've started the Django tutorial and I get as far as running python
> manage.py runserver, but when I do, nothing happens. I get no messages
> and the database connected to the project is still empty. The database
> exists and I've
Christ, I totally messed up this post. I did not mean "python
manage.py runserver" but "python manage.py syncdb". That is the
command that does not create any tables. Sorry.
On Nov 2, 10:44 am, nisa balakrishnan
wrote:
> did u do a syncdb ?
> On 02-Nov-2011, at 3:12 PM, angelika wrote:
>
>
>
>
>
Thanks a million, Kurtis! I followed your advice and I no longer get
any errors when I run "python manage.py runserver". Hurray :) !
I'll probably give PostgreSQL a try once I've got the hang of python
and django a bit more, since you were all so positive about that.
My next problem is that the c
On Wed, 2011-11-02 at 02:47 -0700, angelika wrote:
> Christ, I totally messed up this post. I did not mean "python
> manage.py runserver" but "python manage.py syncdb". That is the
> command that does not create any tables. Sorry.
>
>
https://code.djangoproject.com/ticket/11494 - it may be due to
On Nov 2, 1:29 pm, Daniel Roseman wrote:
> On Wednesday, 2 November 2011 07:24:39 UTC, rihad wrote:
>
> > It says at the end of part 3 of the Django tutorial:
>
> > "The idea behind include() and URLconf decoupling is to make it easy
> > to plug-and-play URLs. Now that polls are in their own URL
On Nov 2, 1:29 pm, Daniel Roseman wrote:
> On Wednesday, 2 November 2011 07:24:39 UTC, rihad wrote:
>
> > render_to_response('polls/detail.html', {'poll': p})
Oops, of course this has no relation to URLs, it's just a filepath :)
--
You received this message because you are subscribed to the
Thanks, Kenneth.
I'm new to both Python and Django. I'm doing the tutorial and I named
the site mysite, to keep it simple. Does that mean mysite is the name
of the app? And the command should be:
from mysite import *
I did that, but nothing happened. Same as with 'python manage.py
runserver'. No
As alluded to previously, the most "straightforward way to use a set of
choices of which several can be chosen" IS to use a ManyToManyField. The
syntax is slightly different, but ManyToManyFields are really easy to use
with Django. Do not reinvent the wheel in this case.
Thanks,
Mark Furbee
On
I will explain what i'm trying to achieve, I'm using Dajaxice with
Django.
I created modelformset which consist of multiple forms. Each form has
dropdown field on which I'm calling dajaxice function, that function
will takes the value of the dropdown field and calls another python
function which c
Hi,
I just discovered, that "if obj in queryset" can be very slow:
queryset=MyModel.objects.all()
obj=MyModel.objects.get(id=319526)
#if obj in queryset: # This is very slow, if queryset is big: All lines from
queryset get created to Python objects
#print 'in'
if queryset.filter(id=obj.id)
On Wed, 2011-11-02 at 04:37 -0700, angelika wrote:
> I'm new to both Python and Django. I'm doing the tutorial and I named
> the site mysite, to keep it simple. Does that mean mysite is the name
> of the app? And the command should be:
you must have created an app under mysite - probably named 'po
That's because your queryset is being evaluated when you compare, maybe if
you explain your problem, we can give you a better solution than the use of
`in`.
Take a look at the docs about when querysets are evaluated:
https://docs.djangoproject.com/en/dev/ref/models/querysets/#when-querysets-are-e
I'm following the tutorial on this page:
https://docs.djangoproject.com/en/1.3/intro/tutorial01/
In it, the 'python manage.py syncdb' command is supposed to be run to
create tables for the apps in the INSTALLED_APPS setting, right? And
this bit seems to come before you start creating an app. Or ha
On Wed, 2011-11-02 at 04:59 -0700, angelika wrote:
> I'm following the tutorial on this page:
> https://docs.djangoproject.com/en/1.3/intro/tutorial01/
>
> In it, the 'python manage.py syncdb' command is supposed to be run to
> create tables for the apps in the INSTALLED_APPS setting, right? And
>
You do not need to run syncdb before creating your first app, syncdb search
for the apps in INSTALLED_APPS and sync their models with the database, so
you can run it anytime. Note that if you just change an existing model
syncdb won't sync anything, you'll need migrations for that.
[]'s
On Wed, N
On 1 Nov., 18:54, Mark Furbee wrote:
> As alluded to previously, the most "straightforward way to use a set of
> choices of which several can be chosen" IS to use a ManyToManyField. The
> syntax is slightly different, but ManyToManyFields are really easy to use
> with Django. Do not reinvent the
Well, here I am, confessing my stupidity to the internet. Like I said,
I'm new to both Python and Django. I've been trying to run the
commands in the same terminal window where I ran the 'python manage.py
runserver'. When I run it in a separate window, it all works as
expected. The tables are creat
Hi,
I have the following model layout:
class A(models.model):
options = models.ManyToManyField(OptionSet, blank=True, null=True)
values = models.ManyToManyField(Value, blank=True, null=True)
class OptionSet(models.model):
name = models.TextField(unique=True)
values = models.ManyT
How can i access the form in django views.
Suppose
Modelform
class QuestionForm(forms.ModelForm):
answer = forms.ChoiceField(choices=HAY_EVALUATION_CHOICES,
widget=forms.Select(attrs={'onchange': 'this.form.submit();'}))
In views.py
if 'form-0-answer' in request.POST:
answer
> queryset=MyModel.objects.all()
> obj=MyModel.objects.get(id=319526)
Thomas,
if the second line works for you (i.e. does not raise
MyModel.DoesNotExist exception), then obj is in queryset by
definition.
What are you trying to achieve?
Jirka
--
You received this message because you are
Opened a bug:
https://code.djangoproject.com/ticket/17144
I think I might take a crack at fixing this one.
On Nov 1, 9:06 pm, Karen Tracey wrote:
> On Tue, Nov 1, 2011 at 6:19 PM, christian.oudard
>
>
>
>
>
>
>
>
> > wrote:
> > I am doing a very simple aggregation using the Django ORM, and it
What about if you do a
python manage.py sqlall
>From the settings file, I do not see any of your apps added in the
list of installed apps, like
INSTALLED_APPS = (
'django.contrib.auth',
'mysite.news',
.,
)
Martin.
--
You received this message because you are subscribed to the Google
How can i access the form fields in django views.
Suppose i have modelform called
class QuestionForm(forms.ModelForm):
answer = forms.ChoiceField(choices=HAY_EVALUATION_CHOICES,
widget=forms.Select(attrs={'onchange': 'this.form.submit();'}))
In views.py
if 'form-0-answer' in reque
Here is a better example:
def get_special_objects():
# Some are special. But the result can still be huge!
return MyModel.objects.filter()
obj=MyModel.objects.get()
# is this object "special?"
if obj in get_special_objects(): # This is very slow if there are many rows in
the res
Yes, it does work in runserver, as might be expected since runserver
uses exact same environment as the shell.
So that established, how can I fix it?
On Nov 1, 9:04 pm, Andy McKay wrote:
> Is this using the Django built in runserver or some other way of serving
> pages? If not try using runserve
On Wed, Nov 2, 2011 at 3:25 PM, Thomas Guettler wrote:
> Here is a better example:
>
> def get_special_objects():
> # Some are special. But the result can still be huge!
> return MyModel.objects.filter()
>
> obj=MyModel.objects.get()
>
> # is this object "special?"
> if obj in get_sp
On Wed, Nov 2, 2011 at 12:15 PM, Jaroslav Dobrek
wrote:
> I now use ManyToManyFields and hide certain data from administrators
> by simply not importing them into admin.py. What I don't like about
> this solution is that this data still is in the database and not in my
> source code. In my view, i
Try changing your success_url to this same page.
On Wed, Nov 2, 2011 at 11:00 AM, asif.jama...@rezayat.net <
asif.jama...@rezayat.net> wrote:
> How can i access the form fields in django views.
>
> Suppose i have modelform called
>
>
> class QuestionForm(forms.ModelForm):
>
>
> answer = forms.Ch
You could pass the values from the view to the template and use javascript
(I would suggest using jQuery) if there are only a few options. I would
suggest using Dajax (dajaxproject.com) for your AJAX commands. It is really
easy to plug into Django, and you should get familiar with it and the
jQuery
I think your 'answer' is going to exist in POST in either case. Perhaps
change the construct of your logic to:
if 'evaluation' in request.POST:
return render_to_response('results.html')
elif 'form-0-answer' in request.POST:
answer = request.POST.get('answer','')
val
You said you are using django.contrib.auth.models.User as your User model,
but that doesn't have a "foos" property. Can you share the models that you
are using? Are you creating a subclass User that extends
django.contrib.auth.models.User and adds foos and a ForeignKey? Is foos a
ManyToManyField, O
You could call the Dajaxice method that gets the result (the one that fires
when the drop down changes) with window.onload, or you could pass the
initial values to the template via the view. For consistency and code
reuse, I would personally use the first method, calling the Dajaxice
function respo
Whoops, sorry -- I didn't realize you weren't using CBVs. :)
On Wed, Nov 2, 2011 at 12:43 PM, Furbee wrote:
> I think your 'answer' is going to exist in POST in either case. Perhaps
> change the construct of your logic to:
>
> if 'evaluation' in request.POST:
> return render_to_respo
I have a url that I need to attach to link that is in a jquery
section. It seem like the django template system is not getting the
variable. For example:
$.each(event,function(index,value){
var url = "{% url fiesta.views.detail "+
event[index].pk +" %}"
n Wed, Nov 2, 2011 at 5:13 PM, Kevin Miller wrote:
> I have a url that I need to attach to link that is in a jquery
> section. It seem like the django template system is not getting the
> variable. For example:
>
> $.each(event,function(index,value){
> var url = "{% url fies
Hello,
i'm currently doning a website where user can register (without
password, without auth module of Django). They put some informations
and at the end (Step5Form) do multiple choices by clicking on
checkboxes. When I click on validate on the last step I've "instance
needs to have a primary key
On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote:
> # This is my current solution
> if get_special_objects().filter(pk=obj.pk).count():
># yes, it is special
>
>
I can't speak to the "why" of this situation; it seems to me that this
could always be converted into a more efficient databas
On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote:
> On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote:
>>
>> # This is my current solution
>> if get_special_objects().filter(pk=obj.pk).count():
>> # yes, it is special
>>
>
> I can't speak to the "why" of this situation; it seems to me th
In your Customer model there are fields which cannot be Null, so you cannot
instance.save() before setting those properties. So, you may have to check
for the category field in your loop and if it is category, save the
instance first. Something like the following:
views.py (in clients application)
Thanks Tom, that's a great explanation!
Furbeenator
On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote:
> On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote:
> > On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote:
> >>
> >> # This is my current solution
> >> if get_special_objects().filter(p
On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote:
> On Wed, Nov 2, 2011 at 5:30 PM, Ian Clelland wrote:
> > On Wed, Nov 2, 2011 at 8:25 AM, Thomas Guettler wrote:
> >>
> >> # This is my current solution
> >> if get_special_objects().filter(pk=obj.pk).count():
> >># yes, it is special
> >>
>
On Wed, Nov 2, 2011 at 10:46 AM, Tom Evans wrote:
> OK, take this example. I have a django model table with 70 million
> rows in it. Doing any kind of query on this table is slow, and
> typically the query is date restrained - which mysql will use as the
> optimum key, meaning any further filteri
Hi Furbeenator,
thanks a lots, it works !!! :-)))
I've use your first solution. You say that "category would have to be
the first Allow Null field in your model" wich is not the case here. A
"phone" field is the first step (Step0) can be empty :
telephone = models.CharField(max_length=14, blank=Tr
Oupsss, another question in the step by step:
1 class InscriptionWizard(SessionWizardView):
2 def done(self, form_list, **kwargs):
3 instance = Customer()
4 for form in form_list:
5 for field, value in form.cleaned_data.iteritems():
6 if field == 'categor
Hi Alain,
Glad that it worked out! :-)
To clarify, a blank is different from a Null, or "None" in Python/Django. A
blank character field is "" where a null character field is NULL. If a
field does not specify null=True, and you try to save an instance of that
object without specifying that field,
Thanks Tom, but I have already tried that and it didn't work.
On Wed, Nov 2, 2011 at 12:25 PM, Tom Evans wrote:
> n Wed, Nov 2, 2011 at 5:13 PM, Kevin Miller wrote:
>> I have a url that I need to attach to link that is in a jquery
>> section. It seem like the django template system is not gett
Hi again
thanks for explanations.
I've understood difference between Null and None.
I've modify the code to add "instance.id == Non" and it seems to be
faster.
To be sure. You mean that if a customer has 1 category, there will be
2 database access (one for all informations except category and on
Hi Alain,
Sort of. With this code:
if field == 'category':
instance.save()
a Customer with 50 categories would write to the database 51 times (1
INSERT, and 50 UPDATES).
Including the "instance.id == None" like this:
if field == 'category' and instance.id == None:
instance
Hey,
I have a couple of FormViews that override quite a few methods. I want
to write an "Abstract View" that I can subclass for these. I'm
guessing what I actually need is a custom Mixin but I'm really not
sure.
Any suggestions on how to go about doing this?
Some methods I'm overriding:
get_for
Hi,
In brief here is my problem. I have two simple tables, one has a one
to many relation with the other. The problem I run into is that when I
try to create a form instance of the child, and try to print it or
render it in a template, I run into a "relation not found" error for
the parent. Simply
Can you try this and tell us what you see:
Run a shell using python manage.py shell
>>> instance = Staff.objects.using('gold').get(username='tsamuel')
>>> str(instance.query)
This will tell us whether or not the database, reference, and such are
correctly translating into a query. The error means
Russ mentioned it in passing, but I'll point it out for clarity: Celery is
a great framework for handling background tasks.
--
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/ms
Thanks Furbee,
UNDERSTOOD.
Thanks again for detailled and instructive answers.
Alain
On 2 nov, 21:36, Furbee wrote:
> Hi Alain,
>
> Sort of. With this code:
> if field == 'category':
> instance.save()
> a Customer with 50 categories would write to the database 51 times (1
> INSERT,
mysql generates an informational warning when running "drop table if
exists " if the table doesn't exist. Django then throws an
error and aborts.
Is there a good way to avoid this?
b.c.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post t
Does anybody use Django/Python with Codebase? Can it be done? If so,
how hard is it?
--
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 t
Thank you so much for your reply! So I got a "Staff object has no
attribute 'query'" error when I did it with the get. I got the sql
when I tried it with the filter instead (instance =
Staff.objects.using('gold').filter(username='tsamuel') >>
str(instance.query))this is what I'm getting:
'SELECT "
I would also check the disk space
On Tue, Nov 1, 2011 at 7:23 AM, Jani Tiainen wrote:
> On 1.11.2011 8:23, Nicole Button wrote:
>>
>> I'm getting a DatabaseError, looking like this:
>>
>> Django Version: 1.3
>> Exception Type: DatabaseError
>> Exception Value: disk I/O erro
Hi,
I created a ticket:
https://code.djangoproject.com/ticket/17156
{{{
The documentation should explain what happens in this code:
if obj in queryset:
If queryset is huge, the above code can be very slow.
If you want to run the code in the database, you should use this:
if queryset
62 matches
Mail list logo