Sunday, July 31, 2011

Django User (auth) question

Hello,

I have a question about tweaking the django.contrib.auth.models.User class. I noticed that Django doesn't allow for overriding of attributes of "Field" instances, such as "email" or "first name". Yet, I'd like to my email and first name fields to be required and I'd also like to have my email Field be unique. What is the recommended way to achieve this? 

It's also a little odd that in Postgres, the first_name column (and others) are defined as "not null", but the User model in Django does not mark those fields as required. Does that mean it puts an empty string into that column instead of using a null? That seems a little strange in itself, but not that big a deal.

Basically, I'm trying to figure out how to slightly customize the Django auth User class to be fit to my needs a little bit more, and I can't seem to figure it out from the documentation.

Thanks!

-JamesD

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: How control access to static pages that are *not* part of a Django app?

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 recently.

The closest competitor I found is django-protected-files, but it doesn't
look like it's been maintained for a long time.

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 unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

How control access to static pages that are *not* part of a Django app?

My Django app only allows someone to access a /books page, that is
part of the Django app, if they are signed in.

The pages below that URL are just static directory listings of PDFs
all handled by Apache.
For example /books/book_1, /books/book_2, etc.

Because these directory listings aren't handled by Django, they don't
enjoy Django's access controls. They don't even have a view since
they are just static pages handled by Apache.

Is there any way to somehow prevent access to them unless someone is
signed into my Django app?

chris

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: USE_I18N vs. USE_L10N

On 1/08/2011 8:09am, Lucy Brennan wrote:
> I read Wikipedia and Django docs. Now, after all this debate, I see
> that I _did_ understand the definitions when I first read it.
>
> Given those definitions however, the meaning of USE_I18N and USE_L10N
> are not obvious. Far, far, far from obvious. There _absolutely_ has to
> be some additional explanation of what those two settings does. How
> can you even think that it is obvious???

Can I try and summarise from the perspective of a new user? I want to
include both in my current project so I'm hoping this summary is
correct. Please correct me if I'm wrong ...

Localisation L10N - if switched on via USE_L10N = True - means try to
detect the user's browser header which reveals the region set in the
user's computer. IF detected AND if there is a
../site-packages/django/conf/locale/[xx_XX]/formats.py which corresponds
THEN django will magically translate numbers, dates and times accordingly.

Internationalisation i18n - if switched on via USE_I18N = True - means
to enable translation of string/unicode literals found in the software
PROVIDED the translation mechanism is being used AND translations of the
literals exist. This mechanism involves ugettext.py and use of the
language code deliberately selected by the user from among those on
offer which you (the developer) have made available. The ugettext
function goes off and finds the correct prepared translation file
(../site-packages/django/conf/locale/[xx_XX]/LC_MESSAGES/django.po/.mo)
and uses the literal as an index into that file and returns the
translation for display to the user. That's the django translations. For
your own software translations you have to prepare your own [app].po/.mo
file.

If there is someone with experience in this area who can comment on this
or correct it please?

Thanks

Mike


>
> So since I could not figure that out, I started looking for
> explanations. And somewhere I found, that the settings meant
> respectively: translation and localized formatting. And that is why I
> sent this post on quite a detour. Sorry about that.
>
> Do you people realize that if a newbie reads a) Wikipedia on I/L b)
> Django on I/L, c) this thread. They will still not understand what
> those two settings do!
>
> @ Russell: I would not hesitate to help writing the documentation. But
> I simply don't know what those settings do. So I can't write it.
> (tragicomic smiley)
>
> Lucy
>
> --
> 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/-/d9ShQzQ7tnsJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Broken INTERNAL links related to django.contrib.auth

On Mon, Aug 1, 2011 at 1:23 AM, ivan.ogai@googlemail.com
<ivan.ogai@googlemail.com> wrote:
> I get a lot of 'broken internal links' mails daily from a Django
> application I
> am hacking: http://grical.org
>
> They look like this::
>
>    Referrer: http://grical.org/accounts/login/e/show/580/
>    Requested URL: /accounts/login/e/show/
> 580/
>    User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
> TheFreeDictionary.com; .NET CLR 1.1.4322; .NET CLR 1.0.3705;    .NET
> CLR
> 2.0.50727)
>    IP address: ...
>
> Any idea where can be the problem?

There isn't necessarily a problem anywhere. All this tells you is that
someone, somewhere is requesting a URL that doesn't match a URL
pattern on your site.

The simplest possible cause of this is a dead link on a page -- in
your case, somewhere on the page served by the URL
/accounts/login/e/show/, there is a link that directs the user to
/accounts/login/e/show/580, but that link doesn't resolve. For
whatever reason, people are clicking on that link, so you're getting
notified that there is a problem.

However, it's also possible that this isn't a problem at all. The
internet is filled with lots of robots that wander around; some are
indexing content for search engines (like the GoogleBot); but some are
people probing your site for known security holes. These malicious
robots will frequently construct URLs that don't exist on your site in
an attempt to exploit bugs in the URL handling mechanisms for various
frameworks. There isn't much you can do to stop these people. A
robots.txt file will stop the well behaved robots at the cost of you
losing search engine rank; script kiddie robots don't obey robots.txt.
If you can validate that the link appearing in your log definitely
doesn't exist, and shouldn't exist, and isn't referenced anywhere on
your site, all you can really do here is try and mask these entries
out of your logs.

Yours,
Russ Magee %-)

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: USE_I18N vs. USE_L10N

I read Wikipedia and Django docs. Now, after all this debate, I see that I _did_ understand the definitions when I first read it.

