Re: Django website down?

2010-10-02 Thread Russell Keith-Magee
On Sun, Oct 3, 2010 at 10:47 AM, diogobaeder  wrote:
> Never mind, must be something with my Firefox version (I'm using from
> the launchpad repos, nightly builds). Tested on Chrome and Opera, both
> are fine.
>
> Thanks and sorry for the silly report!

We have had some reports in the past that there are some Firefox
extensions that will cause Django's website to not render --
specifically, if you have the Weave extension (or if you've recently
removed the Weave extension), you may be sending Accept-Language
headers that are not RFC2616 compliant.

Ticket #13944 is tracking this issue, because this is something we are
in a position to handle better on Django's side.

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



Re: View to edit many-to-many relationship with extra fields

2010-10-02 Thread ses1984
Actually, I have added on to what I started with significantly, and
what I ended up doing was emulating formsets with javascript on the
page. When the page POSTs, I can get cleaned formset data from the
request.

On Oct 2, 8:11 am, Felix Dreissig  wrote:
> I'm not at all sure that this might help youm, so sorry if I write BS...
>
> Can't you just use form prefixes to kepp the form namespaces 
> seperated?http://docs.djangoproject.com/en/1.2/ref/forms/api/#prefixes-for-forms
>
> Regards,
> Felix
>
> On 01.10.2010 22:22, ses1984 wrote:
>
>
>
> >http://docs.djangoproject.com/en/1.2/topics/db/models/#extra-fields-o...
>
> > I have two models with a many-to-many relationship through another
> > table with extra fields. In this case, I have one extra field which
> > represents the weight of the relationship.
>
> > I'm working on a view to edit the relationships between the two
> > models. If we call the two models left-hand-side and right-hand-side,
> > then the view is specific to one instance of the LHS, and the purpose
> > of the view is to add relationships from that LHS-row to an arbitrary
> > number of pre-existing RHS-rows.
>
> > Writing a view that, given an instance of the LHS, adds a single
> > weighted relationship to an element on the RHS is pretty trivial.
> > Writing  view that adds an arbitrary number of relationships to the
> > RHS is not that trivial, and that's what I would like to deliver to my
> > users.
>
> > So far the view for a particular LHS-instance renders a page with a
> > form to define a single additional relationship to the RHS. I have
> > included a basic ajax function that GETs another form to the page.
> > This is where the problem comes up: IDs of the form elements are going
> > to overlap, and I won't be able to handle this when the form is
> > POSTed.
>
> > I have thought of two options I could try to tackle this so far, both
> > with javascript. The first would be to increment an index and send
> > that through the ajax function to the view that returns a new form.
> > The second would be to hook into the POST submission and munge the
> > data before it's passed back to django to save model instances.
>
> > It seems to me that something like this, while not common, has to have
> > been done before in web apps. I was wondering if there were some
> > established patterns to do this sort of thing, and if I am on the
> > right track. I have searched a few places including django snippets
> > and packages to see if something like this has been done before, but I
> > couldn't find anything. I'm not sure if I'm using the best search
> > terms.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django website down?

2010-10-02 Thread diogobaeder
Never mind, must be something with my Firefox version (I'm using from
the launchpad repos, nightly builds). Tested on Chrome and Opera, both
are fine.

Thanks and sorry for the silly report!

Diogo

On 2 out, 19:11, Steve Holden  wrote:
> On 10/2/2010 5:50 PM, diogobaeder wrote:
>
> > Hi, guys,
>
> > Is the Django website down? I've been trying to access it for days,
> > but I just can't get in. Has anyone here been able to access it
> > normally these days?
>
> > Thanks!
>
> > Diogo
>
> http://www.downforeveryoneorjustme.com/djangoproject.com
>
> Seems fine to me.
>
> regards
>  Steve
> --
> DjangoCon US 2010 September 7-9http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Why can't I use this model architecture?

2010-10-02 Thread mathphreak
I've got three different classes in models.py and register all three
in admin.py within my app.  Viewing the admin page that I have,
however, gives me http://dpaste.com/252244/ which doesn't look good.
Is this a Django bug, or do I need to rewrite my app?  I think it's
highly unlikely that it's a Django bug.

I'm trying to follow along with the tutorial given on
http://docs.djangoproject.com/en/dev/intro/tutorial01/, if it helps.
My admin.py code is http://dpaste.com/252254/ and my models.py is
http://dpaste.com/hold/252256/.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Error configuring Django to run customized comments framework

