This won't help you unless there's something you forgot about, but it could
help you in the future. In addition to git, I also use JungleDisk. It backs up
my entire projects folder every hour. Perhaps you have Carbonite, JungleDisk,
Mozy, or one of those services and you might be able to recover
What happens when you type 'python django-admin.py'?
If that doesn't work, try replacing 'python' there with the full path to your
Python executable in Windows. I've never heard of this problem, but it sounds
like it could be something odd in the environment.
Shawn
--
You received this messag
The difference between the PDF and JPG is that the JPG has to be an 'img' tag
and the PDF has to be an 'href' tag.
So instead of:
Try:
Download Important Stuff
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Add this line to that code:
print dir(tms)
I think you'll find a method of the recordset that will give you the count. I
don't remember off of the top of my head. Why are you doing a direct SQL query
instead of using a queryset from your model?
Shawn
--
You received this message because you
I'd use a dictionary or list. If it has to persist, use simplejson to
serialize it and create a couple of functions to wrap the JSON stuff.
Then you can use property() to simplify it further.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" gr
Fixtures sound like the way to go.
You should get what you need from here:
http://docs.djangoproject.com/en/dev/howto/initial-data/
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...@googleg
Well, the data loaded by fixtures will remain, so if you need to add new data
you'll just have to create and load a fixture with the new data.
It's easy to convert data to JSON or whatever, especially if your input isn't
going to change.
However, it seems like maybe you want something else alto
Use virtualenv. All the cool kids are doing it.
You will love it -- it does what you want and more, and I use it on my
Mac with no worries.
Shawn
Sent from my iPhone
On Dec 22, 2009, at 6:42 PM, Alex Fink wrote:
> Hi all,
>
> I'm developing for several different Django projects, one of whic
Can you post your view? It's illegal for us to hack into your computer and look
at your code to figure out the problem.
I'm assuming that you have an if statement that checks for a POST. In that
block, is there anything *not* done that's done during the GET?
Shawn
--
You received this message
What's wrong with the official tutorial? Or have you already done it and are
looking for something new? If the latter, why not do a project you invent, and
post here for help when you get stuck.
Yes, you can maintain sessions and all that. I don't think there's anything you
can do with PHP that
On Dec 23, 2009, at 7:43 PM, Dattatreya M wrote:
> 1. @Shawn, Thanks for the reply. I appreciate you taking time to answer.
>
> 2. I am going through the Django tutI was wondering if there is something
> else that would save me hours of 're-inventing' the wheel (with regards to
> designing
I can do even better than that. Here's a great tutorial:
http://docs.djangoproject.com/en/dev/intro/tutorial01/
Once you work through that (or get stuck) and have specific questions, people
will be glad to help you out.
Shawn
--
You received this message because you are subscribed to the Goo
On Apr 15, 2010, at 9:30 AM, Jagdeep Singh Malhi wrote:
> how to install django in ubuntu ?
>
> Please Replywith full instruction
>
Full instruction, as requested:
Go to google.com and search for "install django in ubuntu."
Read and learn.
The End
--
You received
There are probably a thousand blogging apps done in Django, because it seems
that a lot of people make one when they discover Django.
However, I think you should give them the Wordpress they asked for, because
it's maintained for security by a large organization for free. Unless you plan
to co
Try Google.
--
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, visit th
This is a simple Python dictionary exception; it has nothing to do with Django.
> Stuff.objects.create(title=self.cleaned_data['title'],
>
> Exception Type: KeyError at /add_stuff/
> Exception Value: title
You're asking for the value of the dictionary in key 'title,' but there's no
such thing.
You can create your own middleware.
http://docs.djangoproject.com/en/1.1/topics/http/middleware/
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
I'm sure there's a better answer than this, but if you need it immediately this
get you what you're asking for.
Create a custom manager for your class and just define filter() as below:
class MyCustomManager(models.Manager):
def filter(self, *args, **kwargs):
queryset = super(
http://code.djangoproject.com/browser/django/trunk/django/db/models/fields/__init__.py
If it's in models (django.db.models) then it's not in django.contrib, just FYI.
As for overriding it, you can subclass it, for a start.
Shawn
On Apr 20, 2010, at 11:00 AM, CrabbyPete wrote:
> Where in th
On Apr 21, 2010, at 4:35 AM, Massimiliano della Rovere wrote:
> I found nowhere information about compliancy of South 0.7.1 to the
> multiDB support of django 1.2
>
> Did I overlook anything?
>
If by "overlook" you mean "not read the release notes," then yes.
http://south.aeracode.org/docs/re
You may want to use an abstract base class. If you're inheriting something from
another application then they're probably not defined in that way, although it
might be possible to subclass them as abstract in your own models.py and then
subclass those. But the ORM nicely hides all of this from y
This can easily be done with signals.
http://docs.djangoproject.com/en/1.1/topics/signals/
And, it (rightly) won't be done in the view, because that leaves open the very
likely chance of a problem if someone writes a new view and forgets to call
your extra code.
The only sticky problem at the
One way:
Override __init__ and setting self.old_title to be self.title.
Then, in your save(), you can see if self.title != self.old_title.
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...
You should probably call that super __init__ first thing. Otherwise the object
won't really know how to behave like a Django model.
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...@googleg
Is there any reason you specifically want references external to the official
Django documentation? I think you will find that the official documentation is
by far the best. Also, there are a bunch of re-usable apps shipped with Django
that have working examples of the functionality you'll need.
Everything you need is here:
http://docs.djangoproject.com/en/1.1/topics/auth/#authentication-in-web-requests
This will tell you exactly, in detail, how to create your own login page to tie
into the built-in authentication.
Also, (sorry, couldn't resist), it's spelled "authentication."
Shawn
What you're describing is more of a row-level permissions system. The
permissions system that ships with contrib.auth is table-level, not row-level.
There has been some talk on this list about ways to go about it, but I don't
think there's an out-of-the-box solution for it yet.
Off of the top
This is pretty standard behavior in Django.
Have something like this in your models.py:
LOG_CODES = (
('Input', 1),
('Output', 2),
)
Then, the model field should have this in its definition:
choices = LOG_CODES
If you name that field name, say, _transaction_type, then yo
> my queryset is bringing back all of the photos and the for loop writes
> them all out. currently the photos come back in order of addition,
> since all i've got to sort them on is added_date. (i tried ordering
> the photos by the FK which is car.name but that didn't work).
Why doesn't this wo
Assuming that none of the old data violates your unique_together rule it will
work.
However, your database will not be configured correctly, and that could lead to
problems.
After your initial syncdb which created that table, Django will not make any
changes to the
database.
The best thing to
On Apr 26, 2010, at 12:23 PM, alivad wrote:
> how to make a Timeline in Django, something like:
> http://newstimeline.googlelabs.com/
>
> Thanks you.
>
> --
How to search Google?
Thanks you.
--
You received this message because you are subscribed to the Google Groups
"Django users" gro
It sounds like a case for formsets.
http://docs.djangoproject.com/en/1.1/topics/forms/formsets/
Assuming you have models for these shopping cart items, you can use a formset
of those items.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" grou
The newly-released South 0.70 does.
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...@googlegroups.c
Given a date/time value and a value that is valid for the TIME_ZONE setting in
settings.py, how do I convert that date/time to the time zone defined in
settings.py?
Example:
settings.py contains:
TIME_ZONE = 'America/New_York'
Input contains:
date
On Apr 27, 2010, at 3:10 PM, Anand Agarwal wrote:
> How does it work if i want to run the schema changes for various database
> instances?
> In my scenario each account has different database instance & there are
> hundreds of them. I want to update schema changes in all the databases in one
>
I don't understand what the problem is. What error message are you getting?
Are you confusing PATH and PYTHONPATH?
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 uns
>
> And what is difference between PATH and PYTHONPATH?
Appending to your environment's PATH means you'll be able to execute files
without specifying the full path. For example, instead of having to do
./filename.py you can just use filename.py to call a Python script. This is
just a *nix thin
On Apr 27, 2010, at 3:36 PM, Peter Herndon wrote:
> Hi Shawn,
>
> http://pytz.sourceforge.net/ looks like it would be useful for converting
> time zone strings.
>
> The one thing I keep hearing, though, whenever anyone brings up time zones
> here on django-users is: "*ALWAYS* store dates in
http://docs.djangoproject.com/en/1.1/topics/forms/formsets/
That ought to help out.
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, sen
You can't subclass an instance, just a class/object.
Maybe you want a foreign key to place in restaurant.
What are you trying to do?
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...@goog
I don't know why your e-mail isn't being sent, but I know that if multiple User
instances have the same e-mail address, then that e-mail address will receive
one message per User. Each one will specify the username, so it's easy to reset
the correct password.
Shawn
--
You received this messa
You have five different users in your database with the same e-mail address.
If you look at the e-mail messages, you'll notice that each one specifies a
different value for username. Just make sure you click the right one for the
password you want to reset.
Shawn
--
You received this message
See the notes about "commit = False" and its effects on many-to-many tables.
http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/#the-save-method
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
Exactly what directory is your copied template in? It's most likely not in the
right place.
Ensure that you have a template dir that your settings knows about, and that
template dir has a subdirectory called 'admin' where that file is placed.
Shawn
--
You received this message because you are
This was recently discussed on this list:
http://groups.google.com/group/django-users/browse_thread/thread/7cefcb64dd423ef2/
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.c
On May 13, 2010, at 4:43 AM, francisgan9 wrote:
> Hi,
> I need help how to get pass the installation of the database part. -
> tutorial 1
> trying to use sqlite
>
>self.connection = Database.connect(**kwargs)
> pysqlite2.dbapi2.OperationalError: unable to open database file
Evidently it
"Also, a model form instance bound to a model object will contain a
self.instance attribute that gives model form methods access to that specific
model instance."
From:
http://docs.djangoproject.com/en/1.1/topics/forms/modelforms/
So you can refer to self.instance in your validation code, assu
There's SQLAlchemy, but it's not nearly as simple as the Django ORM. However,
nobody's stopping you from using the Django ORM (or the templates) in other
projects that don't use the rest of Django. You will have to make a minimum
settings.py or make certain values available in the scope of your
To some extent it doesn't matter. Just make sure your code is as secure as any
private information you wouldn't want others to have access to.
When Django is running in a production environment, there is a Python instance
listening on a port on your system. Your Web server (Apache, nginx, whatev
You could create your own manager and have it do whatever you want -- even run
the SQL query you already want to write and still return a queryset.
http://docs.djangoproject.com/en/1.1/topics/db/managers/#id2
Shawn
--
You received this message because you are subscribed to the Google Groups
"
Sure. Just create the datetime field in your model and override the save()
function of the model to do what you want.
To facilitate this, just override __init__() of the model to store the value of
the boolean field upon instantiation so that, in save(), you know whether it
has changed.
Don't
Had you already run syncdb when you made the field optional? If so, you need to
use a migration tool -- syncdb doesn't change existing tables, only creates new
ones.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group
If you're in a terrible rush, you could switch to sqlite3 during development
until you're ready to go to production.
It sounds like either psycopg2 didn't install properly, or your Django instance
is running under a different version or installation of Python than the one
where you installed th
It would be nice if contrib.auth threw signals for auth attempts.
I don't think a custom auth backend would be the best solution, because a
custom auth backend as described in the documentation doesn't receive the
request object, which is where the stuff you want (such as IP address) can be
acc
You can override the delete function of your model to take care of this.
Alternatively, if you want to do this for a bunch of different models, it might
be cleaner to use signals.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post
On May 30, 2010, at 10:07 PM, AD wrote:
> Thanks for replying.
>
> I do understand that i can install it manually. I'm just wondering
> whether it's worth doing now or waiting for a package update. From
> what I gather, Ubuntu installs Django in different locations than the
> straight Django ins
Try using django-debug-toolbar. It will show the POST and GET values.
Also, you can use request.POST.get('formID') instead, which will return None
(or the second, optional argument) if it's empty.
What is your json_response middleware doing? Could it have anything to do with
this?
What if you
I'm having an extremely weird problem which I've been unable to solve for
weeks. It's entirely possible that there's something odd I've done somewhere in
the system, but I thought I'd throw it out there in case someone has seen this
already.
Background: User must be logged in to view a page or
I've been having an infuriating problem. Less than 1% of our users, all on IE,
had this symptom:
1. They log in.
2. They are redirected to the main screen (logged in successfully).
3. They click any link or refresh, and they're redirected to the login page
because Django sees request.user as Ano
On Jun 6, 2010, at 9:18 AM, Andy Kelley wrote:
> Use south. The overhead is worth it.
+1 on South.
Especially because this "just this once" scenario is going to happen again and
again if your project lives long enough.
Shawn
--
You received this message because you are subscribed to the Goo
Use South data migrations.
Sent from my iPad, in accordance with the prophesy.
--
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
Install ipython.
It has a lot of great features, including retaining history.
If it's installed, Django will use it by default if you run manage.py shell.
Shawn
Sent from my iPhone 4, for which I waited in line for six hours like a fool on
release day.
--
You received this message becaus
The easiest solution I've found is to just install it with pip.
Download the tarball for the version you want then run pip install filename.
Of course you'll need to prefix that with sudo if you're installing it
system-wide, but I recommend virtualenv.
I use a Mac for development full-time an
Yes, this is slightly off-topic, but all the Django developers I know use
jQuery in their projects.
The publisher is giving away the e-book as promotional stunt related to the
World Cup.
http://sale.sitepoint.com/
The download includes PDF, .mobi, and .epub versions!
Shawn
Disclaimer: None.
Here's a little blog post I just wrote. It provides instructions for what I
think is the simplest possible way to add Celery to your Django project.
Feedback (including critical) is always welcome.
http://shawnmilo.blogspot.com/2010/07/simple-celery-with-django-how-to.html
Shawn
--
You receiv
This is a known (and common) problem. Here's an easy fix that I've used many
times.
http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html
Incidentally, you can replace "make install" with "make altinstall" to add
Python 2.7 to your system without replacing the default Python.
Sha
>
>
> When I comment out the import views above, it gives me the following
> error:
>
> Exception Type: NameError at /QC_THISSS_01/samples/create/
> Exception Value: name 'request' is not defined
>
>
>
This is because when you import the file it attempts to actually execute the
line "addSample = sa
I definitely prefer to compile and altinstall Python or install it somewhere
in my home directory, then use virtualenv for all my Django and Python
projects.
I'm currently using 2.6.5 and 2.7 for my Django projects, without
interfering with any OS X defaults.
As has been mentioned you'll need Xco
http://code.djangoproject.com/wiki/DjangoFriendlyWebHosts
--
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...
Evidently the function you are trying to call has been moved.
http://docs.python.org/library/commands.html
Try subprocess instead of commands.
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-u
>
>
> TypeError: __init__() got an unexpected keyword argument 'maxlength'
>
>
Your error is right there, at the bottom of your stack trace. The keyword
maxlength is not valid. You probably meant max_length.
In the future, please actually read the error message output. It is usually
very helpful.
Are you using the default version of Python that came with Snow Leopard? If
so, try a virtualenv. I did some searching on Google and saw similar errors
reported but it seems that bugs which would cause them have been patched in
current versions.
I do all my development in virtualenvs with official
This list and the Python mailing list[1] are both great for that. Of course,
both are forums where you get the best assistance by showing that you've
tried and failed before you asked others for their time.
Shawn
1. http://mail.python.org/mailman/listinfo/python-list
--
You received this messag
To expand on what Scott said, you could do something like this:
#if a name was passed
if name and len(name):
name_q = Q()
for token in name.split():
name_q = name_q & (Q(first_name__icontains=token) |
Q(last_name__icontains=token))
This wou
On Thu, Jul 22, 2010 at 5:20 PM, Ryan LeTulle wrote:
> Why wouldn't you simply?
>
> User.objects.filter(firstname="John", lastname="Doe")
>
>
>
Because the OP wants to accept a string containing full (both first
and last) name, and you can't reliably split that into "first name"
and "last name"
Have a look at request.META, particularly HTTP_HOST.
Search this page for "HttpRequest.META":
http://docs.djangoproject.com/en/dev/ref/request-response/
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to
The docs explain how to add your own fields to formsets. You could
insert your labels that way.
http://docs.djangoproject.com/en/1.2/topics/forms/formsets/
Also, since you're in a template 'for' loop, you could just use the
forloop.counter0 to access the value of your index list that
corresponds
You have three regular expressions. Two of them require digits, and
one requires *only* /record/, with no additional arguments.
So /record/john/ does not match any of those.
Shawn
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this
There's your error. The value of model_or_iterable is not iterable.
Perhaps it's a model (based on your naming convention).
Try logging the value of model_or_iterable right before that line to
see what it contains. Once you've done that, figure out why it
contains that instead of something that's
Did you run ./manage.py syncdb?
--
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 mor
Are you using sqlite3? It doesn't support the unique_together constraint.
--
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-u
On Thu, Jul 29, 2010 at 1:22 PM, kostia wrote:
> Thanks, I already know about webfraction. Great site.
>
> If anyone can provide cheaper solution, hosted in Europe, please write
> me.
>
> --
http://lmgtfy.com/?q=django+hosting+europe&l=1
--
You received this message because you are subscribed t
Maybe a combination of these two things will get you going.
1. A way to store additional information about users (such as IP addresses).
http://docs.djangoproject.com/en/dev/topics/auth/?from=olddocs#storing-additional-information-about-users
2. Get the IP address from the META attribute of the r
You can do this very easily by tweaking your model as follows:
1. Override __init__() and store the value of that field in a
temporary value, such as self.old_status.
2. Override save() and before you call the super() save, check if
self.pk (meaning the instance is not new). If so, and self.old_s
On Thu, Aug 5, 2010 at 12:31 PM, shmengie <1st...@gmail.com> wrote:
> I think it's better to let the user know the fields exist and may not
> be changed, than to present them with editable fields that may not.
>
I agree. That's not incompatible with my solution. I would expect the
user to be infor
Good question. According to the dumpdata docs, the available formats are here:
http://docs.djangoproject.com/en/1.2/topics/serialization/#serialization-formats
And 'python' does indeed show in that list. However, that page does
mention that the 'python' version serves as a base for other formats
The auth module in contrib uses the make_token method of
default_token_generator in django.contrib.auth.tokens for the standard
password reset, so that sounds like a good choice.
Another good way to get a unique, random string is uuid.uuid4().
Shawn
--
You received this message because you are
The Python version that ships with Snow Leopard is compiled for
64-bit. Unfortunately, the latest psycopg2 does not work properly, and
you'll have to recompile Python for yourself in 32-bit.
Here are the instructions:
http://shawnmilo.blogspot.com/2009/11/psycopg2-on-snow-leopard.html
Incidentall
Middleware executes with each request, so it's probably not the best
place for such a thing.
It seems like it would be a lot easier to use a normal sqlite3
database and just delete it after each run.
Also, if you have test data you'd like to reload regularly, I
recommend using a regular database,
Try --NOINPUT
http://docs.djangoproject.com/en/1.2/ref/django-admin/#syncdb
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
In addition to what Steve said, I'd recommend putting something like
this in your template as a test:
zxc is: '{{ zxc }}'
comm.id is: '{{ comm.id }}'
This may save you some time if something you don't expect is happening.
Shawn
--
You received this message because you are subscribed to the Goo
It sounds like a job for natural keys.
http://docs.djangoproject.com/en/dev/releases/1.2-alpha-1/#natural-keys-in-fixtures
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
If you set your environment variable DJANGO_SETTINGS_MODULE in the
environment your script is running in, you need only add this line to
your script (in addition to your model imports, of course).
from django.conf import settings
Otherwise you'll need to import the OS module in your script and ad
Your version automatically gets called during the cleaning process
(assuming it's named properly). You don't need to call it explicitly.
The default cleaning of the field will happen automatically. All you
have to do is get the value from cleaned_data and make sure you return
the value in your func
If you override __init__() and store the value of that field in a
temporary value, such as self.old_status, then the instance will have
both self.status and self.old_status for comparison later.
I hope this fits your use-case.
Shawn
--
You received this message because you are subscribed to the
On Tue, Aug 24, 2010 at 3:33 PM, Almost George
wrote:
>
> When overriding __init__, what does that function definition need to
> look like to make sure everything else works as usual?
>
Nothing special, as long as you call the __init__ of super.
Example: super(YourModelName, self).__init__(*arg
I have my .bashrc set to source the virtualenv, and I source .bashrc
in any shell scripts that need to run via cron. That works out well
for me, and was even seamless when I upgraded our server to Python 2.7
last weekend -- I didn't have to change a thing in any script, and
just one line in .bashrc
If you still want to use the contrib.auth app, you can just add your
own backend to the user authentication. It's very easy to do.
http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend
There are some very smart people who prefer not to use contrib.auth
for a variety
This a Python question, not a Django question.
import urllib
urllib.quote("+ ñ ó")
'%2B%20%C3%B1%20%C3%B3'
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
You can use multiple authentication backends in the same Django
project. All you have to do is write/install a backend that supports
your alternative method, and add it to AUTHENTICATION_BACKENDS in your
settings file.
The info here should help a lot:
http://docs.djangoproject.com/en/dev/topics/au
101 - 200 of 1241 matches
Mail list logo