Given those definitions however, the meaning of USE_I18N and USE_L10N are not obvious. Far, far, far from obvious. There _absolutely_ has to be some additional explanation of what those two settings does. How can you even think that it is obvious???

So since I could not figure that out, I started looking for explanations. And somewhere I found, that the settings meant respectively: translation and localized formatting. And that is why I sent this post on quite a detour. Sorry about that.

Do you people realize that if a newbie reads a) Wikipedia on I/L b) Django on I/L, c) this thread. They will still not understand what those two settings do!

@ Russell: I would not hesitate to help writing the documentation. But I simply don't know what those settings do. So I can't write it. (tragicomic smiley)

Lucy

--
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/-/d9ShQzQ7tnsJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Nested formsets at Django 1.3

Kev Dwyer wrote:

> Hello List,
>
> I've been upgrading an old Django 1.1.x app to use Django 1.3, and am
> having a problem with nested formsets.
>
...
>
>
>
I omitted one important fact in this write-up. In Nathan's original code,
the lowest level formset is created like this:

TenantFormset(data=self.data,
instance=instance,
prefix='TENANTS_%s' % pk_value)

where instance is an instance of Building, the "parent" or container
for tenants and self is an instance of

class BaseBuildingFormset(BaseInlineFormSet)

which is instantiated like this:

BuildingFormset = inlineformset_factory(models.Block,
models.Building,
formset=BaseBuildingFormset,
extra=1)

I omitted to mention that to get around this I stopped passing in self.data,
which led to the behaviour that I described in my original post. Apologies
if this misled anyone.

Up to Django 1.2.5, Nathan's code works fine. However at 1.3, if self.data
is passed to TenantFormset, it turns out to be empty and a ValidationError
is raised because the ManagementForm information has not been supplied.
This is the intended consequewnce of #11418, AFAICT.

Working on the assumption that self.data should contain the
ManagementForm data I've tried populating it with said data, but
ValidationError is still raised.

My use case is slightly simpler than Nathan's example as I just need to edit
existing objects, so I'm going to try populating the formsets using
querysets rather than instances.

Does anyone have any other ideas on how this might be made to work?

Cheers,

Kev

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: south vs nashvegas

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 complicated to use. The documentation is very
good, and there aren't all that many features or options to memorize.

Nashvegas doesn't do backwards migrations at all and the database
migrations they do have are database-specific. Those two things alone
mean you can't confidently deploy to production knowing you can
roll-back, and you can't reliably develop on one DB and deploy on
another. Until that's corrected I don't see how Nashvegas is even an
option except for personal projects where you don't care if you take the
site down.

South has an active mailing list in which the core developer
participates and is very helpful.

The only "feature" that Nashvegas claims that South doesn't handle is a
whole project migration as opposed to individual apps. This is actually
not true. South allows you to put a requirement line in a migration that
indicates that it depends on a migration in another app. This, to me, is
not only "the whole project" but more modular and therefore better.

If you're using a version control system and working with other
developers, then any schema migrations, from raw SQL to South are going
to require communication among your group. That's completely unavoidable.

Incidentally, if you do use South and run into trouble, try the South
mailing list. I subscribe to it and will try to help out, if someone
doesn't beat me to it.

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 unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django 1.3 CreateView/ModelForm and dynamic filtering of fields

I am trying to filter a field on a ModelForm. I am subclassing the generic CreateView for my view. 

I found many references to my problem on the web, but the solutions do not seem to work (for me at least) with Django 1.3's class-based views.

Specifically, my users need to add Subscribers, and each Subscriber has a m2m field that assigns him/her to a SubscriberList. When the form to create a subscriber loads for a given user, I need to options in subscriber_list to be filtered for that user's lists only. 

Here are my models:

#models.py

class Subscriber(models.Model):

user = models.ForeignKey(User)
subscriber_list = models.ManyToManyField('SubscriberList')
....
class SubscriberList(models.Model):

user = models.ForeignKey(User)
name = models.CharField(max_length=70)
....
Here is my view:

#views.py

class SubscriberCreateView(AuthCreateView):
model = Subscriber
template_name = "forms/app.html"
form_class = SubscriberForm
success_url = "/app/subscribers/"
def form_valid(self, form):
self.object = form.save(commit=False)
self.object.user = self.request.user
return super(SubscriberCreateView, self).form_valid(form) 



Here is my original form for adding a Subscriber, with no filter:

#forms.py

class SubscriberForm(ModelForm):
class Meta:
model = Subscriber
exclude = ('user', 'facebook_id', 'twitter_id')

Here is my modified form, attempting to filter, but doesn't work:

#forms.py

class SubscriberForm(ModelForm):
class Meta:
model = Subscriber
exclude = ('user', 'facebook_id', 'twitter_id')
def __init__(self, user, **kwargs):
super(SubscriberForm, self).__init__(**kwargs)
self.fields['subscriber_list'].queryset = SubscriberList.objects.filter(user=user)
If I change this modified form as so:

def __init__(self, user=None, **kwargs)

It works - It brings me NO subscriber lists. But any way I try to pass the request user, for eg., def __init__(self, user=request.user, **kwargs), I invariably get a a name "request" or name "self" not defined error.

So, how can I modify my code to filter subscriber_list by the request.user, and still use Django 1.3's CreateView.

--
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/-/fD7CoioGtgIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

south vs nashvegas

I'm about to start using a database migration tool on an existing
project.

(Yes, yes, I know, I am crazy for not having done so from the
beginning...)

So: south (the reigning champ) or nashvegas (the upstart)?

