Looks like there might already be a ticket open to fix this:
https://code.djangoproject.com/ticket/16563
--
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/msg/django-users/-/um
Maybe something like this...
for target in Target.objects.all():
property = target.property_set.latest("export_date")
print target.name, target.t1, target.t2, property.export_date,
property.p1, property.p2
--
You received this message because you are subscribed to the Google Groups
"Dj
Yeah, it doesn't look like 1.1 allowed for ftp protocol:
https://github.com/django/django/blob/1.1.X/django/forms/fields.py#L545
Best bet might be to create your own URLField class and overwrite the
__init__ method to use your own regular expression. Kind of a pain. It's a
little easier in futu
It looks like the URLValidator should in fact accept ftp:
https://github.com/django/django/blob/master/django/core/validators.py#L46
What's the specific error you're getting?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discuss
On Thursday, July 14, 2011 2:32:26 PM UTC-4, Petey wrote:
>
> Is there a way around?
>
This isn't really something that can/should be solved in the model itself.
You could try overwriting the formfield_for_foreignkey method in your
ModelAdmin:
https://docs.djangoproject.com/en/dev/ref/contrib/ad
You should still probably remove the user_logged_in from your default value.
It doesn't do what you think it does, and could cause other strange things
to happen.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the w
I just noticed that you had the default value set to the "user_logged_in"
signal method. That's not going to work at all. You probably want to remove
that from the field definition.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this
When you do this:
created = models.ForeignKey(User, default=user_logged_in, editable=False
)
It's going to create a method on the user instance called "news_set".
Then when you then do this:
edited = models.ForeignKey(User, default=user_logged_in, editable=False)
It's going to try to c
Django trunk also contains validate_ipv6_address and validate_ipv46_address.
But as of 1.3 I think it only validates ipv4
--
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/msg/
You do have a __init__.py file in each of the sub folders, correct?
--
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/msg/django-users/-/G33m7AMAv7wJ.
To post to this group, sen
On Friday, June 24, 2011 4:30:13 PM UTC-4, django_cd wrote:
>
> Thanks Jacob for the reply although u didn't answer giving a reason for the
> error.
>
The reason for the error is that you are using a different version of Django
than that tutorial was written for.
That tutorial is from 2006 and
Shouldn't be too hard to implement I don't think. Basically just loop
through your list of keywords and replace them with a link. Something like
this:
def make_keyword_links(content):
for keyword in Keyword.objects.all():
content = content.replace(keyword.text, keyword.link)
retu
Django automatically calls get_object() to get the object that needs to be
updated by your form.
There is a default get_object() method in the SingleObjectMixin that just
gets the object based on the "model" and the "pk" that's passed in:
https://code.djangoproject.com/browser/django/trunk/djan
Shouldn't you really be putting your js/css in your static directory?
Check out the docs for managing static files:
https://docs.djangoproject.com/en/1.3/howto/static-files/
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussi
The link was just an example. It could be a more complex block of HTML.
Point being if the tag just massaging data into HTML, you can accomplish it
with another template without creating a tag.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
T
Another option, if your use-case doesn't require anything terribly complex,
is to just include another template and pass your variables to it:
{% include "link_to.html" with url="google.com" text="check out google" %}
In link_to.html:
{{ text }}
https://docs.djangoproject.com/en/1.3/ref/templa
There should be two underscores before and after the "unicode" in the method
name:
"__unicode__" instead of "_unicode_"
--
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/msg/d
You could probably do it using a signal. Every time a record is created or
deleted, you can update the verbose_name_plural with the current count.
from django.db.models.signals import post_save, post_delete
def update_verbose_name(sender, **kwargs):
Elephant._meta.verbose_name_plural = 'elep
I think you might want the heading outside the loop:
My Heading
{% for val in data %}
{% ifnotequal val 2 %}
{{val}}
{% endifnotequal %}
{% endfor %}
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discus
You should be able to do both those with the block tag, unless I'm
misunderstanding something, or you have some other requirement.
{% extends "base.html" %}
{% block content %}
{% block extra-js %}
{% if user.is_authenticated %}
{% endif %}
{% endblock %}
... more block content ...
{% endblock %
Can you put the whole script tag in a block?
= template.html =
{% block extra-js %}
{% endblock %}
= base.html =
{% block extra-js %}{% endblock %}
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django
Sorry, "class MP3Media(object):" should have been class
"MP3Media(Media):"
--
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-
I think then you will run into a problem with you add another media
type:
class WAVMedia(Media):
file = models.CharField()
def play(self):
# do stuff
>>> m = Media()
>>> m.wavmedia = WAVMedia()
>>> m.mp3media = MP3Media()
>>> playlist = Playlist
>>> playlist.media_set.append(m)
for media
On Apr 21, 9:28 am, Tom Evans wrote:
> On Wed, Apr 21, 2010 at 2:15 PM, Tim Shaffer wrote:
> > On Apr 21, 8:25 am, Torsten Bronger
> > wrote:
> >> calls the method of the respective class of "instance". However, in
> >> Django,
&
On Apr 21, 8:25 am, Torsten Bronger
wrote:
> Yes, but normally, you have tools like type(instance) or
> instance.__class__. However, in Django, you don't. That's the
> problem.
Sure you do...
>>> from website.blog.models import Entry
>>> e = Entry.objects.all()[0]
>>> e.__class__
>>> type(e)
Why should an author instance ever return True for
isinsnace(author_instance, Translator). That's not really the way
Python or Django are designed to work.
Why not just check to see if the author instance has an associated
translator instance? That's the proper way. See the docs on multi-
table in
I suspect you have a clash in names here. You have two methods named
"login":
5: from django.contrib.auth import authenticate, login
9: def login(request, template_name='auth/login.html'):
So when you call login(request, user) on line 21, it's calling the
method you created on line 9, not the log
Can't you just concatenate them like so?
message = "Last Name: " + last_name + " Message: " + message
Or if you want to get really fancy, you could create a template, pass
the form as a context, and render the template for the e-mail message.
--
You received this message because you are subscri
Check out the attrs dictionary option for the form widget.
http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.Widget.attrs
--
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...@googl
Try reversing the order. The first alias is probably picking up the /
test URL. If you specify the test alias first, it should work.
--
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
Or, using range:
MyModel.objects.filter( Q(a__range=(1,5)) | Q(b__range=(20,70)) )
--
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
http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects
MyModel.objects.filter( ( Q(a__gt=1) & Q(a__lt=5) ) | ( Q(b__gt=20) &
Q(b__lt=70) ) )
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
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
Choices should be a list/tuple of lists/tuples in the form of
(value,display). So this:
choices = (('M','Male'),('F','Female'),)
Would give you this:
Male
Female
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send emai
Very strange. What happens if you open a new Terminal window and run
the following?
python -c "import sys; print sys.path"
--
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 un
What is the absolute path to the django site-packages folder?
What does the following code output when you run it in the python
interpreter?
import sys
for p in sys.path:
print p
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to t
Oh, check out the Category class from django-simplecms. It implements
the first method.
Specifically, check out the save() method that builds the path based
on all the parent categories if it doesn't exist.
http://code.google.com/p/django-simplecms/source/browse/trunk/simplecms/cms/models.py#47
> I suppose I could do something like r'^(?P.*)$' and then parse path in
> the view but this could wreak havoc with other URLs.
Yes, that's the way to do it. You can prevent it from clashing with
other URLs by prefixing it with something like categories/ so the URL
would be:
www.example.com/cate
It's actually the auth context processor that queries for messages,
not the auth middleware.
The TEMPLATE_CONTEXT_PROCESSORS are only processed when you using
RequestContext. So there are numerous ways to get prevent the auth
context processor from being used. You could just not use
RequestContext
This might be slightly off topic, but why is the last_login set to the
current date when a user is created?
Wouldn't it make more sense for that date to be null until the user
actually logs in?
On Apr 5, 4:25 pm, Wesley Childs wrote:
> Thanks for the advice.
>
> I'm going for boolean as I like t
g and {% include %} tags are parsed at the same time as the
{% if %} tag.
On Apr 5, 2:51 pm, Owen Nelson wrote:
> Tim Shaffer wrote:
> > I haven't tested this at all, but maybe try putting all the tagging
> > stuff, include {% load tagging_tags %}, in a separate template, then
>
I haven't tested this at all, but maybe try putting all the tagging
stuff, include {% load tagging_tags %}, in a separate template, then
wrapping the if statement around an include for that template:
{% if object.tags %}
{% include "tag_stuff.html" %}
{% endif %}
Like I said, I haven't tested t
+1 for Webfaction
Their hosting plans are great, and the customer service is absolutely
amazing. I'm just on a shared plan, but usually get a response to
tickets within an hour or so. Top notch.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
T
I think this could all be simplified a bit if you used a UserProfile
model instead of subclassing auth.User.
http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
Was there a specific reason you were subclassing auth.User?
--
You received this message beca
You are right. I understand now. I must have misread the original
request, because I now see that describes multiple instances in memory
wouldn't work properly.
On Mar 24, 12:52 am, Graham Dumpleton
wrote:
> On Mar 24, 12:53 pm, Tim Shaffer wrote:
>
> > No, it would just be on
No, it would just be one instance of the project with 20 different
configuration files.
On Mar 23, 5:29 am, Tom Evans wrote:
> On Mon, Mar 22, 2010 at 5:53 PM, Tim Shaffer wrote:
> > It gives you multiple sites from one codebase with multiple settings
> > files. They are using t
SVN diff is here:
http://code.google.com/p/django-namespace/source/diff?spec=svn3&r=3&format=side&path=/trunk/namespace/admin.py&old_path=/trunk/namespace/admin.py&old=2
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, sen
add a new
> task, he can choose tasks from other namespaces as parent tasks.
>
> I tried that with a different model combination, with the same result.
> As soon as a model refers to a foreignkey the user is able to choose
> from ever other namespace.
> Can that be resolved somehow
It depends. This will only run one query, when negated_queryset is
used.
queryset = User.objects.filter(first_name='vinicius')
negated_queryset = User.objects.exclude(id__in=queryset.values("id"))
Since the first queryset is not evaluated until it's used in the
negated_queryset (as a subquery).
Django doesn't support that out of the box. I searched and couldn't
find anything. Self plug: I created an app that does exactly this.
http://code.google.com/p/django-namespace/
Only difference is I called the model Namespace instead of Domain.
Just download it, then add it to your INSTALLED_APPS
Might be possible. I'm not terribly familiar with the innards of the
QuerySet class. Seems like it could get real complex real fast,
especially if you're using Q objects.
On Mar 22, 4:17 pm, Phlip wrote:
> > Just create another queryset that excludes everything in your first
> > queryset:
>
> > n
Just create another queryset that excludes everything in your first
queryset:
negated_queryset = User.objects.exclude(id__in=queryset.values("id"))
On Mar 22, 3:47 pm, Vinicius Mendes wrote:
> Is there any way to negate a queryset? Let's supose i have this queryset:
>
> User.objects.filter(first
It gives you multiple sites from one codebase with multiple settings
files. They are using the same project module. So your project would
look like this:
project
- app1
- app2
- settings.py
- settings_site1.py
- settings_site2.py
- urls.py
settings.py would contain all the settings like a normal
How are you serving the Django project? Are you using Apache?
mod_python? mod_wsgi?
If you are using mod_python or mod_wsgi, you should be able to change
the DJANGO_SETTINGS_MODULE for each site. So basically for each site,
you would have a separate settings file in your project.
So for the first
There may be a more efficient way, but you can use this for starters:
if ( "admin" in request.user.groups.values_list("name",flat=True) ):
On Feb 22, 5:56 pm, Joakim Hove wrote:
> Hello,
>
> using the django auth framework I have created two groups called
> "admin" and "normal" and all the users
You'll have to manually install libjepg to get PIL working on a Mac.
If you have MacPorts installed, you should just be able to do "sudo
port install jpeg".
Otherwise, you can download it from one of these locations:
http://dir.filewatcher.com/d/GNU/Other/jpegsrc.v6b.tar.gz.613261.html
Then fol
What does the HTML for the Django-generated form look like?
What does the HTML for the non-Django-generated form look like?
Are you using Django Cross Site Request Forgery protection?
On Feb 22, 12:27 pm, kkerbel wrote:
> Let me further clarify...when I post using django it works as
> expected,
> Wait, but do profile fields get displayed as part of the form?
Just add them to RegistrationForm and they will. Or create another
form class for Profile, and use the fields from that to populate the
Profile...
{{ reg_form.as_p }}
{{ profile_form.as_p }}
On Feb 20, 10:22 am, Shawn Milochik w
Sorry... char.save() should read profile.save()
On Feb 20, 9:05 am, Tim Shaffer wrote:
> It's really not that difficult. You can just override the save()
> method and create the Profile there.
>
> class RegistrationForm(forms.ModelForm):
>
> class Meta:
>
It's really not that difficult. You can just override the save()
method and create the Profile there.
class RegistrationForm(forms.ModelForm):
class Meta:
model = User
def save(self):
user = super(RegistrationForm, self).save()
profile = Profile.objects.create(use
hope this discussion is helping
> other users who are new to django. I had searched extensively for django
> implementations of RPG-like inventories and characters and didn't find any.
> I'm sure there are other people in the same boat.
>
> Cheers.
>
> -Tim
>
&g
> inventory to a single samurai, and I can add multiple items to the
> inventory. The problem is that I can't associate a unique condition (100% or
> less) with each item. And I can't seem to add the same item twice.
>
> I would like to have an inventory that looked like th
1) You can change this in your model. Check out "verbose_name" and
"verbose_name_plural" for the model's Meta class.
http://docs.djangoproject.com/en/dev/ref/models/options/
2) If you have a ManyToMany field to samurai on the item, you don't
need the inventory model at all. A samurai's inventory
I'm guessing you're using MySQL? I believe order_with_respect_to has
been broken for a while now when used with MySQL. I haven't been able
to get it working since I can remember.
There is a ticket regarding this issue...
http://code.djangoproject.com/ticket/1760
--~--~-~--~~---
Your code looks valid as it is right now. The get_latest_polls function
should return a QuerySet of the three latest polls.
When you call this function it will get the polls and assign the
QuerySet to the "polls" variable for use in your template.
In order to display the polls, you would need to
It should be
{{ product.title|ljust:"40" }}
--~--~-~--~~~---~--~~
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, s
This is my first time using custom validators, so I want to make sure
I'm on the right track.
Here's a stripped down version of my model and the validation
requirements:
class Event(models.Model):
date = models.DateField()
recurrence = models.SmallIntegerField(blank=True, null=True,
choi
It looks like some of your views are very simple and could use generic
views, if you wanted.
def home(request):
return render_to_response('home.html')
could use django.views.generic.simple.direct_to_template
def entry(request, entry_id):
e = get_object_or_404(Entry, pk=entry_id)
You can use choices for the Frequency model, if you like. It may
simplify things.
DAY_CHOICES = (
('Sa', 'Saturday'),
('Su', 'Sunday'),
('Mo', 'Monday'),
('Tu', 'Tuesday'),
('We', 'Wednesday'),
('Th', 'Thursday'),
('Fr', 'Friday'),
)
class Frequency(models.Model):
Thanks... that fixed it. I don't know how I missed that.
It's always the simple things.
--~--~-~--~~~---~--~~
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@google
I have a model that holds events... simplified, it looks like this:
RECURRENCE_CHOICES = (
('1', 'Daily'),
('2', 'Weekly'),
('3', 'Monthly'),
('4', 'Yearly'),
)
class Event(models.Model):
title = models.CharField(maxlength=50)
recurrence = models.SmallIntegerField(blank=T
It shouldn't. Here are a couple other things to check, just in case
it's something simple.
1. Is the domain setup with "FastCGI Support?" in the Dreamhost Panel?
2. Are the permissions on django.fcgi set to 755?
Post the last 10 lines or so of ~/logs/yoursite.com/http/error.log This
will show a
comments = Comment.objects.filter(usubjid__study_id__exact='CP-AI-005')
By using the usubjid__study_id syntax it lets django know that you want
to filter by study_id field in the usubjid (Patient) model.
--~--~-~--~~~---~--~~
You received this message because you
Here is my .htaccess file... let me know if you have any questions.
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule ^(media/.*) - [L]
RewriteCond %{REQUEST_URI} !(django.fcgi)
RewriteRule ^(.*)$ django.fcgi/$1 [L]
--~--~-~--~~~---~--~~
You received t
I am using Dreamhost and just recently switched from the "old" way to
the "new" way that uses flup. I haven't had any problems.
It's hard to tell where your problem is occurring without seeing any
errors... can you check the server logs and post the error?
Just for reference, here is what my dja
75 matches
Mail list logo