I have created users for my unit tests in two ways:
1) Create a fixture for "auth.user" that looks roughly like this:
{
"pk": 1,
"model": "auth.user",
"fields": {
"username": "homer",
"is_active": 1,
"password":
"sha1$72cd3$4935449e2
This sounds like a ChoiceField instead of a MultipleChoiceField.
A CheckboxSelectMultiple has to be used with a MultipleChoiceField.
Refer to:
http://ontehfritz.wordpress.com/2009/02/15/django-forms-choicefield-and-multiplechoicefield/
Hope this helps.
On Apr 2, 12:09 pm, ben wrote:
> Hi, I a
Oh right ok, yes i understand now, thanks so much for your help Tim, it's
greatly appreciated.
On Sat, Apr 10, 2010 at 2:22 AM, Tim Shaffer wrote:
> To be able to use the form variable in the template, you have to pass
> it to the template in render_to_response in the context like so:
>
> return
I think a really nice solution to this is to use a middleware. I've
used something like this - it catches all exceptions, and writes each
one's full django traceback to a database record. You can change the
handling to use the logging module or whatever. I think this is great
for a production en
To be able to use the form variable in the template, you have to pass
it to the template in render_to_response in the context like so:
return render_to_response('add_user.html', {'form':form})
Check out the documentation for more examples:
http://docs.djangoproject.com/en/dev/topics/http/shortcu
On Fri, Apr 9, 2010 at 6:05 PM, laser_cg wrote:
> Hello Tom, thank you for answering so quickly.
>
> 1. OK, so if a user closes the browser, the session is not deleted
> because there is no way to notice that. However, when I use the admin
> that Django provides and I logout, I can check that the
Hi i am getting an error with my add user form,first of all it won't
display any of my textfields and it keeps giving me an error saying
"The view add_user didn't return an HttpResponse object"
Here is my forms.py file
class UserForm(forms.Form):
username = forms.CharField()
password =
fo
There is nothing exceptional about exceptions in Python. McDonc does a
good job at explaining how to think about exceptions as less than
exceptional:
http://plope.com/Members/chrism/exceptions_arent_errors/view
The only arguably exceptional part is that ideally the ORM would raise
a plain KeyErro
This is what I came up with (or pieced together, I don't remember
now):
from django.core.servers.basehttp import FileWrapper
class FLVWrapper(FileWrapper):
"""Wrapper to return a file-like object iterably"""
def __init__(self, filelike):
self.first_time = True
#Calls the
On Fri, Apr 9, 2010 at 4:54 PM, Joakim Hove wrote:
> I have never really got very friendly with exceptions, I tend to
> consider them as something exceptional which "should not" happen,
> whereas the fact that the database does not contain a particular key
> is in my opinion something quite ordina
If you don't want to use exception (which I do when doing something
similar). You can use filter and then check the length of the array
returned.
def my_view( request , pk ):
obj = Class.objects.filter( pk = pk)
if len(obj) != 1:
return bad_key_view
obj = obj[0]
# Do someth
Hello Tom, thank you for answering so quickly.
1. OK, so if a user closes the browser, the session is not deleted
because there is no way to notice that. However, when I use the admin
that Django provides and I logout, I can check that the session record
in the django_session table from the db is
Hello Tom, thank you for answering so quickly.
OK, so if a user closes the browser the session is not deleted because
there is no way to notice that. However, when I use the admin that
Django provides and I logout, I can check that the session record in
the django_session is not deleted, even doin
Hello,
I have something I would presume was a very common pattern. I have a
view which gets a primary-key (from the user) as second argument:
def my_view( request , pk ):
obj = Class.objects.get( pk = pk)
# Do something with obj and return a suitable response.
Now, of course I would
Hello,
In a unit test for django, how would I test if a context variable is
set? I tried self.assertTrue('products' in response.context) but it
fails even though in my views I set 'products' to be
Product.objects.all() and if I pprint response.context I can see that
it is set.
Thanks in advance!
On Fri, Apr 9, 2010 at 2:48 PM, Ramiro Morales wrote:
> On Fri, Apr 9, 2010 at 3:20 PM, Tom X. Tobin wrote:
>>
>> This reminds me that we need to open-source our time zone code. We
>> track entertainment events across several time zones, and Django's
>> standard time handling can't cleanly deal
On Fri, Apr 9, 2010 at 3:20 PM, Tom X. Tobin wrote:
>
> This reminds me that we need to open-source our time zone code. We
> track entertainment events across several time zones, and Django's
> standard time handling can't cleanly deal with that. Database
> backends that store time zones as a UT
> This reminds me that we need to open-source our time zone code. We
> track entertainment events across several time zones, and Django's
> standard time handling can't cleanly deal with that. Database
> backends that store time zones as a UTC offset (e.g., PostgreSQL)
> actually cause *more* tro
Have you looked at your db? are the tables there that you wrote in your models.
Did you run
python manage.py syncdb and did you see verification that your tables were
created?
If you want to see that the sql is being created run
python manage.py sqlall app_name to make sure its generating the
On 04/09/2010 12:29 PM, Pankaj Singh wrote:
Getting error during installation please help
Installed
/usr/local/lib/python2.6/dist-packages/django_page_cms-1.1.2-py2.6.egg
Processing dependencies for django-page-cms==1.1.2
Searching for django-mptt>0.2.1
Reading http://pypi.python.org/simple/dja
This may be bad advice. But, since I'm a newbie myself running in a
non-production environment, what I do is restart Apache after making changes
to my model.py or settings.py. It might be worth restarting your web
server, if you can.
I figure there's a better approach. I just haven't gotten far
On Fri, Apr 9, 2010 at 1:05 PM, Paweł Roman wrote:
> I've noticed that django always fetches 'naive' datetimes from the
> database. Tzinfo property on a datetime object is always set to null,
> even if the database stores a value WITH a timezone.
>
> This is a bit tedious because such datetime can
I've noticed that django always fetches 'naive' datetimes from the
database. Tzinfo property on a datetime object is always set to null,
even if the database stores a value WITH a timezone.
This is a bit tedious because such datetime cannot be later converted
to any timezone. Each time I want to d
Hi,
On Wed, Apr 7, 2010 at 9:35 PM, Jim N wrote:
> I want to get Questions that a given User has not asked yet. That
> is, Questions where there is no Asking record for a given User. I
> have the User's id.
Well, you can use the exclude() method. In a ManyToMany, the "user"
field is like a Us
On Fri, Apr 9, 2010 at 1:23 PM, Sheena wrote:
> I uncommented 'django.contrib.sessions' to no avail, and everything
> else is correct.
>
Did you run manage.py syncdb after uncommenting sessions?
> I'm not getting any error messages at all, I'm just not given the
> option to do anything with m
> Exception Type: ImproperlyConfigured at /feeds/latest/
> Exception Value: Give your Entry class a get_absolute_url() method, or
> define an item_link() method in your Feed class.
Have you tried the obvious - do what the Exception tells you and add a
"get_absolute_url" method to the model of the
I uncommented 'django.contrib.sessions' to no avail, and everything
else is correct.
I'm not getting any error messages at all, I'm just not given the
option to do anything with my tables from the admin site. I've gone
through three different tutorials on it and they all say the same
thing so it d
Been working on this one for three days now. I'm stumped.
I've created my rss feed from the example listed in The Definitive
Guide to Django: Web Development Done Right.
Unfortunately, I'm getting an ImproperlyConfigured error. I've been
looknig on the Djangoproject.com site and searching Google f
I think it largely boils down (as many have said) to a python vs ruby debate.
I personally hate Ruby... I think its perl with a nice syntax, its very obtuse
and just downright hard to maintain as projects get bigger (IMHO, others I;m
sure disagree).
As far was what is better about Django for me
Yeah, I don't think that they're quite set up to just easy_install.
It took a bit of reading,
but there was enough information on their home page to know what else you had to
install, If I recall correctly (it's been a while). You may want to
also include
django-tinymce so that your client can ha
Its also a good idea to install the Developer Tools ... You should check which
version of Python you are using too. I think be default OS X uses 2.6.1
This is what I get when I type "python" into the terminal:
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
On Apr 9, 2010, at 11:38 AM, Lee Hi
Are you running the install as superuser?
I am running leopard too and ran into the same problem but once you run it as:
sudo python setup.py install it should work..
Also, dumb question but do you have mysql installed? Its also a good idea to
put this:
# mysql path
PATH=${PATH}:/usr/local/mys
On Fri, Apr 9, 2010 at 11:13 AM, UnclaimedBaggage wrote:
> Ooops - forgot one other thing:
>
> I'm a little concerned by django error handling. The tracer stack
> seems to miss the relevant file a lot of the time, and I often find
> little help from the error pages even when it does get the right
Getting error during installation please help
Installed
/usr/local/lib/python2.6/dist-packages/django_page_cms-1.1.2-py2.6.egg
Processing dependencies for django-page-cms==1.1.2
Searching for django-mptt>0.2.1
Reading http://pypi.python.org/simple/django-mptt/
Reading http://code.google.com/p/dja
Ooops - forgot one other thing:
I'm a little concerned by django error handling. The tracer stack
seems to miss the relevant file a lot of the time, and I often find
little help from the error pages even when it does get the right page
(eg an error comes up with a useful file/line # in the debug p
Hi folks,
I'm a long-term (8 years) PHP developer who's recently started
dabbling with Rails & Django. I REALLY like what I've seen from both
frameworks and quite frankly, am a little miffed I didn't jump on the
bandwagon earlier.
I'm trying to decide between the two frameworks, but I'm
strugglin
The django-pages-cms app works pretty well.
On Fri, Apr 9, 2010 at 11:34 AM, Pankaj Singh
wrote:
> Hi, I am a student. I have designed CMS websites using PHP and MySQL . I
> want to complete my new project using Django ( excited about it).
> I wanted to know the basic steps that I should follow.
On Apr 8, 1:50 pm, CG wrote:
> I have successfully setup django, although I am not sure how I did
> it. Now I am trying to setup MySQLdb but keep getting the error
> File "setup.py", line 5, in
> from setuptools import setup, Extension
> ImportError: No module named setuptools
>
> On Ap
Hi, I am a student. I have designed CMS websites using PHP and MySQL . I
want to complete my new project using Django ( excited about it).
I wanted to know the basic steps that I should follow. I need to do design a
website for a new startup at IIT Kharagpur. I will use CMS because that
person ( fo
Will there be more than one matrix? Or are you using "Name" to indicate
matrix membership, as opposed to column names and row names? If
so, a foreign key on a matrix table will be more storage efficient, since
matrix names will only need to be stored once.
Also, doesn't a select to do a lookup o
Out of curiosity, are you using a version of Python that you installed
(i.e., not the out-of-the-box version that comes with Snow Leopard)?
You are missing the setuptools package in your installation of
Python. Visit http://pypi.python.org/pypi/setuptools and read the
download/installation instru
Hi Guys,
I am trying to populate fields for a template using views from the
admin section of the site. The admin section is already setup and I
got my models to show up there and I can add and delete properly so it
works fine.
What remains is to populate those fields in views to render them onto
Uncomment: #'django.contrib.sessions',
make sure to import admin from django.contrib and turn admin.autodiscover()
and yes, error messages would be helpful... if any.
On Apr 9, 2010, at 10:32 AM, Stuart wrote:
> What you have looks about right. What result are you getting? An error
> message?
What you have looks about right. What result are you getting? An error
message?
--Stuart
On Apr 9, 7:44 am, Sheena wrote:
> Hey hey. I'm a little new to Django so I've been following through the
> Django Book v2 and I'm having trouble adding my models to the admin
> site. I'm pretty sure I've f
Thank you Russ!
I'm glad I'm not crazy.
I must say that the django project and community have been a joy to get
acquainted with. Not only were you friendly and fast to respond but I see
you already fixed it!
Good day!
-Francis
---
Francis Gulotta
wiz...@roborooter.com
On Thu, Apr 8, 2010 at 1
What's easiest way to ensure that further data is displayed as a part of
the emails sent after a server error? Some of the data would be present
in all requests, some might only be available for particular requests.
regards
Steve
--
You received this message because you are subscribed to the Go
@Sheena,
sorry -- I didnt read all of your email -- I think if you've got it all in
admin.py make sure you're importing admin from django.contrib.
To activate the admin interface though you need to do:
1. Add 'django.contrib.admin' to the INSTALLED_APPS setting (which you did)
2. Make sure INST
If you are looking for "OR" then use the "Q object".
see
http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects
On Apr 7, 11:39 am, Daniel wrote:
> Hi,
>
> Thank you for your help everyone. I know that I need to learn python
> better, and I did read those articl
In your urls. py make sure you have:
from django.contrib import admin
admin.autodiscover()
and
that you've uncommented the (r'^admin/', include(admin.site.urls)),
in the tuple: urlpatterns = patterns.
On Apr 9, 2010, at 8:44 AM, Sheena wrote:
> Hey hey. I'm a little new to Django so I've bee
On Fri, Apr 9, 2010 at 1:41 PM, Ken Lacey wrote:
> Hi
>
> I am trying to check an IP so some information will/will not be
> displayed based on the first 8 digites of the remote IP address.
>
> I have a vairable ip_address which contains the remote address and a
> vairable accept_ip with a value "1
Hey hey. I'm a little new to Django so I've been following through the
Django Book v2 and I'm having trouble adding my models to the admin
site. I'm pretty sure I've followed instructions correctly, I've also
tried following some random advice I found to no avail. Any help would
be greatly apprecia
Hi
I am trying to check an IP so some information will/will not be
displayed based on the first 8 digites of the remote IP address.
I have a vairable ip_address which contains the remote address and a
vairable accept_ip with a value "192.168." but when I carry out the
following it is not working
On Thu, Apr 8, 2010 at 7:42 PM, onorua wrote:
> I'm using 1.1.1
> On the development server on my laptop - it doesn't happen, on
> production - happen every time.
> How can I debug why this happen?
I have no idea :-P Any other differences between the 2 environments?
Database server?
--
You rece
on the page http://docs.djangoproject.com/en/dev/topics/db/queries/
writed:
cheese_blog = Blog.objects.get(name="Cheddar Talk")
>>> entry.blog = cheese_blog
>>> entry.save()
But it's not work, when i try i get error '1048' column 'blog_id'
cannot be null
how can i right save manytomany fields?
-
now i have a finished template which wrote by j2ee,like this:
<#list dailyStarList as dailyS>
class="list_color_w"<#else>class="list_color"><#list
chatAvatarList as cal>
<#if dailyS.avatarid == cal.id>
$
thank you it's worked
--
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,
thank you it's worked
--
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,
On Fri, Apr 9, 2010 at 11:56 AM, mouadino wrote:
> hello Everybody .
>
> my probelem is that i want to make the traceback disappear when an
> exception is raised .
> I'm using the module logging with Django and i 'm redirecting the
> output to a file and this file must contain only feedback to t
hello Everybody .
my probelem is that i want to make the traceback disappear when an
exception is raised .
I'm using the module logging with Django and i 'm redirecting the
output to a file and this file must contain only feedback to the
developer , and with the traceback it's not readable at al
Hi Daniel,
Thank you very much for your reply. That cleared quite a lot of stuff
for me. I was wondering if you have any links on how to populate
models through the admin interface. I would like to have it editable
from admin (makes it much easier to handle). If you have any links or
ideas on how
Many thanks, folks - very helpful replies. I've googled a lot of the
information mentioned above and it seems Django is quite easily
capable of almost everything I've mentioned above. After another
night juggling Django & Rails I've decided my PHP days are certainly
over - I just need to decide be
On Apr 9, 9:42 am, Daxal wrote:
> Basically, I am starting to create a view called "cvdetails" and it is
> linked to "cvdetails.html" link for template.
>
> The form is supposed to use is:
>
> class cvForm(forms.Form):
> Language =
> forms.ModelMultipleChoiceField(queryset=C.Language.objects.all
On Thu, Apr 8, 2010 at 6:02 PM, Daniel wrote:
> Thank you, Tom. I understand now. I come from java and I was not
> aware that such a syntax is allowed. I got the Q objects part of my
> app working thanks to you guys.
>
Just to clarify:
python:
a = c if b else d
java:
a = b ? c : d;
On Fri, Apr 9, 2010 at 4:17 AM, laser_cg wrote:
> Hello everybody!
>
> I am working with sessions with the database backend in an e-commerce
> shop. I store the cart ID, the number of items in the cart and the
> total prize in the session. But actually have two problems.
>
> 1. I set the SESSION_E
Hi Guys,
I'm try to figure out how add some customized functionalities to an
inline formset. What I would implement are the two following features:
- ability to delete a record by pressing a submit button assigned to
each row (instead of checking the delete box and submitting the
overall form)
- a
hi all,
i have basically the same problem as this guy on stackoverflow:
http://stackoverflow.com/questions/151195/possible-to-use-sql-to-sort-by-date-but-put-null-dates-at-the-back-of-the-results
i have a ticket-application where tickets have a deadline (which is
optional an can therefore be null
Basically, I am starting to create a view called "cvdetails" and it is
linked to "cvdetails.html" link for template.
The form is supposed to use is:
class cvForm(forms.Form):
Language =
forms.ModelMultipleChoiceField(queryset=C.Language.objects.all())
ProfDesgn =
forms.ModelMultipleChoiceFiel
how to write the script hotmail contacts api + python but no
django ,how this can be achieved ,can anybody give me some idea for
this.
--
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...@
create table Rows
(
Id int primary key,
Name text(255) not null
)
create table Cols
(
Id int primary key,
Name text(255) not null
)
create table Data
(
RowId int not null foreign key references Rows(Id),
ColId int not null foreign key references Cols(Id),
Data
)
On 8 апр, 02:32,
69 matches
Mail list logo