I respect the people working on nashvegas a lot, and figure they have
pretty good reasons for starting a new migration tool. And south
seems more complicated (simpler is better, at least some of the
time...).

I read here http://www.issackelly.com/Blog/entry/On_Django_Migrations_South_vs_Nashvegas/
that "Much care has been made to make sure that you can start using
south on your app part-way through development, where Nashvegas should
really be used from the start. Converting to Nashvegas with a team
requires though and planning, and with South, it requires one
management command from each person (per app)."

Still true? (Things move fast in the Django world.)

Any other opinions, tips, warnings, gratefully received.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Broken INTERNAL links related to django.contrib.auth

I get a lot of 'broken internal links' mails daily from a Django
application I
am hacking: http://grical.org

They look like this::

Referrer: http://grical.org/accounts/login/e/show/580/
Requested URL: /accounts/login/e/show/
580/
User agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
TheFreeDictionary.com; .NET CLR 1.1.4322; .NET CLR 1.0.3705; .NET
CLR
2.0.50727)
IP address: ...

Any idea where can be the problem?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: jquery

Thank You! Now I see I don't understand how can I use static files
using the development server. I saw several answers to this question
of other people but they are too breaf for me.
Books on Django I have don't explain this problem. Be so kind to
explain me.
My local computer has Windows. The project folder is c:/djangomysites/
testjquery, it contains subfolders static and templates, static
contains subfolders images and js.
Today I changed Django 1.2.3 to Django 1.3. May I consider images for
simplicity. For the same reason I don't use os function here.

settings.py contains:
STATICFILES_DIRS = (
'c:/djangomysites/testjquery/static',
)
STATIC_ROOT=''
STATIC_URL='/static/'

urls.py contains:
urlpatterns = patterns('',
(r'^', 'testjquery.views.first'),
if settings.DEBUG:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{ 'document_root': 'c:/djangomysites/testjquery/static' })

views.py contains:
def first(request):
return render_to_response('index.html',
context_instance=RequestContext(request))

index.html contains:
<img src="{{ STATIC_URL }}images/picture.png">
As a result, I get <img src="/static/images/picture.png"> in the
produced html-file. But the image file can't be loaded.
Thank You very much!

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Customizing Form Field HTML Attributes

Thank you.


Stuart MacKay wrote:
>
> Take a look at the widgets used to display a form. From the
> documentation: https://docs.djangoproject.com/en/dev/ref/forms/widgets/
>
> "On a real Web page, you probably don't want every widget to look the
> same. You might want a larger input element for the comment, and you
> might want the 'name' widget to have some special CSS class. To do this,
> you use the Widget.attrs argument when creating the widget:
>
> For example:
>
> class CommentForm(forms.Form):
> name = forms.CharField(
> widget=forms.TextInput(attrs={'class':'special'}))
> url = forms.URLField()
> comment = forms.CharField(
> widget=forms.TextInput(attrs={'size':'40'}))"
>
> Regards,
>
> Stuart MacKay
> Lisbon, Portugal
>
>
>>
>> I would like to use the 'title' attribute of several form fields to hold
>> our
>> help_text, rather than displaying the text alongside the field. I don't
>> see
>> any way, though, to add or modify tag attributes on a form field. How
>> would
>> I do 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-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>

--
View this message in context: http://old.nabble.com/Customizing-Form-Field-HTML-Attributes-tp32164210p32164300.html
Sent from the django-users mailing list archive at Nabble.com.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Customizing Form Field HTML Attributes

Take a look at the widgets used to display a form. From the
documentation: https://docs.djangoproject.com/en/dev/ref/forms/widgets/

"On a real Web page, you probably don't want every widget to look the
same. You might want a larger input element for the comment, and you
might want the 'name' widget to have some special CSS class. To do this,
you use the Widget.attrs argument when creating the widget:

For example:

class CommentForm(forms.Form):
name = forms.CharField(
widget=forms.TextInput(attrs={'class':'special'}))
url = forms.URLField()
comment = forms.CharField(
widget=forms.TextInput(attrs={'size':'40'}))"

Regards,

Stuart MacKay
Lisbon, Portugal


>
> I would like to use the 'title' attribute of several form fields to hold our
> help_text, rather than displaying the text alongside the field. I don't see
> any way, though, to add or modify tag attributes on a form field. How would
> I do 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-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Customizing Form Field HTML Attributes