2010-10-02 Thread Phil Gyford
A bit late, so you may have solved this or given up on it, but
still... I just had the same error message and eventually solved it by
changing the order of my INSTALLED_APPS. So maybe you have slightly
different settings on your local and live servers, and the apps are
ordered differently on each?

For example if I did this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.comments',
'django.contrib.admin',
'django.contrib.markup',
'django.contrib.flatpages',
'taggit',
'myproject.weblog',
'myproject.aggregator',
'myproject.comments', # My custom comment app
)

then I got the error. But if I did this:

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.comments',
'django.contrib.admin',
'django.contrib.markup',
'django.contrib.flatpages',
'taggit',
'myproject.comments', # My custom comment app
'myproject.weblog',
'myproject.aggregator',
)

(ie, move 'myproject.comments', my custom comments app, further up)
then it worked fine. It just seems to need to be above
'myproject.weblog', so maybe it's some dependency in my code I don't
fully understand. Anyway, hope that helps.


On Thu, Aug 26, 2010 at 1:54 PM, Groady  wrote:
> I'm having an issue with setting up a Django website which uses the
> Django comments framework on my server. The site runs fine when run
> locally (using manage.py runserver) but when pushed live I'm getting
> the error:
>
> ImproperlyConfigured at /
> The COMMENTS_APP setting refers to a non-existing package.
>
> My server is an apache/mod_wsgi setup. My site contains 2 applications
> called weblog and weblog_comments. I've appended my site's path and
> it's parent directories to my django.wsgi file as per the guide
> located here: http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango
> I can comment out the COMMENTS_APP line from my settings.py and the
> site runs fine so I know site is on the python path correctly.
>
> My custom comment model is called WeblogComment and extends the
> default Comment model. It only extends this to add methods to the
> model, it doesn't change Comment model fields thus It has proxy=True
> in it's Meta class.
>
> Any advice would be great.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>



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



Get simple data from form

2010-10-02 Thread petarda
Hello,
I have simple question. How Can I get raw data from form object in my
template?
I don't need html tags only data.
I am trying {{ form.myfield.data }} , but always get None..

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Announcement] Vim for Python and Django

2010-10-02 Thread Rene Vallecillo
nvm, the folder name was wrong, it was suppose to be colors and I had color.
And it seems it still needs to be under ~/.vim/ dir

On Sat, Oct 2, 2010 at 1:50 PM, Rene Vallecillo  wrote:

> Hello
>
> Im having a problem with the colorschemes
>
> I'm getting this:
>
> Error detected while processing /home/rene/.vimrc:
> line   88:
> E185: Cannot find color scheme tango
>
> As far as i can see, there is a folder named color in the ~/trespams-vim/
> folder. But there is no use, any clue?
>
>
>
> On Sat, Oct 2, 2010 at 1:39 AM, Antoni Aloy  wrote:
>
>> 2010/10/2 David M. Besonen :
>> > On Sun, 26 Sep 2010 11:36:06 +0200
>> > Antoni Aloy  wrote:
>> >
>> >> http://code.google.com/p/trespams-vim/
>> >
>> > i assume you've seen Alain's webpage:
>> >  VIM as Python IDE
>> >  http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/
>> >
>> Yes, Alain's makes me love VIM as a Python IDE:)
>>
>> --
>> Antoni Aloy López
>> Blog: http://trespams.com
>> Site: http://apsl.net
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>
>
> --
> ¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸¸ Rene V²¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,
>



-- 
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸¸ Rene V²¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Announcement] Vim for Python and Django

2010-10-02 Thread Rene Vallecillo
Hello

Im having a problem with the colorschemes

I'm getting this:

Error detected while processing /home/rene/.vimrc:
line   88:
E185: Cannot find color scheme tango

As far as i can see, there is a folder named color in the ~/trespams-vim/
folder. But there is no use, any clue?



On Sat, Oct 2, 2010 at 1:39 AM, Antoni Aloy  wrote:

> 2010/10/2 David M. Besonen :
> > On Sun, 26 Sep 2010 11:36:06 +0200
> > Antoni Aloy  wrote:
> >
> >> http://code.google.com/p/trespams-vim/
> >
> > i assume you've seen Alain's webpage:
> >  VIM as Python IDE
> >  http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/
> >
> Yes, Alain's makes me love VIM as a Python IDE:)
>
> --
> Antoni Aloy López
> Blog: http://trespams.com
> Site: http://apsl.net
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸¸ Rene V²¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



