On 07/09/2011 03:52 PM, het.oosten wrote:
I have two models. One containing images, and one containing the text
of a web page. While the text remains the same, the selection of
images vary, depending on the session ( I use different themes/moods
depending on the season). The selection of images w
On 07/09/2011 04:21 PM, morning yao wrote:
so ,here is the Error Traceback,i need your help,thanks!
___
Environment:
Did you read the traceback you posted?
Exception Type: AttributeError at /
Exception Value: 'Settings' object has no attribu
Make an iterable in your view (list or tuple) containing lists or tuples
of two items -- the text and the image link.
Then iterate through that in your template with a 'for' tag.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this
It would work just fine. Something like this:
{% for text, images in my_iterable %}
{{ text }}
{% for image in images %}
{% endfor %}
{% endfor %}
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send em
I don't know what your models and form look like so I can't say exactly.
However, you probably need to just modify one of your clean functions so
it retains multiple values, and update your save function to do the
right thing when it gets more than one.
--
You received this message because you
I'd rather see the contents of your __unicode__ function as a
get_absolute_url function, with the __unicode__ maybe returning just the
filename or the parent object's title and the filename.
I strongly dislike the embedding of template code in a text field of
your model, because it makes maint
May we see the rest of your view? If not, you'll have to figure it out
by examining exactly what your 'request' variable contains. The error is
clearly from calling update() on it, and it not being allowed.
--
You received this message because you are subscribed to the Google Groups "Django
us
On 07/10/2011 12:28 PM, het.oosten wrote:
Adding a method/property to my model is a thing i haven't considered.
You have a good point there. I will do some more reading to find a
solution in this direction. Thanks!
Rob
It's easy to forget that Django is just Python. You're the programmer,
so
You can easily do this in your template with an index. Assuming you'll
have the variable image_list in your context which is a list, you can do
this:
{{ image_list.0 }} and {{ image_list.1 }}
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To
http://bit.ly/pAJc4N (Dice.com link)
We're hiring! If you're local check it out, e-mail me with questions.
Thanks,
Shawn
--
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 uns
It looks like you put STATIC_ROOT in your templates where you should
have used STATIC_URL.
--
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 e
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
Everything you should need is in here. Once you have something started I
can probably help out if you have any specific questions.
Also, as long as you have a one-to-one field there's really no need to
On Tue, Jul 12, 2011 at 5:26 PM, Brent wrote:
> Thanks for the help guys.
>
> Micky, that tutorial looks very good. I think I almost have it
> working. Just one more error:
>
> http://dpaste.com/567361/
>
Looks like maybe you didn't run syncdb after adding something to INSTALLED_APPS.
--
You r
It sounds like that part of the tutorial you're following is regarding
configuring Apache. You don't need to worry about that yet.
If you start with the Django tutorial it'll show you how to get
started using the development server. The tutorial doesn't take too
long to do.
https://docs.djangoproj
On 07/13/2011 12:46 PM, Joshua Russo wrote:
That's fine, but I was under the impression that the templates could
be overridden just by creating the proper path in my template
directories. Is that not true?
It's true. Check the order of your TEMPLATE_DIRS in settings.py. If you
don't have t
To be clear, when you say registration/login, you mean
templates/registration/login, correct?
Your 'registration' directory should be in a 'templates' dir.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to dja
Following this as a sample (from the docs you linked to):
widget=forms.TextInput(attrs={'class':'special'}))
You'd do this:
widget=forms.TextInput(attrs={'div_css':'test'}))
Or, to not clobber other things set in the form, you could do it in the
__init__:
#working example I just
Try going to github and doing a search for 'django-piston.' That will
show you a list of open-source projects that have implemented django-piston.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-user
On 07/13/2011 02:00 PM, Andreas Pfrengle wrote:
Hello Shawn,
thanks for your answer, however that's not exactly what I wanted. Now
the html renders to:
No. of properties
However, I would want:
No. of properties
Additionally, I can't access {{ field.wid
A discussion broke out in our office today about using these features,
because there are blog posts[1] bashing them and a comment by JKM
saying they should go away[2].
It seems that all of the arguments against are based on the fact that
there were bugs in the past (links in the comments of the bl
On 07/15/2011 02:14 PM, Suprnaturall wrote:
def get_short_name():
return name[0,20]
Try this:
def get_short_name(self):
return self.name[0:20]
You need 'self' in two places, and I assume you want a string of the
first 20 characters rather than a list of the first and
If you look up those terms in the Django docs instead of Wikipedia I think
that will erase your confusion.
--
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 th
On Mon, Jul 18, 2011 at 10:33 AM, bruno desthuilliers
wrote:
> On Jul 18, 3:33 pm, Alexander Crössmann
> wrote:
>> Hi Malcom,
>>
>> I am not sure the management commands are what I want
>
> Strange enough, it seems that everyone starts by saying this and ends
> up writing custom management comman
What traceback do you get?
--
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
django-users+unsubscr...@googlegroups.com.
For more opt
I just create a different user account for each application I'm
running. So each user account has its own virtualenv, gunicorn, etc.
Obviously just one nginx instance.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send e
Please search the archive of this list. This exact thing has been addressed
in detail.
--
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
On 07/21/2011 10:15 PM, dpapathanasiou wrote:
How can I do that in the context of the built-in django auth API? Are
there examples or tutorials of that?
https://docs.djangoproject.com/en/1.3/topics/auth/#storing-additional-information-about-users
--
You received this message because you are su
On 07/22/2011 02:35 AM, PyPal wrote:
Hi Shawn,
I think you were referring to the APE ( http://www.ape-project.org/ )
framework as the 'gorilla' thingy...
Yes, thanks! I did some Google searching but couldn't find it. Someone
on the list said they were going to give it a shot, but I haven't
On 07/22/2011 10:30 AM, Eyad Al-Sibai wrote:
Hi!
I still do not get the meaning of Manager or Custom Manager in
Django... I am confused!
If you've used the '.objects' attribute of a model you've used a manager.
A custom manager would be a subclass of the standard manager. You can
then alt
On 07/22/2011 10:31 AM, Eyad Al-Sibai wrote:
Hi!
I want a real example of complete django application with source code
to understand django better
1. Search Google, github, and bitbucket.
2. Read this: https://code.djangoproject.com/wiki/UsingTheMailingList
--
You received this message b
On 07/24/2011 02:46 PM, Jarilyn Hernandez wrote:
Hi, Thanks for the response. My problem is that I have my tables
created on django. All I want is to import some data from a csv file
to these tables. I tried to search on the archives of the mailing list
but I can't find what I need. I heard th
Sure. You can pass the continents in your context. Then in the template
you loop through the continents.
Within that loop, you loop through continent.country_set.all. However,
it's good form to add a 'related_name' to your countries model to make
it easier to access from a continent.
Also, y
On 07/24/2011 07:47 PM, Dedeche wrote:
thanx for your reply
but how do I pass the continents in my context?
You need to do the tutorial.
do I have to hardcode them in the context string!! I want it to be
flexible and dynamic ..
and what is "country_set" .. there is no such field in "Contine
Have you looked into creating your own connector table for your
ManyToMany using the 'through' keyword?
https://docs.djangoproject.com/en/1.3/topics/db/models/#many-to-many-relationships
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post
Just use South. That's exactly what it was made for.
http://south.aeracode.org/
--
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
d
I want to allow certain users to download files uploaded by other users.
I found django-protected-files[1] and django-private-files[2], both of
which look like they do the job. The latter is more recent and is on
Read The Docs, so it's probably the way to go.
Before I start reviewing the code
You can override the ModelForm.
Add the fields to the ModelForm. Set the initial values by overriding
__init__, and save them by overriding the save() method.
Should be pretty simple.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to
I've never had a problem with Django on OS X. I have had problems with
psycopg2 due to the default Python that comes with OS X, but if you
recompile Python you're fine. I don't use MySQL or Apache.
In any case, it sounds like your complaints have nothing to do with OS
X. Having said that, various
On Thu, Jul 28, 2011 at 10:08 AM, Kolbe wrote:
> lol.
>
> what's your recommended build for OSX though if I were to use django?
>
I don't know what you mean by 'build,' but my standard setup was
compiling my own Python (requires installing XCode) and using
PostgreSQL (using the EnterpriseDB inst
It's your PYTHONPATH environment variable.
--
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
django-users+unsubscr...@googlegroups.c
Could it have something to do with staticfiles?
Have you started using any new middleware or contrib apps?
--
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
I'm using Django 1.3, and the templates exist in site-packages.
Within my virtualenv:
lib/python2.7/site-packages/django/contrib/admin/templates/admin/login.html
How did you install/upgrade 1.3? Are you using virtualenv? Do you have
multiple versions of Python on your system?
Try just c
I never heard of Nashvegas until your e-mail, and I've been using South
for years and it's been wonderful. I also met Andrew Godwin at DjangoCon
last year, and he's a genuinely nice and friendly guy.
So, assume that I'm biased. Having said that, here are my responses:
South is definitely not c
I'm dealing with the same issue, and it looks like I'm probably going to
adopt django-private-files for this.
http://pypi.python.org/pypi/django-private-files/0.1.2
It's on Read The Docs, bitbucket, and github. It does what I need it to
do, it works with nginx, and it's been maintained recentl
Just add the fields to your ModelForm and then do whatever you want in
your save() override.
The example you found has extra code the author added to the model, but
there's nothing "standard" there. It's just something that suited that
use-case.
Remember that all of Django is "just" Python,
You don't need to add the fields to your model. If the extra fields
don't appear on your page it's probably because you didn't add them to
the template.
I'm assuming you're using something like form.as_p, which probably
doesn't pick up the extra fields.
--
You received this message because y
Go for it. It will require you to learn to program, but if you're up for
it then that's awesome.
If you do the tutorial and read the following wiki page I'm sure you'll
find plenty of helpful people on this list.
https://code.djangoproject.com/wiki/UsingTheMailingList
Shawn
--
You received
On 08/02/2011 01:59 PM, highpointe wrote:
Not to hijack the thread but as an additional question...
Is anyone having success with CentOS?
Thanks for letting me interject. :-)
Our production server is on Cent OS and has been up for 742 days without
a reboot. For whatever that's worth.
--
Y
I have no template for the form. I'm using the automatic admin.
Then that's a whole different issue.
https://docs.djangoproject.com/en/1.3/ref/contrib/admin/
Check this out, and read up on how to specify your own form.
--
You received this message because you are subscribed to the Google
I'm hoping someone can help me improve this process.
Short:
I want to run Selenium tests during Django's unit tests.
When 'manage.py test' is running, there's no dev server available
for Selenium.
If I run my Django app separately, changes to the database are
cumulative instead
Tom,
Thanks for the reply. I read the history of that ticket and it is
exactly what I'm looking for. Too bad it's five years in the making and
still not in trunk.
So, what did you do, use one of the patches in the ticket? If so, which
one? If you have a snippet or something then please post
On 08/03/2011 10:46 PM, Joshua Russo wrote:
Really? Nothing? Do you need more information? From the lack of
response I feel like I'm completely off the mark and nobody wants to
tell me. --
1: https://code.djangoproject.com/wiki/UsingTheMailingList
If you're not getting help then it's almost c
In your view you should be instantiating the form with the data from
request.POST instead of reading the values directly.
Also, you mention that you get a 403 error when you post your name and
password, but the form and template you pasted don't include password,
so I suspect the error is comi
I don't know about built-in, but you could do it in Python by iterating
through your list and creating a dictionary with a key of the id and
value of the rest of the dictionary.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this g
What did you change? Hopefully you're using version control and can do a
diff.
The traceback you provided isn't very helpful to most people because
it's from Django's internals instead of your own code.
In any case, you need to do more work before you'll get much help,
unless someone's speci
The model class is defined *inside* Models.py.
--
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
django-users+unsubscr...@googlegrou
Sorry, typo. I meant Models is defined inside models.py.
--
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
django-users+unsubscr...@
2011/8/6 Rafael Durán Castañeda :
> I'm not a django expert but I think you are wrong. Checking my django
> installation:
>
Yep, you're right.
https://code.djangoproject.com/browser/django/trunk/django/db/models/base.py
--
You received this message because you are subscribed to the Google Gro
Are you running collectstatic after making those changes?
--
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
django-users+unsubscr...
This is because you're passing it as 'book' in the context.
{% if book %} will evaluate to True.
--
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
Are you saying that you want to show some form inputs conditionally
based upon configuration, for example for each user?
If that's your goal then it's very easy to do by adding the logic in the
form's __init__. Add/remove fields there and (possibly) override save()
if you have to take any addi
The validation is easy. Override the form's clean() method to do any
validation which needs to check the value of more than one field. For
example, if you want a text box to be required sometimes, define it as
not required in the form, then check the boolean in clean() and raise a
forms.Validat
It would just be:
recs = Academics.objects.all()
Because that table has all those fields.
Also, some style notes:
It's non-standard to put underscores in class names.
It's non-standard to put capital letters in field names.
It's non-standard (and grammatically incorrect) to name
On 08/08/2011 10:55 PM, Hayyan Rafiq wrote:
Tried that
>>> recs=Academics.objects.all()
>>> recs[0]
>>> obj=recs[0]
>>> obj.Cell_No
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Academics' object has no attribute 'Cell_No'
Am i missing something??
Yes, 'Cell_No'
Make your life a little easier and add a related_name argument to your
Roll_No foreign key.
Example:
Roll_No = models.ForeignKey('Student_Info',to_field='Roll_No',
related_name = 'students')
Then:
obj.students.all()[0].E_mail
Without a related name:
obj.student_set.all()[0].E_mail
No
This is where using the related_name kwarg comes in.
You can also use the default value, which in this case is academics_set.
I see you made most of the recommended changes to your model
definitions. I'd just like to reiterate two:
Remove the underscore in your model name.
Remove the 's
Please read: https://code.djangoproject.com/wiki/UsingTheMailingList
Especially this section: Prepare the question
--
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 unsubscrib
You have to write it as {{ obj.title }} in your template. Django
templates are designed to allow very little in the way of logic; that
should take place in your views.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send e
I do essentially that, using a post_save signal and dumping the
serialized model instance to MongoDB with datestamp, etc.
The relevant part is this (after importing Django's serializers):
serialized_object = serializers.serialize(
"json",
sender.objects.filter(pk = instan
In [1]: x = '1234'
In [2]: x.isdigit()
Out[2]: True
--
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
django-users+unsubscr...@goog
What's the output when you try this at the command line?
tar -xzf django1.3.tar.gz
--
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
Mike,
I'm doing something similar in another project. I created a sublass of
models.Model and am using that throughout the project, which makes it
much easier.
On the post-save of any subclass of my custom model, I serialize the
model's fields as a JSON object and store it in a text field of my
a
You should try asking about this on the south-users Google group if you
don't get an answer here.
--
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
If you're already familiar with relational databases then you probably
already know this stuff, just with different terminology.
This should clear things up:
https://docs.djangoproject.com/en/1.3/ref/models/fields/#module-django.db.models.fields.related
Also, do the tutorial, then fiddle with t
It's just Python. Use the sqlite3 module or psycopg2 (or whatever's
appropriate) and use your databases as you like.
There's nothing stopping you from using any tables in whatever database
Django's models are using, or any other databases of any kind from
within your Python code.
There's no
I have some code that modifies related items when a model is saved. I've
tried this by both using a post_save signal and by putting the code
directly in a save() override.
When I save an instance in the Django admin, it never works.
When I save an instance in ./manage.py shell it always works.
On 08/18/2011 09:24 AM, Andre Terra wrote:
Your instance is probably not yet saved to the database, so the
m2m-related objects don't know which instance to connect to. There's
problem something wrong in your save() method. I often use "assert
False, some_var" to check if at some point the variabl
It looks like your earlier post made it in:
http://groups.google.com/group/django-users/browse_thread/thread/3157104d4334a643
Also, (obviously), this post of yours showed up. I'd say you're
properly a member.
Shawn
--
You received this message because you are subscribed to the Google Groups
"
As someone who has hired a couple of people just like you in the past
year, here's my response. Others may have different standards.
Having links to sites you've developed is good.
Having links to a github account with public projects is great.
A resume with bad spelling, grammar, or obviously
You can do this by creating a custom clean function for your field:
http://docs.djangoproject.com/en/1.2/ref/forms/validation/
Shawn
--
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
On Jan 3, 2011, at 4:28 PM, Brian Bouterse wrote:
> Have you tried using pdb to debug the call as it arrives? You could step
> through the code, line by line that way to see what is hanging.
>
> My 2 cents,
> Brian
I enthusiastically second this. If you're unfamiliar with pdb, check out this
You could do this with South in multiple steps.
1. South schema migration:
Add the new field for the proper foreign key, but don't make the field
required.
2. South data migration:
Create a migration that appropriately populates the new field based on
whatever rules you have.
3. S
Now that you're luxuriating in the "done for you" aspect of Django, check out
the ModelForm object. It gives you the goodness you seek.
I don't think that setting up your URL system the way you describe is a good
idea. It's a complete security failure, so you'd have to handle permissions
anyway
On Jan 4, 2011, at 4:15 AM, xpanta wrote:
> is there any hope for me?
Does your settings.py file do any imports? If there is a problem with an import
you'll have a major disaster and the cause may not be obvious from the error
message.
Shawn
--
You received this message because you are sub
What happens when you try 'manage.py shell'?
Shawn
--
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...@googl
What actual project name are you using? Have you tried using different project
names?
If you're literally using "projectname" then you may be using a command-line
argument and causing a conflict.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django user
Hi Ondřej.
For your question #1, you could create a field in the model itself and then use
signals[1] to populate it upon the saving of a "vote" instance.
#2: The validation should all be done during form validation[2], prior to save.
Using a Form or ModelForm. That way, the user can get frien
On Jan 5, 2011, at 4:44 AM, Sithembewena Lloyd Dube wrote:
> Thomas and Shawn, thanks for responding.
>
> South looks pretty useful - I hope that it could be included in the standard
> Django distribution.
>
This has been discussed quite a bit, and a plan has been made to do this -- in
a way
http://docs.djangoproject.com/en/1.2/topics/forms/
This contains form definitions, sample views, and sample HTML.
Shawn
--
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 unsu
http://docs.djangoproject.com/en/dev/ref/forms/widgets/
Search for "year" on this page and it has what you need.
Shawn
--
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 unsub
You're not seeing anything for several reasons. There are just a lot of
fundamental things about the way Django works that it seems you haven't gotten
to yet in your learning. For now, I recommend you follow the tutorial -- do
everything step by step so you can see how it works. That alone will
1. When you were running the development server, you were probably executing
from the www directory, so importing from 'mysite' would work. When running in
production, it has to be properly on the PYTHONPATH.
2. You need the CSS and stuff for admin available on a server somewhere, and
have your
A "choices" value should be a tuple or list containing two-value tuple or list
containing the key and value for each dropdown option.
Other issues with the code you originally posted:
1. What looked like a context (that dictionary containing "polls"), was being
passed to the creation of a form,
It appears that 'makemessages' is meant to be run with django-admin.py,
not manage.py.
http://docs.djangoproject.com/en/dev/topics/i18n/localization/
Shawn
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to d
On 01/07/2011 11:33 AM, hank23 wrote:
I want to code a form which will have a choice field which I want to
have rendered as a dropdown box in my html file. How do I code the
choices parameter in the form definition to bind it to a column in one
of my data tables in my model? The documentation sho
This is probably a better question for the Django-CMS Google Group than this
one:
http://groups.google.com/group/django-cms?hl=en
It's always possible to subclass their modelforms and templates. I've used
Django CMS, but I don't have a grasp of how much work it would be to disable
the admin.
1. AJAX (try jQuery).
2. Change the field's widget.
--
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...@goo
On Jan 10, 2011, at 12:54 PM, hank23 wrote:
> Is there something like a label widget available? If so where is it
> defined? I didn't notice it listed in the forms wigdets document at:
>
> http://docs.djangoproject.com/en/1.2/ref/forms/widgets/
>
I just found this. Hopefully someone will let u
Welcome to the community, and congratulations on putting your best foot forward!
I am certain that your non-confrontational tone and obvious appreciation for
all the hard work done for free by volunteers has endeared you to all of us.
One minor suggestion: In the community, we like to see people
Is there a chance you have a mixture of literal tab characters and spaces? That
would do 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-us...@googlegroups.com.
To unsubscribe from this group, sen
901 - 1000 of 1241 matches
Mail list logo