I would like to use the 'title' attribute of several form fields to hold our
help_text, rather than displaying the text alongside the field. I don't see
any way, though, to add or modify tag attributes on a form field. How would
I do this?
--
View this message in context: http://old.nabble.com/Customizing-Form-Field-HTML-Attributes-tp32164210p32164210.html
Sent from the django-users mailing list archive at Nabble.com.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: No modelue name localeurl ( ">_<)

Then install them on your system's python environment, rather than a
virtual one. Tip: site-packages

On 7/31/11, Kase <dark.kase@gmail.com> wrote:
> oh, im estupid, i put the rosetta and transmeta in my site path but
> not localeurl...
>
> but, i like to put in a generic path and not duplicate in every
> proyect =/
>
> On 31 jul, 03:43, Kase <dark.k...@gmail.com> wrote:
>> i  try  internationalization whit    transmeta,  localeurl and rosette
>>
>> transmetta and rosette works ok
>>
>> all  put in path  /usr/local/pytho27/site-pakage
>>
>> but localeurl dont work!
>>
>> manage.py runserver  trow    Error: No module named localeurl
>>
>> =/
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
Sent from my mobile device

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

django nani

Hello, i've problem with django-nani, in admin panel ist of objects
don't shown.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: No modelue name localeurl ( ">_<)

oh, im estupid, i put the rosetta and transmeta in my site path but
not localeurl...

but, i like to put in a generic path and not duplicate in every
proyect =/

On 31 jul, 03:43, Kase <dark.k...@gmail.com> wrote:
> i  try  internationalization whit    transmeta,  localeurl and rosette
>
> transmetta and rosette works ok
>
> all  put in path  /usr/local/pytho27/site-pakage
>
> but localeurl dont work!
>
> manage.py runserver  trow    Error: No module named localeurl
>
> =/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No modelue name localeurl ( ">_<)

i try internationalization whit transmeta, localeurl and rosette

transmetta and rosette works ok

all put in path /usr/local/pytho27/site-pakage

but localeurl dont work!

manage.py runserver trow Error: No module named localeurl

=/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: upgrade Django 1.2.3 to 1.3

Thank You very much, Kev !!!
You helped me.
Vladimir Vanin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: upgrade Django 1.2.3 to 1.3

vevanin@yandex.ru wrote:

> After upgraging I entered python manage.py runserver and got error
> messages:
> File "manage.py", line 11, in <module>
> execute_manager(settings)
> File "c:\python26\lib\site-packages\django\core\management
> \__init__.py", line 438, in execute_manager
> utility.execute()
> File c:\python26\lib\site-packages\django\core\management
> \__init__.py", line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File "c:\python26\lib\site-packages\django\core\management
> \__init__.py", line 261, in fetch_command
> klass=load_command_class
> module=import_module('%s.management.command.%s' % (app_name, name))
> File "c:\python26\lib\site-packages\django\utils\importlib.py, line
> 35, in import_module
> __import__(name)
> File "c:\python26\lib\site-packages\django\core\management\command
> \runserver.py",line 8, in <module>
> from django.core.handlers.wsgi import WSGIHandler
> File "c:\python26\lib\site-packages\django\core\handlers\wsgi.py",
> line 11, in <module>
> from django.dispatch import Signal
> File "c:\python26\lib\site-packages\django\dispatch\__init__.py",
line
> 9, in <module>
> from django.dispatch.dispatcher import Signal, receiver
> ImportError: cannot import name receiver
>
> Could you point to my mistake? Many thanks!
>


See http://stackoverflow.com/questions/4883802/problem-with-django-1-3-
beta.

In your case your using Windows rather than Linux, but the same advice
applies - remove the django folder (and any django eggs) from the
c:\python26\lib\site-packages folder and re-install 1.3. Or use
virtualenv to maintain separate environments.

Cheers,

Kev

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Saturday, July 30, 2011

upgrade Django 1.2.3 to 1.3

After upgraging I entered python manage.py runserver and got error
messages:
File "manage.py", line 11, in <module>
execute_manager(settings)
File "c:\python26\lib\site-packages\django\core\management
\__init__.py", line 438, in execute_manager
utility.execute()
File c:\python26\lib\site-packages\django\core\management
\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "c:\python26\lib\site-packages\django\core\management
\__init__.py", line 261, in fetch_command
klass=load_command_class
module=import_module('%s.management.command.%s' % (app_name, name))
File "c:\python26\lib\site-packages\django\utils\importlib.py, line
35, in import_module
__import__(name)
File "c:\python26\lib\site-packages\django\core\management\command
\runserver.py",line 8, in <module>
from django.core.handlers.wsgi import WSGIHandler
File "c:\python26\lib\site-packages\django\core\handlers\wsgi.py",
line 11, in <module>
from django.dispatch import Signal
File "c:\python26\lib\site-packages\django\dispatch\__init__.py", line
9, in <module>
from django.dispatch.dispatcher import Signal, receiver
ImportError: cannot import name receiver

Could you point to my mistake? Many thanks!

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: tar xzvf Django-1.3.tar.gz

On Sat, 2011-07-30 at 06:44 -0700, patt numero1 wrote:
> in your terminal>tar xzvf Django-1.3.tar.gz (to unzip your tar)
> in your terminal>cd Django-1.3 (to move in the new directory created
> by the tar)
> in your terminal>sudo python setup.py install (to install django)
>
> hope this helpful!!! ;-)
>
>

he is using windows ;-)

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

Thanks all, the last install worked fine last night, fixed deprecations and once I relocate tinymce I'll be good to go,
W

--
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/-/n9ru9Fsd8XUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django OSQA installation (paid job at Vworker)

This is a request for a job regarding Django, for full details, please
see here:

http://www.vworker.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=1711455

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: jquery

Hi, vevanin.

In addition you maybe need to add this to your settings.py:

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(PROJECT_ROOT, 'static'),
)

Where PROJECT_ROOT is a path to your project root dir.

BTW, maybe you will be interested in dajax and dajaxice.

2011/7/30 Amao Zhao <amaozhao@gmail.com>
Hi,vevanin. Django 1.3 updated the staticfiles server, you should use STATIC_URS to replace your MEDIA_URL in your template.

在 2011年7月31日星期日,vevanin@yandex.ru <vevanin@yandex.ru> 写道:

> I don't understand how can I use jquery with Django.
> I made a template:
> <html>
> <head>
>    <title>test</title>
>        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <script type="text/javascript" src="{{ MEDIA_URL }}js/
> jquery-1.6.1.min.js"></script>
> </head>
> <body>
> <script type="text/javascript">
>        $("<div><p>hello!</p></div>").appendTo("#testid");
> </script>
>    <div id="main">
>                <div id="testid">
>                        <p>test</p>
>                </div>
>        </div>
> </body>
> </html>
>
> In settings.py file I wrote: MEDIA_URL = '/static/'
> There is a 'static/js' folder in my application folder, and it has a
> jquery-1.6.1.min.js in it.
> This doesn't work. Could anyone help me?
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: jquery