An HTML tag editor in (AJAX-ified) Django Admin: does it exist yet?

2010-10-02 Thread Angus
The admins of my site need to be able to edit/create html text content
through Django admin, but rather than offer a standard WYSIWYG editor
I'm thinking I'd like to use an interface with which the admins would
directly and transparently build the resulting html. I'll try to
explain what I have in mind:

My model would consist of a many to one relationship of multiple html
segments to one page. Per segment I'd have at least a tag attribute
which would be a radiobox choice of (p, h1, h2, ul, ol, dl, li, dt,
dd, table, etc.) and a text field for the content. Editing in Django
admin would be done per page with tabular inlines for the segments.
Depending on the choice of tag JavaScript would be used to instantly
show any additional tag-specific attributes. When a list tag or table
is chosen nested inlines would need to appear (recursively, but to a
limited depth).

Basically, I want to give the same amount of control as when writing
html by hand, without having admins manually write the tags
themselves. Using AJAX to only provide the HTML options that are valid
for the given segment would also have the benefit of automatic
validation, eliminating the risks of invalid, unclosed or wrongly
nested tags.

I hope you guys can tell me if something like that already exists (as
plugging in someone else's code instead of creating such a framework
myself would save me big time). Also, feel free to tell me if you
think my goal here is completely misguided...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django documentation search not working

2010-10-02 Thread Steve Holden
On 10/2/2010 4:45 PM, NoviceSortOf wrote:
> I used to be able to go to the following link and
> seach django documents.
> 
> http://docs.djangoproject.com/en/dev//search/
> 
>>From there I could search anything from 'widgets' to
> 'login()' and find the related document/page discussion that time.
> 
> Now on that page search yields no results irregardless of what
> I search for .
> 
> Using the search field on
> http://docs.djangoproject.com/en/1.2/
> 
> Also does not yield any results.
> 
> Strange thing is that I can search from www.google.com
> django login() and get access to django docs but can't search
> django docs from the django website any explanation?
> 
Are you maybe running NoScript or some other script inhibiting extension
to your browser? The search feature's working just fine for me.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django website down?

2010-10-02 Thread Steve Holden
On 10/2/2010 5:50 PM, diogobaeder wrote:
> Hi, guys,
> 
> Is the Django website down? I've been trying to access it for days,
> but I just can't get in. Has anyone here been able to access it
> normally these days?
> 
> Thanks!
> 
> Diogo
> 

http://www.downforeveryoneorjustme.com/djangoproject.com

Seems fine to me.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django documentation search not working

2010-10-02 Thread diogobaeder
Hi there,

I cannot enter the site at all, right now; I just opened a post here
about that: 
http://groups.google.com.br/group/django-users/browse_thread/thread/18a99e355c601fc3?hl=pt-BR

Does it have anything to do with the issue stated above?

Thanks!

Diogo



On 2 out, 17:45, NoviceSortOf  wrote:
> I used to be able to go to the following link and
> seach django documents.
>
> http://docs.djangoproject.com/en/dev//search/
>
> From there I could search anything from 'widgets' to
> 'login()' and find the related document/page discussion that time.
>
> Now on that page search yields no results irregardless of what
> I search for .
>
> Using the search field onhttp://docs.djangoproject.com/en/1.2/
>
> Also does not yield any results.
>
> Strange thing is that I can search fromwww.google.com
> django login() and get access to django docs but can't search
> django docs from the django website any explanation?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django website down?

2010-10-02 Thread diogobaeder
Hi, guys,

Is the Django website down? I've been trying to access it for days,
but I just can't get in. Has anyone here been able to access it
normally these days?

Thanks!

Diogo

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Django documentation search not working

2010-10-02 Thread NoviceSortOf
I used to be able to go to the following link and
seach django documents.

http://docs.djangoproject.com/en/dev//search/

>From there I could search anything from 'widgets' to
'login()' and find the related document/page discussion that time.

Now on that page search yields no results irregardless of what
I search for .

Using the search field on
http://docs.djangoproject.com/en/1.2/

Also does not yield any results.