Hi,vevanin. Django 1.3 updated the staticfiles server, you should use STATIC_URS to replace your MEDIA_URL in your template.

在 2011年7月31日星期日,vevanin@yandex.ru <vevanin@yandex.ru> 写道:
> I don't understand how can I use jquery with Django.
> I made a template:
> <html>
> <head>
>    <title>test</title>
>        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <script type="text/javascript" src="{{ MEDIA_URL }}js/
> jquery-1.6.1.min.js"></script>
> </head>
> <body>
> <script type="text/javascript">
>        $("<div><p>hello!</p></div>").appendTo("#testid");
> </script>
>    <div id="main">
>                <div id="testid">
>                        <p>test</p>
>                </div>
>        </div>
> </body>
> </html>
>
> In settings.py file I wrote: MEDIA_URL = '/static/'
> There is a 'static/js' folder in my application folder, and it has a
> jquery-1.6.1.min.js in it.
> This doesn't work. Could anyone help me?
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

jquery

I don't understand how can I use jquery with Django.
I made a template:
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="{{ MEDIA_URL }}js/
jquery-1.6.1.min.js"></script>
</head>
<body>
<script type="text/javascript">
$("<div><p>hello!</p></div>").appendTo("#testid");
</script>
<div id="main">
<div id="testid">
<p>test</p>
</div>
</div>
</body>
</html>

In settings.py file I wrote: MEDIA_URL = '/static/'
There is a 'static/js' folder in my application folder, and it has a
jquery-1.6.1.min.js in it.
This doesn't work. Could anyone help me?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Nested formsets at Django 1.3

Hello List,

I've been upgrading an old Django 1.1.x app to use Django 1.3, and am
having a problem with nested formsets.

The structure of my formsets is based on the structure outline in
Nathan Yerger's blog post http://yergler.net/blog/2009/09/27/nested-
formsets-with-django/
, i.e. I have a grandparent object with a one to
many relation to its child objects, and each of these child objects has
a one to many relation to its children.

This worked fine in Django 1.1.x, but at 1.3 the forms in the lowest
layer always have is_bound = False, even after being rendered and
POSTed back to the view. Consequently validation always fails and the
objects that the forms represent cannot be updated. I've reproduced
the behaviour using the code from Nathan's blog post, so it seems that
this approach to nesting formsets is no longer valid, or the code needs
a tweak to work at 1.3.

Has anyone successfully used Nathan's code at 1.3, or is anyone able to
point me towards a nested formset implementation that works at this
release?

(Sorry about the absence of code examples - Nathan's post is much
clearer than my code, so I'd recommend you look at that.)

Cheers,

Kev

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: drag and drop rows on django admin

Makes sense guys. Sorry email I typed from my phone and in the first one the subject was not appropriate.
So i send the another one with subject that sounds right and more likely people who know will be reading it!

I also get mad when I see emails with bad subject or less info to solve the problem. But I did the same :(

Sorry next time, I will be more crystal and clear in my emails. Otherwise, I will not send.

Thanks for the link though (https://code.djangoproject.com/wiki/UsingTheMailingList#Donts:).
I was able to derive lot of good info out of it.

Thanks for your help and time.

Rahul



On Tue, Jul 26, 2011 at 11:30 PM, Derek <gamesbook@gmail.com> wrote:
On Jul 26, 11:03 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Tue, Jul 26, 2011 at 6:32 AM, rahul jain <jainwolver...@gmail.com> wrote:
> > Tried this snippet but not working
>
> >http://djangosnippets.org/snippets/2306/
>
> > Anyone else tried it, I would like to drag and drop rows on django admin.
>
> > Thanks.
>
> > RJ
>
> 1) Resending the same message with a different subject within such a
> short space of time is considered rude. People are busy, and will help
> you as and when they can, be patient. If you can't be patient, people
> probably won't help you.
>
> 2) "Tried <x> but it doesn't work" is useless. What did you try? Where
> did you put the snippet? What happened? What did you expect to happen?
> What were the exact error messages (if any)?
>
> 3) The comments for that snippet clearly says that it is for grapelli.
> Grapelli is not django admin, it is a replacement for django admin.
> It's not clear from your post whether you are even using grapelli.

Tom is being very polite here... he could just have pointed you to:
https://code.djangoproject.com/wiki/UsingTheMailingList#Donts:

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: about django

Lmao, *adds to the todo list*

On Sat, Jul 30, 2011 at 5:08 PM, bruno desthuilliers <bruno.desthuilliers@gmail.com> wrote:


On 30 juil, 17:07, "Cal Leeming [Simplicity Media Ltd]"
<cal.leem...@simplicitymedialtd.co.uk> wrote:
> I think @bruno's post should be included in the wiki tbh.
>
Please fix all the typos then <g>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: about django

On 30 juil, 17:07, "Cal Leeming [Simplicity Media Ltd]"
<cal.leem...@simplicitymedialtd.co.uk> wrote:
> I think @bruno's post should be included in the wiki tbh.
>
Please fix all the typos then <g>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: about django

I think @bruno's post should be included in the wiki tbh.



On Sat, Jul 30, 2011 at 2:41 AM, Harjot Gill <gillhrjot@gmail.com> wrote:
@ bruno desthuilliers,
Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: tar xzvf Django-1.3.tar.gz