Strange thing is that I can search from www.google.com
django login() and get access to django docs but can't search
django docs from the django website any explanation?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: A better way of checking if a record exists

2010-10-02 Thread ShawnMilo
Bruno,

Great point. I've simplified my old code quite a bit with this
suggestion.

After creating a dictionary with 12 items in it, I use it for the
default in get_or_create, then:

[setattr(product, field, value) for field, value in
new_values.items()]
product.save()

Thanks,
Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Configuring URLs for different views

2010-10-02 Thread Carles Barrobés
I sometimes use the direct_to_template generic view for a different
purpose than yours (test a template), but the same URL pattern might
be useful to you:

# test a template
(r'^direct/(?P.*)$',
'django.views.generic.simple.direct_to_template'),

Although you'd better use a better regex to match the template name
(like the one you originally used):

  (r'^(?P[a-zA-Z0-9]*?\.html?)$',
'django.views.generic.simple.direct_to_template')

You might also want to take a look at the flatpages app:
http://docs.djangoproject.com/en/dev/ref/contrib/flatpages/
which may be an alternative approach to what you are trying to
achieve.

C.



On 1 Oct, 16:52, bruno desthuilliers 
wrote:
> On 1 oct, 16:07, simon_saffer  wrote:
> (snip)
>
>  My attempt at doing
>
> > this was to put the following in
> > urls.py in urlpatterns
>
> > (r'^(?P[a-zA-Z0-9]*?\.html?)$', 'mysite.views.showPage')
>
> hint : named urls are cool
>
> > and then have a views.py in the mysite 'root' with the function
>
> is 'mysite' an app in your project, or is it the project itself ?
>
> > def showPage(request, page):
>
> hint: Python coding conventions : use all_lower names for functions
>
> >     t = loader.get_template(page)
> >     c = Context({})
>
> >     return HttpResponse(t.render(c))
>
> hint : use the render_to_response()
> hint : use RequestContext if you want your context processors to be of
> any use
>
> > How can I achieve something like this?
>
> Hmmm... What happened with your above attempt exactly ? I guess it
> didn't yield the expected results, but you don't tell what happened
> exactly (and when I mean "exactly", it means that if you got a
> traceback you should post the _whole_ traceback too).

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to retreive the body text alone of a webpage

2010-10-02 Thread jimgardener

thanks guys,
I tried this..

from BeautifulSoup import BeautifulSoup
import urllib

def get_page_body_text(url):
h=urllib.urlopen(url)
data=h.read()
soup=BeautifulSoup(data)
body_texts = soup.body(text=True)
text = ''.join(body_texts)
return text