you should extract all the content to a folder. in windows you will need to extract it twice until u see some django folder files which you see ass setup.py
then from msdos prompt go to the folder..then run this command :
python setup.py install

assume your python path is set in windows machine.

you just need dig into the doc man..

On Jul 30, 2011 9:45 PM, "patt numero1" <ndkpatt@gmail.com> wrote:
> in your terminal>tar xzvf Django-1.3.tar.gz (to unzip your tar)
> in your terminal>cd Django-1.3 (to move in the new directory created
> by the tar)
> in your terminal>sudo python setup.py install (to install django)
>
> hope this helpful!!! ;-)
>
> On Jul 30, 2:41 am, Technical Writer <wingman1...@gmail.com> wrote:
>> Hello,all:
>>     I am a technical writer here in China and right now I run into
>> troube installing Django onto my Windows operation system. I have
>> followed the steps in the instruction page at (https://www.djangoproject.com/download/) with Python 2.7 installed. Then I
>> downloaded Django-1.3.tar.gz. and the instruction page tells me:
>> ------------------------------------------
>> tar xzvf Django-1.3.tar.gz
>> cd Django-1.3
>> sudo python setup.py install
>> -----------------------------------------------
>>
>> How do I suppose to continue? Type in these words into Python shell?
>> But there is indication that the syntax is wrong . I am totally
>> confused here. Can anyone help?
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: tar xzvf Django-1.3.tar.gz

in your terminal>tar xzvf Django-1.3.tar.gz (to unzip your tar)
in your terminal>cd Django-1.3 (to move in the new directory created
by the tar)
in your terminal>sudo python setup.py install (to install django)

hope this helpful!!! ;-)

On Jul 30, 2:41 am, Technical Writer <wingman1...@gmail.com> wrote:
> Hello,all:
>     I am a technical writer here in China and right now I run into
> troube installing Django onto my Windows operation system. I have
> followed the steps in the instruction page at (https://www.djangoproject.com/download/) with Python 2.7 installed. Then I
> downloaded Django-1.3.tar.gz. and the instruction page tells me:
> ------------------------------------------
> tar xzvf Django-1.3.tar.gz
> cd Django-1.3
> sudo python setup.py install
> -----------------------------------------------
>
> How do I suppose to continue? Type in these words into Python shell?
> But there is indication that the syntax is wrong . I am totally
> confused here. Can anyone help?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: tar xzvf Django-1.3.tar.gz

Hello, Technical Writer,
  7zip can uncompress this kind of file.
  wishing to see your book.
regards




On Sat, Jul 30, 2011 at 9:33 PM, Stuart <stuart@bistrotech.net> wrote:
Those commands assume you are using linux. There is more information
for Windows users over here: https://docs.djangoproject.com/en/1.3/topics/install/#installing-official-release

--Stuart

On Jul 30, 1:41 am, Technical Writer <wingman1...@gmail.com> wrote:
> Hello,all:
>     I am a technical writer here in China and right now I run into
> troube installing Django onto my Windows operation system. I have
> followed the steps in the instruction page at (https://www.djangoproject.com/download/) with Python 2.7 installed. Then I
> downloaded Django-1.3.tar.gz. and the instruction page tells me:
> ------------------------------------------
> tar xzvf Django-1.3.tar.gz
> cd Django-1.3
> sudo python setup.py install
> -----------------------------------------------
>
> How do I suppose to continue? Type in these words into Python shell?
> But there is indication that the syntax is wrong . I am totally
> confused here. Can anyone help?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: tar xzvf Django-1.3.tar.gz

Those commands assume you are using linux. There is more information
for Windows users over here: https://docs.djangoproject.com/en/1.3/topics/install/#installing-official-release

--Stuart

On Jul 30, 1:41 am, Technical Writer <wingman1...@gmail.com> wrote:
> Hello,all:
>     I am a technical writer here in China and right now I run into
> troube installing Django onto my Windows operation system. I have
> followed the steps in the instruction page at (https://www.djangoproject.com/download/) with Python 2.7 installed. Then I
> downloaded Django-1.3.tar.gz. and the instruction page tells me:
> ------------------------------------------
> tar xzvf Django-1.3.tar.gz
> cd Django-1.3
> sudo python setup.py install
> -----------------------------------------------
>
> How do I suppose to continue? Type in these words into Python shell?
> But there is indication that the syntax is wrong . I am totally
> confused here. Can anyone help?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: NoReverseMatch for custom admin URLs [SOLVED]

Sorry, my bad :)

I forgot that first argument for patterns() is a string with view name
prefix. That was all.

Martin

On Sat, 30 Jul 2011 11:52:21 +0200, Martin Tiršel <django@blackpage.eu>
wrote:

> Hi all,
>
> the code:
>
> class CompanyProfileAdmin(admin.ModelAdmin):
> list_display = (
> '__unicode__',
> 'city',
> 'premium_type',
> 'followers',
> 'manage_premium_account'
> )
> ...
> def get_urls(self):
> urls = super(CompanyProfileAdmin, self).get_urls()
> my_urls = patterns(
> url(
> r'^some_view/$',
> self.admin_site.admin_view(self.manage_premium_account_view),
> name='manage_premium_account'
> ),
> )
> return my_urls + urls
>
>
> def manage_premium_account_view(self, request, context={}):
> ...
>
>
> class CompanyProfile(models.Model):
> ...
> def manage_premium_account(self):
> return '<a href="%s">Manage</a>' % reverse(
> 'manage_premium_account',
> args=(self.id,)
> )
> manage_premium_account.short_description = 'Action'
> manage_premium_account.allow_tags = True
>
>
> And I get NoReverseMatch exception if I try to reverse
> `manage_premium_account`. Does anybody know why and how to solve it?
>
>
> Thanks,
> Martin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

NoReverseMatch for custom admin URLs

Hi all,

the code:

class CompanyProfileAdmin(admin.ModelAdmin):
list_display = (
'__unicode__',
'city',
'premium_type',
'followers',
'manage_premium_account'
)
...
def get_urls(self):
urls = super(CompanyProfileAdmin, self).get_urls()
my_urls = patterns(
url(
r'^some_view/$',
self.admin_site.admin_view(self.manage_premium_account_view),
name='manage_premium_account'
),
)
return my_urls + urls


def manage_premium_account_view(self, request, context={}):
...


class CompanyProfile(models.Model):
...
def manage_premium_account(self):
return '<a href="%s">Manage</a>' % reverse(
'manage_premium_account',
args=(self.id,)
)
manage_premium_account.short_description = 'Action'
manage_premium_account.allow_tags = True


And I get NoReverseMatch exception if I try to reverse
`manage_premium_account`. Does anybody know why and how to solve it?


Thanks,
Martin

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

surrogate key question

A bit of design first.

We need to track a document through finite lifetimes. The document has a
legal validity pertaining to real world events which occurred during
such lifetimes. That "same" document gets revised/replaced every so
often or even arbitrarily if an improvement is made.

The system always needs to offer the current document but previous
versions must remain in existence. Previous versions are tagged with
review dates which signify current validity. In theory they should be
replaced with a new version of the "same" document but that might not
happen and it might stay current but be out-of-date. Not desirable but
that's life.

Documents are computed from their various attibutes and downloaded or
displayed as pdf files. These get cached for the future and also for the
past if a previous version is required.

New documents can inherit attributes of other documents. This is a
no-brainer for the next revision of the same document but similar
documents can share some of the exact same attributes.

Now the question.

For me, it sort of makes sense to give an original document a surrogate
key (maybe "ancestor_id") in addition to its primary key. Ancestor_id
would be used to link all its attributes. Then if another document is
created, say the next revision, despite having its own primary key it
gets the same ancestor_id to get the same linked attibutes. Obviously it
would also have some of its own attributes such as revision date and so on.

The ancestor_id would have to be assigned from somewhere. I did think I
could copy the primary key for a document being created from scratch
rather than one starting life as a descendant. Otherwise I would need a
separate number table in the database from which fresh numbers could be
plucked. The value of ancestor_id would have no business significance.

Is this a sane way to travel given the django ORM?

Thanks

Mike

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Memory hosting issues?

On Fri, 2011-07-29 at 18:29 -0700, raj wrote:
> Just need some advice. I currently have a webfaction account, and It
> gives me 80mb of space. But I didn't know that each django application
> takes up approximately 40mb (ran over the limit without realizing it),
> so I can make only a max of 2 different websites. If I want to have
> the ability to make as many websites as I want, what would you guys
> recommend? Adding on additional memory costs too much money. I was
> looking into cloud hosting, but that is really expensive starting off.
> If necessary, I would switch to that. Does cloud hosting allow this
> type of memory flexability? Do you guys know any cheap cloud hosting,
> or a better idea for hosting? Thank you.

vps - linode, gandi, ...

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Friday, July 29, 2011

Django filter and Q

Hi, i read from django docs that we can replace multiple filters with
Q. But and i used both queries but unfortunately they give me
different results. Can someone explain me this? I will post the
queries and corresponding sql here. I am filtering for a many-to-many
field.

>>> Web.objects.filter(colors=c[0]).filter(colors=c[1])
[<Web: http://www.india.com/>, <Web: http://www.saalim.com/>]

>>> Web.objects.filter(Q(colors=c[0]),Q(colors=c[1]))
[ ]

>>> str(Web.objects.filter(colors=c[0]).filter(colors=c[1]).query)
'SELECT "cart_web"."id", "cart_web"."webimage", "cart_web"."webname",
"cart_web"."weburl", "cart_web"."created_date", "cart_web"."active",
"cart_web"."category_id", "cart_web"."dev_id", "cart_web"."votes" FROM
"cart_web" INNER JOIN "cart_web_colors" ON ("cart_web"."id" =
"cart_web_colors"."web_id") INNER JOIN "cart_web_colors" T4 ON
("cart_web"."id" = T4."web_id") WHERE
("cart_web_colors"."colorpalette_id" = 1 AND T4."colorpalette_id" =
2 ) ORDER BY "cart_web"."created_date" DESC'


>>> str(Web.objects.filter(Q(colors=c[0]),Q(colors=c[1])).query)
'SELECT "cart_web"."id", "cart_web"."webimage", "cart_web"."webname",
"cart_web"."weburl", "cart_web"."created_date", "cart_web"."active",
"cart_web"."category_id", "cart_web"."dev_id", "cart_web"."votes" FROM
"cart_web" INNER JOIN "cart_web_colors" ON ("cart_web"."id" =
"cart_web_colors"."web_id") WHERE ("cart_web_colors"."colorpalette_id"
= 1 AND "cart_web_colors"."colorpalette_id" = 2 ) ORDER BY
"cart_web"."created_date" DESC'

Thank you

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

tar xzvf Django-1.3.tar.gz

Hello,all:
I am a technical writer here in China and right now I run into
troube installing Django onto my Windows operation system. I have
followed the steps in the instruction page at (https://
www.djangoproject.com/download/) with Python 2.7 installed. Then I
downloaded Django-1.3.tar.gz. and the instruction page tells me:
------------------------------------------
tar xzvf Django-1.3.tar.gz
cd Django-1.3
sudo python setup.py install
-----------------------------------------------

How do I suppose to continue? Type in these words into Python shell?
But there is indication that the syntax is wrong . I am totally
confused here. Can anyone help?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

OK, reinstalling this way on mac:
http://breakthesystem.org/2009/django-on-snow-leopard/
(using 1.3 instead of 1.1)

worked, so my templates are back and everything works as expected...
Thanks,
W

On Fri, Jul 29, 2011 at 10:15 PM, zignorp <wendy@mutantfactory.com> wrote:
> Actually I'm not using virtualenv, I just installed the new version on my
> mac
>
> tar xzvf Django-1.3.tar.gz
> cd Django-1.3
> sudo python setup.py install
>
>  and it overwrote the older version in python/2.6/site-packages/django
> (I have 1.1 running on my notebook, that's how I checked where the damn
> admin templates directory was)
> I'm just going to quit my project and reinstall and see what happens. Maybe
> I'll install python 2.7 but it's late...
> Thanks for the confirmation that I should indeed have that directory.
> Wendy
>
> --
> 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/-/yB-1Z3mjbvIJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

Actually I'm not using virtualenv, I just installed the new version on my mac

tar xzvf Django-1.3.tar.gz cd Django-1.3 sudo python setup.py install

 and it overwrote the older version in python/2.6/site-packages/django
(I have 1.1 running on my notebook, that's how I checked where the damn admin templates directory was)
I'm just going to quit my project and reinstall and see what happens. Maybe I'll install python 2.7 but it's late...
Thanks for the confirmation that I should indeed have that directory. 
Wendy

--
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/-/yB-1Z3mjbvIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

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 creating a fresh virtualenv using the --no-site-packages option
and pip install Django and see if your project will work that way.


--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

Django 1.3 shipped with staticfiles for static documents, maybe you could look that way.

Le 30 juil. 2011 02:10, "zignorp" <wendy@mutantfactory.com> a écrit :
> Hello,
> I just upgraded to 1.3 and thought all was well until I tried to access
> LOCALHOST/admin/
> Can anyone tell me why I'm getting this exception
>
> Exception Type: TemplateDoesNotExist Exception Value:
>
> admin/login.html
>
> ?
>
> Was working fine in the older version.
>
> --
> 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/-/2iEDmZQCEtYJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

No, I haven't.
I think it has to do with the way the admin templates are loaded.

I do notice that in my  django 1.1 install there is an existing templates directory in site-packages/django/contrib/admin
but in my 1.3 install there is no templates directory. So I think that's the problem, I'm trying to wrap my head around how to refer to the admin templates, like where the heck are they in this version? Have they gone missing in the install (mac 10.6.8)? Or are they someplace totally different?
Does that make sense?
Thanks,
Wendy


--
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/-/_BV8nyWuFGAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Mysterious Path Issue Django & Apache

I think I'm adding the directories to sys.path correctly. For example,
in my wsgi file, this works:

path = '/home/devon/django-projects/'
if path not in sys.path:
sys.path.append(path)

...but if I change the path value like this, then Apache gives a 500
server error:

path = '/home/devon/code/dj/'
if path not in sys.path:
sys.path.append(path)

...both directories exist, and I've started Django projects in each
(both with the same name so I don't have to change the value I pass
into os.environ['DJANGO_SETTINGS_MODULE']

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: lost admin on upgrade to django 1.3

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 this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: about django

@ bruno desthuilliers,
Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Re: Django Memory hosting issues?

**EDIT**
sorry, just another question,
Is it possible to point two domain names to the same application? Its
sort of tough to explain.
In webfaction, It allows me to make an application through the control
panel, and I can link a domain to it. Inside this application, I can
create actual django applications. Can I link one domain to one of
those applications, and another domain to another one of those
applications?

On Jul 29, 9:29 pm, raj <nano.ri...@gmail.com> wrote:
> Hey guys,
> Just need some advice. I currently have a webfaction account, and It
> gives me 80mb of space. But I didn't know that each django application
> takes up approximately 40mb (ran over the limit without realizing it),
> so I can make only a max of 2 different websites. If I want to have
> the ability to make as many websites as I want, what would you guys
> recommend? Adding on additional memory costs too much money. I was
> looking into cloud hosting, but that is really expensive starting off.
> If necessary, I would switch to that. Does cloud hosting allow this
> type of memory flexability? Do you guys know any cheap cloud hosting,
> or a better idea for hosting? Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Django Memory hosting issues?

Hey guys,
Just need some advice. I currently have a webfaction account, and It
gives me 80mb of space. But I didn't know that each django application
takes up approximately 40mb (ran over the limit without realizing it),
so I can make only a max of 2 different websites. If I want to have
the ability to make as many websites as I want, what would you guys
recommend? Adding on additional memory costs too much money. I was
looking into cloud hosting, but that is really expensive starting off.
If necessary, I would switch to that. Does cloud hosting allow this
type of memory flexability? Do you guys know any cheap cloud hosting,
or a better idea for hosting? Thank you.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

lost admin on upgrade to django 1.3

Hello,
I just upgraded to 1.3 and thought all was well until I tried to access LOCALHOST/admin/
Can anyone tell me why I'm getting this exception

Exception Type: TemplateDoesNotExist Exception Value:
admin/login.html
?
Was working fine in the older version.

--
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/-/2iEDmZQCEtYJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.