...
while True:
#print 'size=%d'%len(get_page_body_text('http://
www.google.com'))
print 'size=%d'%len(get_page_body_text('http://
sampleblogbyjim.blogspot.com/'))
time.sleep(5)

when google.com is the url ,the code gets the correct length of
data.Then I tried a blog which I created for fun,
This causes the code to crash with an error


  File "/usr/lib/python2.6/HTMLParser.py", line 115, in error
raise HTMLParseError(message, self.getpos())
HTMLParser.HTMLParseError: bad end tag: u"",

Any idea how this can be taken care of?The blog site must be creating
bad html..How do you deal with such a problem?
thanks
jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to retreive the body text alone of a webpage

2010-10-02 Thread ShawnMilo
Also, just to save you additional pain, do NOT install anything from
the 3.1 series. It's deprecated and had problems. You want 3.0.8.x.
According to the maintainer's site they're going to update the 3.0.8.x
series to the 3.2.x series to avoid confusion in the future.

http://pypi.python.org/pypi/BeautifulSoup/3.0.8.1

If you do a pip install it'll automatically download 3.1.
Background: http://www.crummy.com/software/BeautifulSoup/3.1-problems.html

However, once you get 3.0.8.x going you may become addicted
BeautifulSoup.

Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to retreive the body text alone of a webpage

2010-10-02 Thread Shawn Milochik
You can use BeautifulSoup to parse the page. That will result in a 
BeautifulSoup object from which you can get the text of any element.

Simple example:

soup = BeautifulSoup.BeautifulSoup(html_string)

#find a div with class 'header3' containing the text 'Locations'
location_header = soup.find('div', attrs = {'class': 'header3'}, text = 
'Locations')

#possibly suiting your purposes
body = soup.find('body')

body_length = len(body.text)


Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: how to retreive the body text alone of a webpage

2010-10-02 Thread bagheera

Dnia 02-10-2010 o 15:10:33 jimgardener  napisał(a):


hi
I am writing an application to find out if the body text of  a web
page of given url has been modified-added or removed.Is there some way
to find out the length of body text alone?
I wrote a function that can read and return the data length.But is
there some way I can read the body text alone ?The idea is to ignore
length change due to  tracking id etc that comes with the page and
take into account only the body text.

def get_page_data(url):
f=urllib.urlopen(url)
return len(f.read())

Any help appreciated
thanks
jim



Check BS
http://www.crummy.com/software/BeautifulSoup/

--
Linux user

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



how to retreive the body text alone of a webpage

2010-10-02 Thread jimgardener
hi
I am writing an application to find out if the body text of  a web
page of given url has been modified-added or removed.Is there some way
to find out the length of body text alone?
I wrote a function that can read and return the data length.But is
there some way I can read the body text alone ?The idea is to ignore
length change due to  tracking id etc that comes with the page and
take into account only the body text.

def get_page_data(url):
f=urllib.urlopen(url)
return len(f.read())

Any help appreciated
thanks
jim

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: View to edit many-to-many relationship with extra fields

2010-10-02 Thread Felix Dreissig
I'm not at all sure that this might help youm, so sorry if I write BS...

Can't you just use form prefixes to kepp the form namespaces seperated?
http://docs.djangoproject.com/en/1.2/ref/forms/api/#prefixes-for-forms

Regards,
Felix


On 01.10.2010 22:22, ses1984 wrote:
> http://docs.djangoproject.com/en/1.2/topics/db/models/#extra-fields-on-many-to-many-relationships
> 
> I have two models with a many-to-many relationship through another
> table with extra fields. In this case, I have one extra field which
> represents the weight of the relationship.
> 
> I'm working on a view to edit the relationships between the two
> models. If we call the two models left-hand-side and right-hand-side,
> then the view is specific to one instance of the LHS, and the purpose
> of the view is to add relationships from that LHS-row to an arbitrary
> number of pre-existing RHS-rows.
> 
> Writing a view that, given an instance of the LHS, adds a single
> weighted relationship to an element on the RHS is pretty trivial.
> Writing  view that adds an arbitrary number of relationships to the
> RHS is not that trivial, and that's what I would like to deliver to my
> users.
> 
> So far the view for a particular LHS-instance renders a page with a
> form to define a single additional relationship to the RHS. I have
> included a basic ajax function that GETs another form to the page.
> This is where the problem comes up: IDs of the form elements are going
> to overlap, and I won't be able to handle this when the form is
> POSTed.
> 
> I have thought of two options I could try to tackle this so far, both
> with javascript. The first would be to increment an index and send
> that through the ajax function to the view that returns a new form.
> The second would be to hook into the POST submission and munge the
> data before it's passed back to django to save model instances.
> 
> It seems to me that something like this, while not common, has to have
> been done before in web apps. I was wondering if there were some
> established patterns to do this sort of thing, and if I am on the
> right track. I have searched a few places including django snippets
> and packages to see if something like this has been done before, but I
> couldn't find anything. I'm not sure if I'm using the best search
> terms.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



AttributeError using with GAE

2010-10-02 Thread shwetanka
def addCategory(request):
user = users.get_current_user()
if users.is_current_user_admin():
if request.method == 'POST':
form = CategoryForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
Category.objects.create_category(cd['name'])
return HttpResponseRedirect('/admin/dashboard/')
else:
form = CategoryForm()
temdict = {'form': form, 'title': 'New Category'}
return render_to_response('new_category.html', temdict)
else:
return render_to_response('not_admin.html', {'admin': 'no'})
and this is my model models.py

class Category(db.Model):
catid = db.IntegerProperty(required=True)
name = db.StringProperty(required=True)

def get_absolute_url(self):
return "/tag/%s/" % str(self.catid)

class Meta:
verbose_name = 'Category'
When I'm running the code it shows:

Exception Type: AttributeError
Exception Value:
type object 'Category' has no attribute '_meta'
Exception Location: D:\shwetanka\projects\shwetanka\django\forms
\models.py in fields_for_model, line 166
Python Executable:  C:\Python26\pythonw.exe

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: django-friends | setup views.py with templates

2010-10-02 Thread appel268576
Hi.

I ma having the same problem.

Could you find any documentation on this?

On Sep 6, 10:13 pm, justin jools  wrote:
> Hi I have setup jtauber notification and friends apps but now I am
> stuck as to how to add views/urls to produce add friends/friends
> accept/friends list etc.
>
> please help me through the process
> thx
>
> On 6 Sep, 18:24, justin jools  wrote:
>
>
>
> > trying to setup simple social network
> > have installed: registration, profiles, accoutns, messages
>
> > but am stuck as how to setup/link the views.py to templates/
> > notification. I guess this is what is needed to be done.
>
> > Any help much appreciated

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: PyDev create new project wizard creates two folders in Aptana Studio 3?

2010-10-02 Thread payala

Check if you are in the python perspective

On 1 oct, 19:34, Brandon Taylor  wrote:
> Hi everyone,
>
> I'm used to organizing my Django projects in one folder for the
> project and then sub folders for app modules...
>
> /my_project
>     -__init__.py
>     -settings.py
>     /some_app
>
> and so on. However, when I create a new Django project using the PyDev
> wizard, I get:
>
> /my_project
>     /my_project
>         -__init__.py
>         -settings.py
>
> Why is that?
>
> TIA,
> Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django for internationalized sites - are models.User internationalized?

2010-10-02 Thread Torsten Bronger
Hallöchen!

Andy writes:

> [...]
>
>>> You mean you hope the field "email" is not allowed to contain
>>> non- English or non-European characters?
>>
>>> But real email addresses do contain those characters:
>>> http://en.wikipedia.org/wiki/Email_address#Internationalization
>>
>> I read "informal" and "experimental" there.
>
> Maybe, but I know people with real email addresses like that.

Just my opinion: Then they will have constant trouble with them, and
cause constant trouble to their contacts.  Let us first have
internationalised domain names gaining wide acception, *then* we can
think of internationlised email addresses.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django for internationalized sites - are models.User internationalized?

2010-10-02 Thread Andy

On Oct 2, 3:27 am, Torsten Bronger 
wrote:
> Hallöchen!
>
> Andy writes:
> > On Oct 2, 1:45 am, Torsten Bronger 
> > wrote:
>
> > Thanks for responding.
>
> >>> Are "first_name" & "last_name" limited to alphanumeric
> >>> characters or can they contain non-English characters like "ü"
> >>> or non-European characters like "黒"?
>
> >> Yes.
>
> > "Yes" is in "first_name" & "last_name" can contain non-English
> > characters like "ü" or non-European characters like "黒"?
>
> The latter.
>
> > [...]
>
> > You mean you hope the field "email" is not allowed to contain non-
> > English or non-European characters?
>
> > But real email addresses do contain those characters:
> >http://en.wikipedia.org/wiki/Email_address#Internationalization
>
> I read "informal" and "experimental" there.


Maybe, but I know people with real email addresses like that.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: [Announcement] Vim for Python and Django

2010-10-02 Thread Antoni Aloy
2010/10/2 David M. Besonen :
> On Sun, 26 Sep 2010 11:36:06 +0200
> Antoni Aloy  wrote:
>
>> http://code.google.com/p/trespams-vim/
>
> i assume you've seen Alain's webpage:
>  VIM as Python IDE
>  http://blog.dispatched.ch/2009/05/24/vim-as-python-ide/
>
Yes, Alain's makes me love VIM as a Python IDE:)

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django for internationalized sites - are models.User internationalized?

2010-10-02 Thread Torsten Bronger
Hallöchen!

Andy writes:

> On Oct 2, 1:45 am, Torsten Bronger 
> wrote:
>
> Thanks for responding.
>
>>> Are "first_name" & "last_name" limited to alphanumeric
>>> characters or can they contain non-English characters like "ü"
>>> or non-European characters like "黒"?
>>
>> Yes.
>
> "Yes" is in "first_name" & "last_name" can contain non-English
> characters like "ü" or non-European characters like "黒"?

The latter.

> [...]
>
> You mean you hope the field "email" is not allowed to contain non-
> English or non-European characters?
>
> But real email addresses do contain those characters:
> http://en.wikipedia.org/wiki/Email_address#Internationalization

I read "informal" and "experimental" there.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
   Jabber ID: torsten.bron...@jabber.rwth-aachen.de
  or http://bronger-jmp.appspot.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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.