view didn't return an HttpResponse object....plz help

2012-07-04 Thread rick

i want to filter roll no from database,but when i enter the number ,browser 
gives *view didn't return an HttpResponse object* this is my view..

def studentid(request):
if request.method == 'POST':
form = Student_loginForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
rollno = cd[rollno]
rollno = request.POST.get(rollno)
results = Add_record.objects.filter(Student_ID=rollno)
return 
HttpResponseRedirect(reverse('record_system.views.search' ,args=(results,)))
else:
form = Student_loginForm
return render_to_response('add_record/studentid.html', 
context_instance=RequestContext(request))


please help...
thanks in advance.

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



Re: Article Viewer / Better way to do this? / Suggestions Please

2012-07-04 Thread Barry Morrison
I built the model as I imagined how it should be. Looks like I can rework 
it to not need the pages model. Thanks for that! 

The .url is also fantastic! 

Much appreciated! 

Thanks.

On Wednesday, July 4, 2012 5:22:10 PM UTC-7, Nikolas Stevenson-Molnar wrote:
>
> Yes, pagination should get you what you want here. Using Django's 
> built-in pagination, you can drop your Page model completely (unless you 
> have a compelling reason to persist the page structure rather than 
> letting Django determine it for you on the fly). One additional note, 
> your Page.thumbnail_ method looks like something that would be better 
> suited in the template. Also, ImageField (and FileField) gives you a 
> handy "url" attribute. E.g: instead of constructing the path to the 
> image using thumbnail.name, you can do this (in a template): {{ 
> article.thumbnail.url }} 
>
> _Nik 
>
> On 7/4/2012 5:13 PM, Barry Morrison wrote: 
> > I have a bunch of press articles, these articles are basically 
> > thumbnails that open up to the pages of the articles. 
> > 
> > Here's what I've got so far. 
> > 
> > https://gist.github.com/0951804f4592c970b18b 
> > 
> > My thoughts are to use something like Django's pagination [1] 
> > https://docs.djangoproject.com/en/1.4/topics/pagination/ 
> > 
> > Is there a better way to do this??? 
> > 
> > Thanks! 
> > 
>
>
>

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



help

2012-07-04 Thread mwagdy
*welcome *
*
*
*
*
*
*
*i'm beginner  in Django developer   and i want a help *
*
*
*
*
*now i develop an event system *
*i want when clicked any  event name   *
*
*
*event detailed appear in another page *
**
*   in attachment a picture that will reveal my want*
*and also there is my code *

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



help.rar
Description: application/rar


Re: cannot access admin

2012-07-04 Thread Nikolas Stevenson-Molnar
One thing you might consider is using a prefix for article URLs so that 
you can more easily differentiate them from other URLs. For example:
r'^articles/(\S+)/(\S+)' . Then, rather than a URL like
/source-code/c++, you'd have /articles/source-code/c++.

_Nik

On 7/4/2012 5:59 PM, Scott Somers wrote:
> Yes, and this is a little embarrassing I was missing a line from the
> debugging output.
>
> |/home/tacobake/Source Code/Python
> (Komodo)/tacobakedotnet/../tacobakedotnet/dotnet_forms/views.py| in |home|
>
>58.
> article = Article.objects.get(menu__menu_title = menu, 
> article_title__startswith=item)  
>
>
> So that is where the word "Article" comes from in the earlier error
> message.
>
> Now having said that I believe it is the permissiveness of the \S+ \S+
> which may very well be what the problem is, I am going to change it
> but I need to learn a bit more first.  Basically I need the best way
> to pass a pair of options to the view function, which also just happen
> to be the URL, I was reading about it in the basic documentation for
> urls.  I do appreciate everyone's help.
>
> Like if I set it to:
>
> url(r'^source-code/(\S+)', ...) that is not dynamic enough for the
> view function, "Source Code" or source-code being the menu_title.
>
> On Wednesday, July 4, 2012 6:34:10 PM UTC-4, Tomas Neme wrote:
>
> On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  > wrote:
> > ah, got it... your
> >
> >  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),
> >
> > is too permisive
>
> ...
>
> maybe?
>
> -- 
> "The whole of Japan is pure invention. There is no such country,
> there
> are no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>
> -- 
> 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/-/b8SobMx4jtkJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: cannot access admin

2012-07-04 Thread Scott Somers
here we go I actually had a typo that slipped in, everything is working 
perfectly now thanks again to everyone.

urlpatterns = patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve', 
{'document_root': settings.MEDIA_ROOT }),
)

urlpatterns += patterns('',
url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'),   
 
url(r'^admin/', include(admin.site.urls)),  <--- had a $ here
url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),

On Wednesday, July 4, 2012 8:59:02 PM UTC-4, Scott Somers wrote:
>
> Yes, and this is a little embarrassing I was missing a line from the 
> debugging output.
>
> /home/tacobake/Source Code/Python 
> (Komodo)/tacobakedotnet/../tacobakedotnet/dotnet_forms/views.py in home
>
>1. 
>
>article = Article.objects.get(menu__menu_title = menu, 
> article_title__startswith=item)  
>
>
>
> So that is where the word "Article" comes from in the earlier error 
> message.
>
> Now having said that I believe it is the permissiveness of the \S+ \S+ 
> which may very well be what the problem is, I am going to change it but I 
> need to learn a bit more first.  Basically I need the best way to pass a 
> pair of options to the view function, which also just happen to be the URL, 
> I was reading about it in the basic documentation for urls.  I do 
> appreciate everyone's help.
>
> Like if I set it to:
>
> url(r'^source-code/(\S+)', ...) that is not dynamic enough for the view 
> function, "Source Code" or source-code being the menu_title.
>
> On Wednesday, July 4, 2012 6:34:10 PM UTC-4, Tomas Neme wrote:
>>
>> On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  
>> wrote: 
>> > ah, got it... your 
>> > 
>> >  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'), 
>> > 
>> > is too permisive 
>>
>> ... 
>>
>> maybe? 
>>
>> -- 
>> "The whole of Japan is pure invention. There is no such country, there 
>> are no such people" --Oscar Wilde 
>>
>> |_|0|_| 
>> |_|_|0| 
>> |0|0|0| 
>>
>> (\__/) 
>> (='.'=)This is Bunny. Copy and paste bunny 
>> (")_(") to help him gain world domination. 
>>
>

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



Re: cannot access admin

2012-07-04 Thread Scott Somers
Yes, and this is a little embarrassing I was missing a line from the 
debugging output.

/home/tacobake/Source Code/Python 
(Komodo)/tacobakedotnet/../tacobakedotnet/dotnet_forms/views.py in home

   1. 
   
   article = Article.objects.get(menu__menu_title = menu, 
article_title__startswith=item)  
   
   

So that is where the word "Article" comes from in the earlier error message.

Now having said that I believe it is the permissiveness of the \S+ \S+ 
which may very well be what the problem is, I am going to change it but I 
need to learn a bit more first.  Basically I need the best way to pass a 
pair of options to the view function, which also just happen to be the URL, 
I was reading about it in the basic documentation for urls.  I do 
appreciate everyone's help.

Like if I set it to:

url(r'^source-code/(\S+)', ...) that is not dynamic enough for the view 
function, "Source Code" or source-code being the menu_title.

On Wednesday, July 4, 2012 6:34:10 PM UTC-4, Tomas Neme wrote:
>
> On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  wrote: 
> > ah, got it... your 
> > 
> >  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'), 
> > 
> > is too permisive 
>
> ... 
>
> maybe? 
>
> -- 
> "The whole of Japan is pure invention. There is no such country, there 
> are no such people" --Oscar Wilde 
>
> |_|0|_| 
> |_|_|0| 
> |0|0|0| 
>
> (\__/) 
> (='.'=)This is Bunny. Copy and paste bunny 
> (")_(") to help him gain world domination. 
>

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



Re: Article Viewer / Better way to do this? / Suggestions Please

2012-07-04 Thread Nikolas Stevenson-Molnar
Yes, pagination should get you what you want here. Using Django's
built-in pagination, you can drop your Page model completely (unless you
have a compelling reason to persist the page structure rather than
letting Django determine it for you on the fly). One additional note,
your Page.thumbnail_ method looks like something that would be better
suited in the template. Also, ImageField (and FileField) gives you a
handy "url" attribute. E.g: instead of constructing the path to the
image using thumbnail.name, you can do this (in a template): {{
article.thumbnail.url }}

_Nik

On 7/4/2012 5:13 PM, Barry Morrison wrote:
> I have a bunch of press articles, these articles are basically
> thumbnails that open up to the pages of the articles.
>
> Here's what I've got so far.
>
> https://gist.github.com/0951804f4592c970b18b
>
> My thoughts are to use something like Django's pagination [1]
> https://docs.djangoproject.com/en/1.4/topics/pagination/
>
> Is there a better way to do this???
>
> 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Article Viewer / Better way to do this? / Suggestions Please

2012-07-04 Thread Barry Morrison
I have a bunch of press articles, these articles are basically
thumbnails that open up to the pages of the articles.

Here's what I've got so far.

https://gist.github.com/0951804f4592c970b18b

My thoughts are to use something like Django's pagination [1]
https://docs.djangoproject.com/en/1.4/topics/pagination/

Is there a better way to do this???

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



Re: Admin actions -- short_description as doc string?

2012-07-04 Thread Russell Keith-Magee
On Wed, Jul 4, 2012 at 8:21 PM, Roy Smith  wrote:
> I'm just staring to explore admin actions.  I'm surprised to see that you 
> have to set the description by doing:
>
> my_action_function.short_description = "blah"
>
> wouldn't it be cleaner to just declare a doc string for the action function 
> and have short_description grabbed from there?

No - because a docstring and a short description serve different
purposes. A docstring documents the purpose of the method. The
short_description is a label that can be used for display purposes --
a 'human readable' version of the method name.

For example:

def reset(…):
"Reset all the things to their original values"
….
reset.short_description = "Reset all the things"

Although you may often be able to compose a docstring that could also
serve as a short_description, it won't always be possible; hence, a
distinction is made so you can be explicit about exactly what you
want.

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



Re: cannot access admin

2012-07-04 Thread Nikolas Stevenson-Molnar
And actually, \S matches forward slashes, so even something like
/one/two/foo/bar would match.

_Nik

On 7/4/2012 3:40 PM, Nikolas Stevenson-Molnar wrote:
> Yes. \S+/\S+ will match /. Since /admin doesn't
> contain a slash (other than the leading slash, which isn't considered),
> it works fine. But /admin/whatever will get directed to your
> tacobakedotnet.dotnet_forms.views.home view because it matches the URL
> pattern. An easy fix would be to make sure your admin URL pattern comes
> first in the list.
>
> _Nik
>
> On 7/4/2012 3:34 PM, Tomas Neme wrote:
>> On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  wrote:
>>> ah, got it... your
>>>
>>>  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),
>>>
>>> is too permisive
>> ...
>>
>> maybe?
>>
>


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



Re: cannot access admin

2012-07-04 Thread Nikolas Stevenson-Molnar
Yes. \S+/\S+ will match /. Since /admin doesn't
contain a slash (other than the leading slash, which isn't considered),
it works fine. But /admin/whatever will get directed to your
tacobakedotnet.dotnet_forms.views.home view because it matches the URL
pattern. An easy fix would be to make sure your admin URL pattern comes
first in the list.

_Nik

On 7/4/2012 3:34 PM, Tomas Neme wrote:
> On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  wrote:
>> ah, got it... your
>>
>>  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),
>>
>> is too permisive
> ...
>
> maybe?
>


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



Re: cannot access admin

2012-07-04 Thread Tomas Neme
On Wed, Jul 4, 2012 at 7:33 PM, Tomas Neme  wrote:
> ah, got it... your
>
>  url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),
>
> is too permisive

...

maybe?

-- 
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: cannot access admin

2012-07-04 Thread Tomas Neme
ah, got it... your

 url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),

is too permisive

On Wed, Jul 4, 2012 at 6:54 PM, Scott Somers
 wrote:
>
> /Local Python Source Code/tacobakedotnet
> manage.py
> settings.py
> urls.py
> /Local Python Source Code/tacobakedotnet/media
> JavaScript files
> /Local Python Source Code/tacobakedotnet/dotnet_forms
> models.py
> tests.py
> views.py
> /Local Python Source Code/tacobakedotnet/dotnet_forms/static
> CSS files
>
> What it is having a hard time finding is
>
> So
>
> http://127.0.0.1:8000/source-code/c++ works
>
> and http://127.0.0.1:8000/admin/ actually works too
>
> But when I try and access anything inside the admin I get article not found.
>
> Now, and this might be interesting if I go 
> http://127.0.0.1:8000/admin/sfsdfdsfsfd just doing gibberish it gives me the 
> ArticleNotFound, as opposed to say 404, which it does if you do something 
> that violates urlconf.  So basically the database got corrupted somehow is 
> that what happened?
>
>
>
> On Wednesday, July 4, 2012 2:05:22 PM UTC-4, Melvyn Sopacua wrote:
>>
>> On 4-7-2012 19:18, Scott Somers wrote:
>>
>> > My urls
>> >
>> > urlpatterns = patterns('',
>> > (r'^media/(?P.*)$', 'django.views.static.serve', 
>> > {'document_root': settings.MEDIA_ROOT }),
>> > )
>> >
>> > urlpatterns += patterns('',
>> > url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'),
>> > url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),
>>
>> It looks like you have the project name in the view, which suggests the
>> current working directory of the project is one directory too high.
>> Could you show the directory layout, including the location of
>> settings.py, admin.py for the app and views.py.
>>
>> --
>> Melvyn Sopacua
>>
>>
> --
> 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/-/Z5X0qegeC44J.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.




--
"The whole of Japan is pure invention. There is no such country, there
are no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: cannot access admin

2012-07-04 Thread Scott Somers
/Local Python Source Code/tacobakedotnet
manage.py
settings.py
urls.py
/Local Python Source Code/tacobakedotnet/media
JavaScript files
/Local Python Source Code/tacobakedotnet/dotnet_forms
models.py
tests.py
views.py
/Local Python Source Code/tacobakedotnet/dotnet_forms/static
CSS files

What it is having a hard time finding is 

So

http://127.0.0.1:8000/source-code/c++ works

and http://127.0.0.1:8000/admin/ actually works too

But when I try and access anything inside the admin I get article not found.

Now, and this might be interesting if I go 
http://127.0.0.1:8000/admin/sfsdfdsfsfd 
just doing gibberish it gives me the ArticleNotFound, as opposed to say 
404, which it does if you do something that violates urlconf.  So basically 
the database got corrupted somehow is that what happened?



On Wednesday, July 4, 2012 2:05:22 PM UTC-4, Melvyn Sopacua wrote:
>
> On 4-7-2012 19:18, Scott Somers wrote: 
>
> > My urls 
> > 
> > urlpatterns = patterns('', 
> > (r'^media/(?P.*)$', 'django.views.static.serve', 
> {'document_root': settings.MEDIA_ROOT }), 
> > ) 
> > 
> > urlpatterns += patterns('', 
> > url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'), 
> > url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'), 
>
> It looks like you have the project name in the view, which suggests the 
> current working directory of the project is one directory too high. 
> Could you show the directory layout, including the location of 
> settings.py, admin.py for the app and views.py. 
>
> -- 
> Melvyn Sopacua 
>
>
>

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



Re: migration via south for inheritance change -> please help

2012-07-04 Thread Tomas Neme
By the way, if you do that, and I'm not crazy, you won't need to do any
migration with south, since the Foo and Bar tables would both have all of
base's columns (because Base is abstract).

If Base can't be abstract (if you want Base instances that are neither Foo
nor Bar), then you'll have to do this:

First, create the Base class, without changing Foo or Bar. Create a south
migration for this

Second, create a south Data Migration, copy all the data over on that
migration from Foo and Bar to Base instances

Third, modify Foo and Bar, and create migrations for this

On Wed, Jul 4, 2012 at 5:29 PM, Tomas Neme  wrote:

> You'll have to migrate your data manually in your migration, yes.
>
> Besides that, if you don't want actual Base instances, then this is an
> abstract class, and you should do this:
>
> class Base(models.Model):
> eggs
> plants
> class Meta:
> abstract=True
>
> class Foo(Base):
> carpet=
>
> class Bar(Base):
> car=
>
>
> On Wed, Jul 4, 2012 at 5:18 PM, Lachlan Musicman 
> wrote:
> > I'd like to know this too - but I think the real answer is "get better
> > at python" - you are essentially (from what I can tell) in a django
> > shell when south pops the "not blank, not null but no data" error -
> > try pulling in some details from fixtures?
> >
> > cheers
> > L.
> >
> > On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz  wrote:
> >> ...no one?
> >>
> >> regards, mcJack
> >>
> >> 2012/7/2 mcJack :
> >>> Hi all,
> >>>
> >>> I've got a problem migrating some changes in the model, so I tried to
> solve
> >>> it with south.
> >>> The situation:
> >>> I implemented two classes, which share some functionality. Now that I
> >>> improved a little with python, django and co. I wanted to use
> inheritance
> >>> for that issue.
> >>> The model looks like this:
> >>>
> >>> class Foo(models.Model):
> >>> eggs = models.TextField( null=True, blank=True )
> >>> plants = models.TextField( null=True, blank=True )
> >>> carpet = models.IntegerField()
> >>>
> >>> class Bar(models.Model):
> >>> eggs = models.TextField( null=True, blank=True )
> >>> plants = models.TextField( null=True, blank=True )
> >>> car = models.IntegerField()
> >>>
> >>>
> >>> And obviously I want to transform to:
> >>> class Base(models.Model):
> >>> eggs = models.TextField( null=True, blank=True )
> >>> plants = models.TextField( null=True, blank=True )
> >>>
> >>> class Foo(models.Model):
> >>> base = models.OneToOneField( 'Base', parent_link=True )
> >>> carpet = models.IntegerField()
> >>>
> >>> class Bar(models.Model):
> >>> base = models.OneToOneField( 'Base', parent_link=True )
> >>> car = models.IntegerField()
> >>>
> >>> But how can I tell south to fill the super class with the data from
> the old
> >>> schema?
> >>>
> >>> Can I add this information manually in the created migration script?
> or is
> >>> there an option/switch I didn't notice?
> >>>
> >>> Any hints are very welcome, thanks a lot
> >>>
> >>> mcJack
> >>>
> >>> --
> >>> 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/-/_6CYJ1yqh-sJ.
> >>> To post to this group, send email to django-users@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> django-users+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/django-users?hl=en.
> >>
> >>
> >>
> >> --
> >> Daniel Walz - mcj...@gmail.com
> >> Bremen, Germany
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> >> For more 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+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
>
>
> --
> "The whole of Japan is pure invention. There is no such country, there are
> no such people" --Oscar Wilde
>
> |_|0|_|
> |_|_|0|
> |0|0|0|
>
> (\__/)
> (='.'=)This is Bunny. Copy and paste bunny
> (")_(") to help him gain world domination.
>



-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

-- 
You received this message because you 

RE: migration via south for inheritance change -> please help

2012-07-04 Thread Demian Brecht
I'm not a South expert, but I'd assume you'd do this via south data
migrations
(http://south.readthedocs.org/en/latest/tutorial/part3.html#data-migrations)
.

You'd create:
- One (auto) migration script to create the Base table and new columns in
Foo and Bar
- A data migration script to migrate the current data set from Foo and Bar
into Base and fill in the OneToOneField keys accordingly
- A final (auto) migration script to remove the transferred fields from Foo
and Bar

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
On Behalf Of Lachlan Musicman
Sent: Wednesday, July 04, 2012 1:18 PM
To: django-users@googlegroups.com
Subject: Re: migration via south for inheritance change -> please help

I'd like to know this too - but I think the real answer is "get better at
python" - you are essentially (from what I can tell) in a django shell when
south pops the "not blank, not null but no data" error - try pulling in some
details from fixtures?

cheers
L.

On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz  wrote:
> ...no one?
>
> regards, mcJack
>
> 2012/7/2 mcJack :
>> Hi all,
>>
>> I've got a problem migrating some changes in the model, so I tried to 
>> solve it with south.
>> The situation:
>> I implemented two classes, which share some functionality. Now that I 
>> improved a little with python, django and co. I wanted to use 
>> inheritance for that issue.
>> The model looks like this:
>>
>> class Foo(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> car = models.IntegerField()
>>
>>
>> And obviously I want to transform to:
>> class Base(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>>
>> class Foo(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> car = models.IntegerField()
>>
>> But how can I tell south to fill the super class with the data from 
>> the old schema?
>>
>> Can I add this information manually in the created migration script? 
>> or is there an option/switch I didn't notice?
>>
>> Any hints are very welcome, thanks a lot
>>
>> mcJack
>>
>> --
>> 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/-/_6CYJ1yqh-sJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> Daniel Walz - mcj...@gmail.com
> Bremen, Germany
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more 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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: mysqldb help! Can't connect to MySQL server error...

2012-07-04 Thread Matthew Piatkowski
mdsmoke, do yourself a favor. You have exposed your password and the user 
name of your db; change your password.  Also, best practices for using 
databases, is create an administrative login insead of using 'root'.  Its 
much easier for a nasty malicious person or organisation to guess (root) 
than it is for them to guess a random 'user name' 

As far as your topic issue, I'm not sure.  I have the same issue.  I'll let 
you know when I figure this out too.  

On Sunday, August 2, 2009 9:16:49 PM UTC-4, mdsmoker wrote:
>
> when running python manage.py syncdb I got the following errors... 
>
> C:\DJANGO~1\mysite>python manage.py syncdb 
> Traceback (most recent call last): 
>   File "manage.py", line 11, in  
> execute_manager(settings) 
>   File "c:\django-trunk\django\core\management\__init__.py", line 362, 
> in execut 
> e_manager 
> utility.execute() 
>   File "c:\django-trunk\django\core\management\__init__.py", line 303, 
> in execut 
> e 
> self.fetch_command(subcommand).run_from_argv(self.argv) 
>   File "c:\django-trunk\django\core\management\base.py", line 195, in 
> run_from_a 
> rgv 
> self.execute(*args, **options.__dict__) 
>   File "c:\django-trunk\django\core\management\base.py", line 221, in 
> execute 
> self.validate() 
>   File "c:\django-trunk\django\core\management\base.py", line 249, in 
> validate 
> num_errors = get_validation_errors(s, app) 
>   File "c:\django-trunk\django\core\management\validation.py", line 
> 67, in get_v 
> alidation_errors 
> connection.validation.validate_field(e, opts, f) 
>   File "c:\django-trunk\django\db\backends\mysql\validation.py", line 
> 15, in val 
> idate_field 
> db_version = connection.get_server_version() 
>   File "c:\django-trunk\django\db\backends\mysql\base.py", line 297, 
> in get_serv 
> er_version 
> self.cursor() 
>   File "c:\django-trunk\django\db\backends\__init__.py", line 81, in 
> cursor 
> cursor = self._cursor() 
>   File "c:\django-trunk\django\db\backends\mysql\base.py", line 281, 
> in _cursor 
> self.connection = Database.connect(**kwargs) 
>   File "C:\Python25\lib\site-packages\MySQLdb\__init__.py", line 74, 
> in Connect 
> return Connection(*args, **kwargs) 
>   File "C:\Python25\lib\site-packages\MySQLdb\connections.py", line 
> 170, in __in 
> it__ 
> super(Connection, self).__init__(*args, **kwargs2) 
> _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL 
> server on 'lo 
> calhost' (10061)") 
>
> I have mysqldb 1.2.2 installed w/out errors.  I think I'm just missing 
> something pretty simple.  If it helps, this is what my settings.py 
> looks like... 
>
> DATABASE_ENGINE = 'mysql'   # 'postgresql_psycopg2', 
> 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
> DATABASE_NAME = 'mysitedb' # Or path to database file if 
> using sqlite3. 
> DATABASE_USER = 'root' # Not used with sqlite3. 
> DATABASE_PASSWORD = 'blue33' # Not used with sqlite3. 
> DATABASE_HOST = '' # Set to empty string for localhost. 
> Not used with sqlite3. 
> DATABASE_PORT = '3036' # Set to empty string for default. 
> Not used with sqlite3. 
>

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



Re: migration via south for inheritance change -> please help

2012-07-04 Thread Tomas Neme
You'll have to migrate your data manually in your migration, yes.

Besides that, if you don't want actual Base instances, then this is an
abstract class, and you should do this:

class Base(models.Model):
eggs
plants
class Meta:
abstract=True

class Foo(Base):
carpet=

class Bar(Base):
car=

On Wed, Jul 4, 2012 at 5:18 PM, Lachlan Musicman  wrote:
> I'd like to know this too - but I think the real answer is "get better
> at python" - you are essentially (from what I can tell) in a django
> shell when south pops the "not blank, not null but no data" error -
> try pulling in some details from fixtures?
>
> cheers
> L.
>
> On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz  wrote:
>> ...no one?
>>
>> regards, mcJack
>>
>> 2012/7/2 mcJack :
>>> Hi all,
>>>
>>> I've got a problem migrating some changes in the model, so I tried to
solve
>>> it with south.
>>> The situation:
>>> I implemented two classes, which share some functionality. Now that I
>>> improved a little with python, django and co. I wanted to use
inheritance
>>> for that issue.
>>> The model looks like this:
>>>
>>> class Foo(models.Model):
>>> eggs = models.TextField( null=True, blank=True )
>>> plants = models.TextField( null=True, blank=True )
>>> carpet = models.IntegerField()
>>>
>>> class Bar(models.Model):
>>> eggs = models.TextField( null=True, blank=True )
>>> plants = models.TextField( null=True, blank=True )
>>> car = models.IntegerField()
>>>
>>>
>>> And obviously I want to transform to:
>>> class Base(models.Model):
>>> eggs = models.TextField( null=True, blank=True )
>>> plants = models.TextField( null=True, blank=True )
>>>
>>> class Foo(models.Model):
>>> base = models.OneToOneField( 'Base', parent_link=True )
>>> carpet = models.IntegerField()
>>>
>>> class Bar(models.Model):
>>> base = models.OneToOneField( 'Base', parent_link=True )
>>> car = models.IntegerField()
>>>
>>> But how can I tell south to fill the super class with the data from the
old
>>> schema?
>>>
>>> Can I add this information manually in the created migration script? or
is
>>> there an option/switch I didn't notice?
>>>
>>> Any hints are very welcome, thanks a lot
>>>
>>> mcJack
>>>
>>> --
>>> 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/-/_6CYJ1yqh-sJ.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>> --
>> Daniel Walz - mcj...@gmail.com
>> Bremen, Germany
>>
>> --
>> You received this message because you are subscribed to the Google
Groups "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
>> For more 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>



-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: migration via south for inheritance change -> please help

2012-07-04 Thread Lachlan Musicman
I'd like to know this too - but I think the real answer is "get better
at python" - you are essentially (from what I can tell) in a django
shell when south pops the "not blank, not null but no data" error -
try pulling in some details from fixtures?

cheers
L.

On Thu, Jul 5, 2012 at 2:30 AM, Daniel Walz  wrote:
> ...no one?
>
> regards, mcJack
>
> 2012/7/2 mcJack :
>> Hi all,
>>
>> I've got a problem migrating some changes in the model, so I tried to solve
>> it with south.
>> The situation:
>> I implemented two classes, which share some functionality. Now that I
>> improved a little with python, django and co. I wanted to use inheritance
>> for that issue.
>> The model looks like this:
>>
>> class Foo(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>> car = models.IntegerField()
>>
>>
>> And obviously I want to transform to:
>> class Base(models.Model):
>> eggs = models.TextField( null=True, blank=True )
>> plants = models.TextField( null=True, blank=True )
>>
>> class Foo(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> carpet = models.IntegerField()
>>
>> class Bar(models.Model):
>> base = models.OneToOneField( 'Base', parent_link=True )
>> car = models.IntegerField()
>>
>> But how can I tell south to fill the super class with the data from the old
>> schema?
>>
>> Can I add this information manually in the created migration script? or is
>> there an option/switch I didn't notice?
>>
>> Any hints are very welcome, thanks a lot
>>
>> mcJack
>>
>> --
>> 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/-/_6CYJ1yqh-sJ.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
>
> --
> Daniel Walz - mcj...@gmail.com
> Bremen, Germany
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: custom500 page does not show up ?

2012-07-04 Thread Nikhil Verma
Hi Melvyn,


The interesting thing is 404.html is working but not 500.html.
In settings paths are dynamically set. Also i am receiving the error
messages on my email as i am the admin.
Let say there is some syntax error so in the email it will give me
information about that but without displaying 500 page.

I am  amazed then why 404 is working.


On Wed, Jul 4, 2012 at 11:28 PM, Melvyn Sopacua wrote:

> On 4-7-2012 19:08, Nikhil Verma wrote:
> > Hi Melvyn
> >
> >
> >
> > [ ] Make sure your custom page is not sent with tools like netcat,
> > telnet or curl.
> >
> > i did not turn anything its a simple custom page.
>
> Sorry I worded that rather bad. Your goal is to connect to the page that
> triggers a 500 error with one of the tools I mentioned so you can see
> the actual response, not what your browser shows you as the browser
> could be showing you it's own "server error" page.
>
> > [ ] Make sure your custom page is not generating a 500 error by itself
> >
> > {% extends 'base.html' %}
> >
> > {% block title %}
> > 500 - Server Error
> > {% endblock %}
> >
> > {% block content %}
> > Sorry, there was an error
> >
> > 
> > 
> > We've encountered a problem.
> > 
> > 
> >
> > 
> > We apologize for any inconvenience this has caused you.
> > Citysom is undergoing constant improvement.
> > We hope that you will not have problems in the future.
> > 
> > 
> > 
> > {% endblock %}
>
> Of course, you can still have the error in base.html.
>
> > [ ] If the logger has been turned off, turn it back on and read the
> > email sent to the admin address.
> >
> > I have not put any log.
>
> See settings.py, the bottom part. If debug is set to 'off', 500 errors
> are mailed to the DJANGO_ADMIN.
>
> > The interesting part is everything is working properly in my local
> machine.
>
> [ ] Make sure that absolute paths in settings.py point to actual
> directories on the production server.
> --
> Melvyn Sopacua
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Re: install a new model in my project

2012-07-04 Thread Tomas Neme
> (django_multiuploader), and i write in INSTALLED_APPS 'sorl.thumbnail',
> 'multiuploader',  then i execute manager.py runserver  and return "Error: No
> module named multiuploader"   I dont understand how make a link for this
> module.

*How* did you install it? are you using pip and a virtualenv?


--
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: problem with django model method save()

2012-07-04 Thread Tomas Neme
I don't see why wouldn't your model's .save() work, maybe we'd need to see
the model code, but I know you probably want to read this:

https://docs.djangoproject.com/en/dev/topics/forms/modelforms/

once you've implemented a ModelForm, you'd pretty much would just do

form = RoomForm(request.POST)
if form.is_valid():
  form.save()

On Wed, Jul 4, 2012 at 3:58 PM, rafiee.nima  wrote:
> Hi Im some how new to django . I write a view to handle ajax request
> but I find out that save() method dose not save model instance in to the
> database
> here is my code
>
> def add_room(request):
> context={}
> status=''
> if request.is_ajax:
> if request.POST:
> hotel_instance=Hotel.objects.get(id=request.POST['hotel'])
> room_id=int(request.POST['id'])
> if room_id > 0 :
> room=HotelRoom.objects.get(id=request.POST['id'])
> room.hotel=hotel_instance
> room.number=request.POST['number']
> room.bed_count=request.POST['bed_count']
> room.ground_sleep=request.POST['ground_sleep']
> room.view=request.POST['view']
> room.reserved=request.POST['reserved']
> room.tv=request.POST['tv'].capitalize()
> room.phone=request.POST['phone']
> room.refrigerator=request.POST['refrigerator']
> room.air_condition=request.POST['air_condition']
> room.toilet=request.POST['toilet']
> room.creator=request.user
> room.save()
> room_json=model_to_dict(room)
> status="room successfully updated"
> else:
> room = HotelRoom(
> hotel=hotel_instance,
> number=request.POST['number'],
> bed_count=request.POST['bed_count'],
> ground_sleep=request.POST['ground_sleep'],
> view=request.POST['view'],
> reserved=request.POST['reserved'],
> tv=request.POST['tv'],
> phone=request.POST['phone'],
> refrigerator=request.POST['refrigerator'],
> air_condition=request.POST['air_condition'],
> toilet=request.POST['toilet'],
> creator=request.user )
> room.save()
> status="new room successfully added "
> raw_data={'status':status,'data':room_json}
> data=simplejson.dumps(raw_data)
> return HttpResponse(data, mimetype="application/json")
>
> --
> 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/-/Q3kHTKx-BX4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



problem with django model method save()

2012-07-04 Thread rafiee.nima
Hi Im some how new to django . I write a view to handle ajax request
but I find out that save() method dose not save model instance in to the 
database
here is my code 

def add_room(request):
context={}
status=''
if request.is_ajax:
if request.POST:
hotel_instance=Hotel.objects.get(id=request.POST['hotel'])
room_id=int(request.POST['id'])
if room_id > 0 :
room=HotelRoom.objects.get(id=request.POST['id'])
room.hotel=hotel_instance
room.number=request.POST['number']
room.bed_count=request.POST['bed_count']
room.ground_sleep=request.POST['ground_sleep']
room.view=request.POST['view']
room.reserved=request.POST['reserved']
room.tv=request.POST['tv'].capitalize()
room.phone=request.POST['phone']
room.refrigerator=request.POST['refrigerator']
room.air_condition=request.POST['air_condition']
room.toilet=request.POST['toilet']
room.creator=request.user
room.save()
room_json=model_to_dict(room)
status="room successfully updated"
else:
room = HotelRoom(
hotel=hotel_instance,
number=request.POST['number'],
bed_count=request.POST['bed_count'],
ground_sleep=request.POST['ground_sleep'],
view=request.POST['view'],
reserved=request.POST['reserved'],
tv=request.POST['tv'],
phone=request.POST['phone'],
refrigerator=request.POST['refrigerator'],
air_condition=request.POST['air_condition'],
toilet=request.POST['toilet'],
creator=request.user )
room.save()
status="new room successfully added "
raw_data={'status':status,'data':room_json}
data=simplejson.dumps(raw_data)
return HttpResponse(data, mimetype="application/json")

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



Problem to complète the xml template

2012-07-04 Thread nef
Hello,
I want to cry a function allowing me to complete a template *. Xml. May I 
have a problem with the passage of the object render_to_response. In short 
here is my code. In fact, I do not know how to return an object that can 
permattre me to complete my template automatically.
I am using django 1.1 and Python 2.6
Function writes to the file views.py

def main_formation(request, formation_id):
formations = Formation.objects.get(id=formation_id)
variables = RequestContext(request, {
'formations': formations
})
return render_to_response('saisie/formation.xml', variables)

This is mu xml template


http://cdm-fr.fr/2006/CDM-frSchema; 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation="http://cdm-fr.fr/2006/CDM-frSchema 
http://cdm-fr.fr/2006/schemas/CDM-fr.xsd; language="fr-FR">
  {% if formations %}
   


{{ formation.ville }}
{{ formation.pays }}

 

  {% endif %}

Thanks for your help.

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



Re: cannot access admin

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 19:18, Scott Somers wrote:

> My urls
> 
> urlpatterns = patterns('',
> (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': 
> settings.MEDIA_ROOT }),
> )
> 
> urlpatterns += patterns('',
> url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'),
> url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),

It looks like you have the project name in the view, which suggests the
current working directory of the project is one directory too high.
Could you show the directory layout, including the location of
settings.py, admin.py for the app and views.py.

-- 
Melvyn Sopacua


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



Re: custom500 page does not show up ?

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 19:08, Nikhil Verma wrote:
> Hi Melvyn
> 
> 
> 
> [ ] Make sure your custom page is not sent with tools like netcat,
> telnet or curl.
> 
> i did not turn anything its a simple custom page.

Sorry I worded that rather bad. Your goal is to connect to the page that
triggers a 500 error with one of the tools I mentioned so you can see
the actual response, not what your browser shows you as the browser
could be showing you it's own "server error" page.

> [ ] Make sure your custom page is not generating a 500 error by itself
> 
> {% extends 'base.html' %}
> 
> {% block title %}
> 500 - Server Error
> {% endblock %}
> 
> {% block content %}
> Sorry, there was an error
> 
> 
> 
> We've encountered a problem.
> 
> 
> 
> 
> We apologize for any inconvenience this has caused you.
> Citysom is undergoing constant improvement.
> We hope that you will not have problems in the future.
> 
> 
> 
> {% endblock %}

Of course, you can still have the error in base.html.

> [ ] If the logger has been turned off, turn it back on and read the
> email sent to the admin address.
> 
> I have not put any log.

See settings.py, the bottom part. If debug is set to 'off', 500 errors
are mailed to the DJANGO_ADMIN.

> The interesting part is everything is working properly in my local machine.

[ ] Make sure that absolute paths in settings.py point to actual
directories on the production server.
-- 
Melvyn Sopacua


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



install a new model in my project

2012-07-04 Thread dhararon
Hi,  my problem is that i when try to install a model, in this case 
is (django_multiuploader), and i write in INSTALLED_APPS 
'sorl.thumbnail', 'multiuploader',  then i execute manager.py runserver 
 and return "Error: No module named multiuploader"   I dont understand how 
make a link for this module.

thanks

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



RE: cannot access admin

2012-07-04 Thread lacrymol...@gmail.com
Are you running admin.autodiscover? Does the admin homepage (/admin/) show your 
apps?


-Mensaje original-
De: Scott Somers
Enviados:  04/07/2012 14:18:45
Asunto:  cannot access admin

So I don't normally spam forums/ mailing lists etc for help but I really 
screwed something up.  Basically when I try and access my admin site, for 
example:

DoesNotExist at /admin/auth/group/

Article matching query does not exist.

DoesNotExist at /admin/dotnet_forms/article/

Article matching query does not exist.

My urls

urlpatterns = patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': 
settings.MEDIA_ROOT }),
)

urlpatterns += patterns('',
url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'),
url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),

# Uncomment the next line to enable the admin:
url(r'^admin/$', include(admin.site.urls)),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
)

The website itself does work so the articles and things stored in the database 
are still there.  I just cannot access them.

I am asking because it seems like a technical problem of some sort.

I did add to settings.py but I don't think I changed anything.

This doesn't work either although the article is there when I pull it up inside 
the website.

DoesNotExist at /admin/dotnet_forms/article/12/

Article matching query does not exist.

So basically it seems like some kind of urlconf problem.

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



Re: Use regular expression to retrieve all image tags from a given content

2012-07-04 Thread Tim Chase
On 07/04/12 08:30, Melvyn Sopacua wrote:
> On 4-7-2012 3:03, Tim Chase wrote:
>>  [snip Tim's obscene regex]
> 
> Aside from the \b matching positive against ><,

I'm not sure I follow...the \b just requires that a word-boundary
occur there, preventing it from matching something like "imgood".
It might even be vestigial as I originally had "*" rather than "+"
for the whitespace before attributes, so it could likely be removed
now without impacting the regexp.

> My main beef with modern software is that for the simplest of things one
> flees to full-blown libraries which happen to provide some utilities,
> but the other 98% of the code from that library is unused. Case in
> point, PIL to verify if a file is an image. But my rant alarm went off. :)

I've done enough work where pathological client/user data comes
through that I swear sometimes they're TRYING to break the app.
Like the person who uploaded an Excel file with a .jpg extension to
try and post the contained graph (re. your PIL image-detection comment).

So it all boils down the use case, and how much work you want to
spend maintaining it every time it breaks.  If security is involved,
I want the best-tested library I can get so I don't have to make all
their mistakes myself.  If it's just a dirty "get me adequate data
as fast as possible" (especially if it's a one-off for a single
data-source), then I'll often just hammer it out using whatever is
easiest.

> But the author I replied to did.

Ah.  I was looking for a 2nd post in the thread from the OP ("Mo
Mughrabi") and didn't see anything.  At least via gmane where I read
the list.

> I think you and I are on the same page.
> Either way, the OP now has some nice examples of how to /refine/ regular
> expressions and that's the real craft :).

Amen!  :-)

-tim



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



Re: Testing with LiveServerTestCase and Selenium

2012-07-04 Thread Paul Childs
I thought it might be a good idea to remove Django testing from the 
equation by opening up an IPython session and executing the following:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get("http://www.microsoft.com/;)
browser.title
'' # empty string

The the same thing is happening with just the webdriver alone.

The company I work for has McAffee installed on my machine. Could it be 
blocking automated browser activity?

On Saturday, June 30, 2012 8:39:54 AM UTC-3, Rafael Durán Castañeda wrote:
>
> El 28/06/12 15:45, Paul Childs escribi�: 
> > Hello, 
> > I'm using Django 1.4 and was really excited to learn about the new 
> > testing features. I am totally new to this. 
> > I seem to have hit a bump in the road. If I overcome this I'm hopeful 
> > it will be smooth sailing and I will experience some great testing 
> > goodness. 
> > I've been mucking around with this all morning and I can't seem to get 
> > the selenium Firefox webdriver to navigate to the given URL. 
> > 
> > I have read the docs: 
> > 
> https://docs.djangoproject.com/en/1.4/topics/testing/#django.test.LiveServerTestCase
>  
> > 
> > and read this tutorial 
> > http://www.tdd-django-tutorial.com/tutorial/1/ 
> > and tried to run the test code that they suggest. 
> > 
> > When I run the very simple test: 
> > 
> > from django.test import LiveServerTestCase 
> > from selenium import webdriver 
> > 
> > class MySeleniumTests(LiveServerTestCase): 
> > fixtures = ['lookups_security.json'] 
> > 
> > def setUp(self): 
> > self.browser = webdriver.Firefox() 
> > 
> > def tearDown(self): 
> > self.browser.quit() 
> > 
> > def test_login(self): 
> > # Gertrude opens her web browser, and goes to the admin page 
> > self.browser.get(self.live_server_url + '/admin/login/') 
> > 
> > # She sees the familiar 'Django administration' heading 
> > body = self.browser.find_element_by_tag_name('body') 
> > self.assertIn('CISSIMP Admin', body.text) 
> > 
> > A blank Firefox browser pops up, sits there and then closes. 
> > 
> > The test output is: 
> > 
> > (sitar_env2) C:\virtual_env\sitar_env2\cissimp>python manage.py test 
> > --liveserver=localhost:8082 sitar 
> > Creating test database for alias 'default'... 
> > E 
> > == 
> > ERROR: test_login (sitar.tests.MySeleniumTests) 
> > -- 
> > Traceback (most recent call last): 
> >   File "C:\virtual_env\sitar_env2\cissimp\sitar\tests.py", line 54, in 
> > test_login 
> > self.assertIn('CISSIMP Admin', body.text) 
> > AttributeError: 'NoneType' object has no attribute 'text' 
> > 
> > -- 
> > Ran 1 test in 22.546s 
> > 
> > FAILED (errors=1) 
> > Destroying test database for alias 'default'... 
> > 
> > It seems obvious that the browser is not navigating to the URL I want 
> > so the code is trying to get a reference to an non-existent body tag. 
> > 
> > Can anyone see what I am doing wrong? 
> > 
> > Thanks 
> > /Paulr 
> > -- 
> > 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/-/jh47T9WA7QkJ. 
> > To post to this group, send email to django-users@googlegroups.com. 
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com. 
> > For more options, visit this group at 
> > http://groups.google.com/group/django-users?hl=en. 
>
> The error is quite obvious, body is None and thus it doesn't have 'text' 
> attribute, why body is None is not so obvious since I think selenium 
> should raise NoSuchElementExceptionif it can't find the body tag, no 
> tjust returning None. When you manually browse the url, what do you get? 
> is the body tag there or are your getting a blank page? 
>

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



cannot access admin

2012-07-04 Thread Scott Somers
So I don't normally spam forums/ mailing lists etc for help but I really 
screwed something up.  Basically when I try and access my admin site, for 
example:

DoesNotExist at /admin/auth/group/

Article matching query does not exist.

DoesNotExist at /admin/dotnet_forms/article/

Article matching query does not exist.

My urls

urlpatterns = patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': 
settings.MEDIA_ROOT }),
)

urlpatterns += patterns('',
url(r'^$', 'tacobakedotnet.dotnet_forms.views.home'),
url(r'^(\S+)/(\S+)', 'tacobakedotnet.dotnet_forms.views.home'),

# Uncomment the next line to enable the admin:
url(r'^admin/$', include(admin.site.urls)),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
)

The website itself does work so the articles and things stored in the database 
are still there.  I just cannot access them.

I am asking because it seems like a technical problem of some sort.

I did add to settings.py but I don't think I changed anything.

This doesn't work either although the article is there when I pull it up inside 
the website.

DoesNotExist at /admin/dotnet_forms/article/12/

Article matching query does not exist.

So basically it seems like some kind of urlconf problem.

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



Re: custom500 page does not show up ?

2012-07-04 Thread Nikhil Verma
Hi Melvyn



[ ] Make sure your custom page is not sent with tools like netcat,
telnet or curl.

i did not turn anything its a simple custom page.

[ ] Make sure your custom page is not generating a 500 error by itself

{% extends 'base.html' %}

{% block title %}
500 - Server Error
{% endblock %}

{% block content %}
Sorry, there was an error



We've encountered a problem.




We apologize for any inconvenience this has caused you.
Citysom is undergoing constant improvement.
We hope that you will not have problems in the future.



{% endblock %}

[ ] If the logger has been turned off, turn it back on and read the
email sent to the admin address.

I have not put any log.

The interesting part is everything is working properly in my local machine.

Thanks for help.


On Wed, Jul 4, 2012 at 9:28 PM, Melvyn Sopacua wrote:

> On 4-7-2012 5:21, Nikhil Verma wrote:
> > HI All
> >
> > I have made a custom and a very simple 500.html page. However when i make
> > debug=False and some error come in website
> > still it show basic server error message.
> >
> > "A server error has occurred.Please contact the administrator"
> >
> > I want whenever there is some error it should show my custom 500 page.
>
> Your checklist:
> [ ] Make sure your custom page is not sent with tools like netcat,
> telnet or curl.
> [ ] Make sure your custom page is not generating a 500 error by itself
> [ ] If the logger has been turned off, turn it back on and read the
> email sent to the admin address.
>
>
> --
> Melvyn Sopacua
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards
Nikhil Verma
+91-958-273-3156

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



Re: how to save response 's render file to server or email using httpresponse

2012-07-04 Thread Nikolas Stevenson-Molnar
I stand corrected ;)

_Nik

On 7/4/2012 8:37 AM, Melvyn Sopacua wrote:
> On 3-7-2012 20:32, Nikolas Stevenson-Molnar wrote:
>> Oh, and HttpResponse is intended to send data back to a web browser. I
>> can't think of any reason you would use an HttpResponse when sending an
>> email.
> To mail yourself (parts of) the response object from middleware as part
> of auditing and/or tracing down elusive errors.
>


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



Forms for updating a compound model

2012-07-04 Thread yak-man
Have a look at this section and seder if it helps:

 
https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#using-a-subset-of-fields-on-the-form

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



Re: custom500 page does not show up ?

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 5:21, Nikhil Verma wrote:
> HI All
> 
> I have made a custom and a very simple 500.html page. However when i make
> debug=False and some error come in website
> still it show basic server error message.
> 
> "A server error has occurred.Please contact the administrator"
> 
> I want whenever there is some error it should show my custom 500 page.

Your checklist:
[ ] Make sure your custom page is not sent with tools like netcat,
telnet or curl.
[ ] Make sure your custom page is not generating a 500 error by itself
[ ] If the logger has been turned off, turn it back on and read the
email sent to the admin address.


-- 
Melvyn Sopacua


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



Re: Super slow authentication

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 1:57, Ali Mesdaq wrote:
> Hey everyone,
> 
> I got a situation where I have SUPER slow authentication like approx 5min
> to authenticate with both LDAP and default authentication mechanisms.

LDAP authentication for what exactly? Django doesn't come with an
LDAP-based authentication system.

> So
> my issue is two parts first is why and how is my authentication so slow?

No clue. Connection timeouts are the like candidate but since you're not
providing a whole of information to go on...

> Second is now I am having some remote users timeout on their
> authentication which was not happening before but is happening now.

Again, authenticating against what?
-- 
Melvyn Sopacua


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



Re: map in django

2012-07-04 Thread yak-man
You might try browsing these:

 http://pyvideo.org/search?models=videos.video=making+maps

http://inzane.net

The code from Zain's US PyCon2012 tutorial on making interaxtive maps is also 
in his github repositories - you might find that interesting.

Have lots of fun!
-Yarko

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



Re: Dumpdata and serialization issues

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 1:13, natasha.ba...@utoronto.ca wrote:
> On Tuesday, July 3, 2012 5:55:32 PM UTC-4, ke1g wrote:
>>
>> In fact, I think dumpdata takes an app name, not a table or model name.

No it doesn't. It can take a app.model name as well and is more commonly
used, since the primary use case for dumpdata is to provide seeds for
semi-static data, like a categories table.

> So maybe my actual question should be why is the category_id many-to-many 
> field showing up blank consistently when I do a dumpdata??

On 3-7-2012 21:21, natasha.ba...@utoronto.ca wrote:

> The table is defined as follows --> id: integer PRIMARY KEY
> unipart_id: integer category_id: integer

This misses a unique index on (unipart_id, category_id) but doesn't
explain the issues you're seeing.

Any chance we can see the actual models and one broken record as
outputted by dumpdata?
-- 
Melvyn Sopacua


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



Re: Controlling access

2012-07-04 Thread Melvyn Sopacua
On 3-7-2012 19:39, Larry Martell wrote:
> I have a client that asked me to add some new functionality to their
> app, and then they said 'This new functionality should be controlled
> in Django admin so that only the admin user can see it.' Is there a
> way to control this in Django admin? I know in the python code i can
> check to see if they're the admin user or not and allow or disallow
> access, but what they're saying makes it seem I can just do it admin.

request.user.is_superuser

-- 
Melvyn Sopacua


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



Re: how to save response 's render file to server or email using httpresponse

2012-07-04 Thread Melvyn Sopacua
On 3-7-2012 20:32, Nikolas Stevenson-Molnar wrote:
> Oh, and HttpResponse is intended to send data back to a web browser. I
> can't think of any reason you would use an HttpResponse when sending an
> email.

To mail yourself (parts of) the response object from middleware as part
of auditing and/or tracing down elusive errors.

-- 
Melvyn Sopacua


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



Help getting my first django site deployed! (heroku)

2012-07-04 Thread Matthew Meyer
Hello all!

I am in the process of deploying my first django site: 
http://pure-mist-4298.herokuapp.com/

Currently, I have two major issues I am unsure how to resolve.

1. Something is messed up with my database settings. 
I followed this tutorial to get started: 
https://devcenter.heroku.com/articles/django and initally everything worked 
out well. but upon trying to run syncdb a day later I run into the 
following error: http://dpaste.org/hhfCT/

I think this must be something to do with my database config in settings.py 
but since I followed that tutorial and they gave me a premade one line db 
setting. I am hesitant to change it. 

2. Once that is resolved, as is easily seen on the site, I am also having 
an issue using s3 with my static files. I was under the impression heroku 
automatically ran collectstatic when you pushed, there by collecting all my 
static files to my s3 bucket and everything would just work. 

Here is my setttings.py, where I think all the trouble is happening: 
http://dpaste.org/m2ftk/ SEE THE BOTTOM OF THE FILE for my production 
settings.

The sqlite db create in my dev enviornment is not deployed cause I have it 
in a .gitignore.

Any help is appreciated, thanks!

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



Re: Conditionals in Templates

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 0:49, Javier Guerra Giraldez wrote:
> On Tue, Jul 3, 2012 at 3:39 PM, Bill Freeman  wrote:
>> The obvious ways are:
>>
>> 1. Provide a model method that returns a string representing the type
>> of the instance, compare against that
>> 2. Decorate the instance with an attribute giving the name of the type
>> as a string...
> 
> 3. write a template tag

4. Don't use polymorphic variables in templates. Handle it in the view
by providing differently named variables (x and x_list for example).


-- 
Melvyn Sopacua


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



Re: Raise 404

2012-07-04 Thread Melvyn Sopacua
On 3-7-2012 21:38, Smaran Harihar wrote:
> Hey Djangoers,
> 
> I am on my tutorial 3 and I was on this
> topic
> .
> 
> And now if I try to access http://localhost:8000/polls/1/ it gives me the
> same error page, which it gives for other errors.
> 
> I know the error is because I have not yet created the detail.html page but
> is this the output for 'raise Http404' ?
> 

For the archives:
It's explained a little bit further:


In short: you don't have a 404 template, which causes a 500 error, which
causes the default exception details page as with other errors.
-- 
Melvyn Sopacua


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



Re: Inheriting template with a form into an existing template

2012-07-04 Thread Melvyn Sopacua
On 3-7-2012 18:46, DF wrote:
> I have a simple note taking part of my application I'm trying to converge 
> into one template. Currently, I have one template and view that renders and 
> posts the form and another that displays the results. I'd like to 
> amalgamate these into one where the form exists and the results are 
> displayed on the same page.
> 
> This seems to be something that be achieved with template inheritance,

Why? Sisters are family, but don't inherit from each other and this is a
sister relationship. The only thing they have in common is the stuff
surrounding the data. One has a form.as_p the other is a loop based on
different variable. You're going to end up with more if statements than
code saved.
What you can do, is create a shared parent that does the page_title,
headline and so on for you, so that you only have to provide the content
block. So this would be a base_notes.html which extends base.html and
has an empty content block.
-- 
Melvyn Sopacua


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



Re: specify the foreign keys in a ManyToManyField created table?

2012-07-04 Thread eiriks
I've tried (among many things) to set the person in Dagensrepresentanter to 
primary_key=True.  

person = models.ForeignKey(Personer, primary_key=True, 
related_name='dagensrepresentanter_person')  

to force the relationship to include the "right" id. This seems to do just 
that. I'm unsure if this has any other implications for me, but as for now 
I'll settle with this.

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



Re: migration via south for inheritance change -> please help

2012-07-04 Thread Daniel Walz
...no one?

regards, mcJack

2012/7/2 mcJack :
> Hi all,
>
> I've got a problem migrating some changes in the model, so I tried to solve
> it with south.
> The situation:
> I implemented two classes, which share some functionality. Now that I
> improved a little with python, django and co. I wanted to use inheritance
> for that issue.
> The model looks like this:
>
> class Foo(models.Model):
> eggs = models.TextField( null=True, blank=True )
> plants = models.TextField( null=True, blank=True )
> carpet = models.IntegerField()
>
> class Bar(models.Model):
> eggs = models.TextField( null=True, blank=True )
> plants = models.TextField( null=True, blank=True )
> car = models.IntegerField()
>
>
> And obviously I want to transform to:
> class Base(models.Model):
> eggs = models.TextField( null=True, blank=True )
> plants = models.TextField( null=True, blank=True )
>
> class Foo(models.Model):
> base = models.OneToOneField( 'Base', parent_link=True )
> carpet = models.IntegerField()
>
> class Bar(models.Model):
> base = models.OneToOneField( 'Base', parent_link=True )
> car = models.IntegerField()
>
> But how can I tell south to fill the super class with the data from the old
> schema?
>
> Can I add this information manually in the created migration script? or is
> there an option/switch I didn't notice?
>
> Any hints are very welcome, thanks a lot
>
> mcJack
>
> --
> 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/-/_6CYJ1yqh-sJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.



-- 
Daniel Walz - mcj...@gmail.com
Bremen, Germany

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



Re: Forms for updating a compound model

2012-07-04 Thread Tomas Neme
I'm sorry to tell you that ModelForms don't seem to have this
functionality, but I'm happy to tell you that ModelAdmins do.

What it does, basically, is to return this:

{
 'label': label_for_field(field, self.opts.model, self.opts),
 'widget': {
   'is_hidden': False
 },
 'required': False
}

when there's a field marked as readonly, so it can transparently be used
from the templates.

I recommend you go look at the code in
django.contrib.admin.helpers.InlineAdminFormSet to get a feel of what you
can do.

Annd... looking around, I found a ReadonlyWidget, look at the first answer
here:
http://stackoverflow.com/questions/2931884/odd-behavior-in-django-form-readonly-field-widget

-- 
"The whole of Japan is pure invention. There is no such country, there are
no such people" --Oscar Wilde

|_|0|_|
|_|_|0|
|0|0|0|

(\__/)
(='.'=)This is Bunny. Copy and paste bunny
(")_(") to help him gain world domination.

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



Re: values() and order_by()

2012-07-04 Thread J. Javier Maestro
On Wed, Jul 4, 2012 at 1:59 PM, J. Javier Maestro  wrote:
> Hi there!
>
> Thanks a lot for the reply. However, I don't think your solution would
> work in my case, nor it answers the question of whether it can be done
> or why the order_by() adds stuff to the GROUP BY clause when used in
> conjunction with values().
>
> Let's see:
>
> On Tue, Jul 3, 2012 at 11:08 PM, Bill Freeman  wrote:
>> First, I think that you're going about last_visit in the wrong way.
>> timezone.now() is evaluated once, when the module is imported,
>> rather than when the user visits.  DateTimeField's auto_now=True
>> option is tailor made for this kind of situation.
>
> I know about auto_now and, apart from the discussions that can be
> found all over the Internet, is a nice feature... unless you update
> records (like I do). Then, auto_now does nothing since it only affects
> save(). In any case, the default value is actually a leftover from the
> initial implementation, right now is not even needed.

Bill,

Re-reading the update() documentation and the way I implemented the
middleware, you are right that auto_now will be the best solution. I
will use save() instead of update() and will get that fixed.

Thanks a lot for the suggestion!  If you have any ideas about the
values() and order_by() issue, I will be happy to hear them!

Cheers,

-- 
J. Javier Maestro 

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



Re: values() and order_by()

2012-07-04 Thread J. Javier Maestro
Hi there!

Thanks a lot for the reply. However, I don't think your solution would
work in my case, nor it answers the question of whether it can be done
or why the order_by() adds stuff to the GROUP BY clause when used in
conjunction with values().

Let's see:

On Tue, Jul 3, 2012 at 11:08 PM, Bill Freeman  wrote:
> First, I think that you're going about last_visit in the wrong way.
> timezone.now() is evaluated once, when the module is imported,
> rather than when the user visits.  DateTimeField's auto_now=True
> option is tailor made for this kind of situation.

I know about auto_now and, apart from the discussions that can be
found all over the Internet, is a nice feature... unless you update
records (like I do). Then, auto_now does nothing since it only affects
save(). In any case, the default value is actually a leftover from the
initial implementation, right now is not even needed.

> Next, since you have the user id, I'm going to assume that you have
> an actual user object.  In the code below I'll presume that it's
> request.user .
>
> visits_qs = Visit.objects.filter(user=request.user)
> total_visits_count = visits_qs.count()
> latest_visit = visits_qs.order_by('-last_visit')[0]
>
> Yes, this is two database queries, but unless you are seeing a performance
> issue that you've traced to the fact that this is more than one query, this
> code is a heck of a lot more maintainable than trying to make it happen
> in one.

First, this won't work in my implementation. My model stores the
actual count of a given visitor in the count_visits field and the
field is updated every time the visitor visits a user profile (via a
middleware and an F() expression) while your solution stores a full
record every time you want to log a visit to a user profile.

Logging visits your way will eat quite a bit of space in the database.
Also, it's not only about saving space and it's not only about two
database queries. In your implementation, the count() will scan the
whole set of records for the given user. This scan will grow with the
number of records and in this case, taking into account that the whole
purpose is to show a counter for visits to a given user profile... I
think that your proposed workaround does not really fit.


So, I ask again: Why the order_by('colum') when used in conjunction
with values(), adds the column to the GROUP BY?

Thanks,

-- 
J. Javier Maestro 

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



Django Book In Persian

2012-07-04 Thread Amin Oruji
Django Book site in Persian langage launched.

www.djangobook.ir

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



Re: Deployment: Apache2, wsgi (Debian squeeze)

2012-07-04 Thread Melvyn Sopacua
On 3-7-2012 5:03, Matt Smith wrote:

> Up until now I've been serving non-dynamic content the usual way. I
> apt-got installed apache2, worked out /var/www was the root, followed
> the index.html convention and that worked fine. Now I feel I'm stuck
> between that old way of doing things and the django/wsgi way which I
> can't get my head around even after reading the docs. The development
> server experience hasn't helped me much when it comes to deployment.

In general Apache is easier to configure than nginx, but I find this not
to be the case with wsgi. If you're not set on Apache, then I suggest
you read the uwsgi deployment guide in the manual. I (and others on the
list) will gladly help you with the nginx bit, but I'd rather not
confuse you more if you're set on Apache, so I'm holding off on the
examples for now.

-- 
Melvyn Sopacua


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



specify the foreign keys in a ManyToManyField created table?

2012-07-04 Thread eiriks
I have a model that auto created an auto inc id field as primary key. It 
related smoothly with my person model, but when I try to create a relation 
to committees (Komiteer) I get a new intermediate table with (an auto inc 
primary key, that's ok, a working relation to commitees, smooth and *a non 
working wrong data type field* that I'd expect to link to persons)

Heres the model with the ManyToManyField:

class Dagensrepresentanter(models.Model):
person = models.ForeignKey(Personer, 
related_name='dagensrepresentanter_person')
vara_for = models.ForeignKey(Personer, blank=True, null=True, 
related_name='dagensrepresentanter_vara_for')
komiteer = models.ManyToManyField(Komiteer)

it generats this intermediate table (I only included the fields 
for simplicity):

  `id` int(11) NOT NULL AUTO_INCREMENT,
>   *`dagensrepresentanter_id` int(11) NOT NULL,*
>   `komiteer_id` varchar(150) NOT NULL,


The line in italics is a int(11), and probably links fine with the auto 
generated id in the model for Dagensrepresentanter but it need to link to 
the person field. In the person table the datatype for this value is 
varchar(33) 
NOT NULL

How do I specify that the foreign key in the intermediate table is the 
person field from the Dagensrepresentanter model? 

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



Re: Use regular expression to retrieve all image tags from a given content

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 3:03, Tim Chase wrote:

>  r = re.compile(r"""
> <# tag opening
> \s*  # optional whitespace
> img  # the tag
> \b   # must end here
> (?:  # one of these things:
>  \s+  # whitespace
>  (?:[a-z][a-z0-9]+:)? # an optional namespace
>  src  # a "src" attribute
>  \s*  # optional whitespace
>  =# the equals sign
>  \s*  # optional whitespace
>  (# capture the value
>   "[^"]*" # a double-quoted string
>   |   # or
>   '[^']*' # a single-quoted string
>   |   # or
>   [^-a-z0-9._:]*" # per HTML spec
>   )   # end of the captured src
> |# or something that's not src
>  \s+  # whitespace
>  (?:[a-z][a-z0-9]+:)? # an optional namespace
>  [a-z0-9]+# the tag name
>  (?:  # an optional value
>   \s* # optional whitespace
>   =   # an assignment
>   \s* # optional whitespace
>   (?:  # the value
>"[^"]*" # a double-quoted string
>|   # or
>'[^']*' # a single-quoted string
>|   # or
>[^-a-z0-9._:]*" # per HTML spec
>)   # end of the captured src
>   )   # end of ignored attribute
>  )*  # zero or more attributes
> \s*  # optional whitespace
> (?:/\s*) # an optional self-closing
> ># closing >
> """, re.I | re.VERBOSE)
> 
> So, that said, I'm not sure it's much more complex to use a real
> parsing library :-)

Aside from the \b matching positive against ><, this is a syntax
validator and of course when validating syntax you'll use a validating
parser. For all other cases, you'd be more interested in "image tags
with a src attribute", making the use-case quite a bit more simple.

My main beef with modern software is that for the simplest of things one
flees to full-blown libraries which happen to provide some utilities,
but the other 98% of the code from that library is unused. Case in
point, PIL to verify if a file is an image. But my rant alarm went off. :)

>> It's a trade-off you should make a decision on, not just blatantly
>> dismiss regular expressions when a document contains tags or call them
>> complex when they contain more then two characters.
> 
> I'm not blithely dismissing them,

But the author I replied to did. I think you and I are on the same page.
Either way, the OP now has some nice examples of how to /refine/ regular
expressions and that's the real craft :).

-- 
Melvyn Sopacua


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



Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 9:55, ferran wrote:
> Hello,
> 
> I'm update javascript libraries:
> - Jquery from 
> http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js to 
> http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
> - Jquery ui from 
> http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js to 
> http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js
> 
> But not is a solutions, the problem persist...

Upgrades aren't solutions. They only dress up as them in their spare time.

You should:
1) Identify where you generate links via javascript
2) Identify what javascript variable is passed to the link
3) Identify how it can be undefined

If you don't see how it can be, undefined, use the appropriate
javascript forums / documentation.

-- 
Melvyn Sopacua


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



Re: Unable to obtain c.poll

2012-07-04 Thread Melvyn Sopacua
On 2-7-2012 23:37, Smaran Harihar wrote:
> Also when we are taking,
> 
>  c = p.choice_set.filter(choice_text__startswith='Just hacking')>>> c.delete()
> 
> 
> Are we deleting the object or just that filter queryset choice?

The list returned by the filter.
c = p.choice_set.get(..)
c.delete() # calls the delete method of the choice object

-- 
Melvyn Sopacua


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



Re: map in django

2012-07-04 Thread kenneth gonsalves
On Wed, 2012-07-04 at 17:38 +0530, Satvir Toor wrote:
> Hello!!! Everyone
> I am new to maps in django.I want to display map in django application
> and to capture the latitude and longitude for that location and  to
> save in database. Please give me reference. 

http://duckduckgo.com/?q=maps+in+django
-- 
regards
Kenneth Gonsalves

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



Re: UserProfile.user" must be a "User" instance. django-registration

2012-07-04 Thread Melvyn Sopacua
On 2-7-2012 15:17, Nikhil Verma wrote:

> Traceback:-
> 
> 
> Exception Type: ValueError at /myprofile/completingprofile/
> Exception Value: Cannot assign " object at 0x3487c10>": "UserProfile.user" must be a "User" instance.
> 

> user = request.user,# here i am trying to add user from
> request who is coming from RegistrationForm from django -registration
># I am getting the error in this above line

If request.user.is_anonymous() is True you have your answer. If not,
figure out what kind of stuff is in that object by printing it's __dict__.
-- 
Melvyn Sopacua


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



Admin actions -- short_description as doc string?

2012-07-04 Thread Roy Smith
I'm just staring to explore admin actions.  I'm surprised to see that you have 
to set the description by doing:

my_action_function.short_description = "blah"

wouldn't it be cleaner to just declare a doc string for the action function and 
have short_description grabbed from there?

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



map in django

2012-07-04 Thread Satvir Toor
Hello!!! Everyone
I am new to maps in django.I want to display map in django application
and to capture the latitude and longitude for that location and  to
save in database. Please give me reference.


-- 
Satvir Kaur
satveerkaur.blogspot.in

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



Re: error : need more than 1 value to unpack

2012-07-04 Thread rafiee.nima
tnx ;)

On Wednesday, July 4, 2012 1:03:37 PM UTC+4:30, Jon Black wrote:
>
>   You're also returning mimetype="application/json" outside of the 
> request.is_ajax check. I doubt you want that.
>  On Wed, Jul 4, 2012, at 01:20, rafiee.nima wrote:
>
> Oh  
> I find out my mistake :D 
>
> On Wednesday, July 4, 2012 12:38:11 PM UTC+4:30, rafiee.nima wrote: 
>
> Hi I got below error from my view which handle ajax request  
> hotel_instance=Hotel.objects.get(id=request.POST['hotel'])
>   need more than 1 value to unpack
>   
>  here is my code
>   
>  def add_room(request):
>  context={}
>  status=''
>  if request.is_ajax:
>  if request.POST:
>  hotel_instance=Hotel.objects.get(request.POST['hotel'])
>  if request.POST['id'] > 0 :
>  room=HotelRoom.objects.get(id=request.POST['id'])
>  room.hotel=hotel_instance
>  room.number=request.POST['number']
>  room.bed_count=request.POST['bed_count']
>  room.ground_sleep=request.POST['ground_sleep']
>  room.view=request.POST['view']
>  room.reserved=request.POST['reserved']
>  room.tv=request.POST['tv']
>  room.phone=request.POST['phone']
>  room.refrigerator=request.POST['refrigerator']
>  room.air_condition=request.POST['air_condition']
>  room.toilet=request.POST['toilet']
>  room.creator=request.user
>  room.save()
>  else:
>  room = HotelRoom(
>  hotel=hotel_instance,
>  number=request.POST['number'],
>  bed_count=request.POST['bed_count'],
>  ground_sleep=request.POST['ground_sleep'],
>  view=request.POST['view'],
>  reserved=request.POST['reserved'],
>  tv=request.POST['tv'],
>  phone=request.POST['phone'],
>  refrigerator=request.POST['refrigerator'],
>  air_condition=request.POST['air_condition'],
>  toilet=request.POST['toilet'],
>  creator=request.user )
>  room.save()
>   
>  return HttpResponse({status:'success'}, mimetype="application/json")
>  
>   
> --
> 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/-/fNXaSuOjeKcJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more 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 view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JwbmucT3Z3AJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



onetoone relation question

2012-07-04 Thread ledzgio
Hi all,

I have the following configuration:

models.py http://dpaste.org/9q79R/
admin.py http://dpaste.org/w7CCD/

In admin I will get a select where for each player I can select (or add a 
new one) PlayerAttribute object. With the onetoone relation I have one 
PlayerAttribute for one Player but in the admin every player can choose one 
PlayerAttribute from the previously added. WHat I want is that if I add a 
new PlayerAttribute (from the Player admin panel), that PlayerAttribute is 
only associated with that player, so if I add another Player I will not 
able to choose the previously added PlayerAttribute but I can just add a 
new one (or choosing an older PlayerAttribute associated to that player).

How can I do that?

thanks

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



Re:

2012-07-04 Thread Jon Black
Do you mean github? If so, see the github documentation.
Do you mean creating a git repository? If so, see the git
documentation.

--
Jon Black
www.jonblack.org


On Wed, Jul 4, 2012, at 02:25, Bharati Sharma wrote:

  I want to upload my project on the git ...kindly help me
  please..


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



[no subject]

2012-07-04 Thread Bharati Sharma
I want to upload my project on the git ...kindly help me please..

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



Re: error : need more than 1 value to unpack

2012-07-04 Thread Jon Black
You're also returning mimetype="application/json" outside of the
request.is_ajax check. I doubt you want that.
On Wed, Jul 4, 2012, at 01:20, rafiee.nima wrote:

  Oh

I find out my mistake :D
On Wednesday, July 4, 2012 12:38:11 PM UTC+4:30, rafiee.nima
wrote:

  Hi I got below error from my view which handle ajax request

hotel_instance=Hotel.objects.get(id=request.POST['hotel'])

 need more than 1 value to unpack



here is my code



def add_room(request):
context={}
status=''
if request.is_ajax:
if request.POST:
hotel_instance=Hotel.objects.
get(request.POST['hotel'])
if request.POST['id'] > 0 :
room=HotelRoom.objects.get(id=request.POST['id'])
room.hotel=hotel_instance
room.number=request.POST['number']
room.bed_count=request.POST['bed_count']
room.ground_sleep=request.POST['ground_sleep']
room.view=request.POST['view']
room.reserved=request.POST['reserved']
[1]room.tv=request.POST['tv']
room.phone=request.POST['phone']
room.refrigerator=request.POST['refrigerator']
room.air_condition=request.POST['air_condition']
room.toilet=request.POST['toilet']
room.creator=request.user
room.save()
else:
room = HotelRoom(
hotel=hotel_instance,
number=request.POST['number'],
bed_count=request.POST['bed_count'],
ground_sleep=request.POST['ground_sleep'],
view=request.POST['view'],
reserved=request.POST['reserved'],
tv=request.POST['tv'],
phone=request.POST['phone'],
refrigerator=request.POST['refrigerator'],
air_condition=request.POST['air_condition'],
toilet=request.POST['toilet'],
creator=request.user )
room.save()

return HttpResponse({status:'success'},
mimetype="application/json")


  --
  You received this message because you are subscribed to the
  Google Groups "Django users" group.
  To view this discussion on the web visit
  [2]https://groups.google.com/d/msg/django-users/-/fNXaSuOjeKcJ
  .
  To post to this group, send email to
  django-users@googlegroups.com.
  To unsubscribe from this group, send email to
  django-users+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/django-users?hl=en.

References

1. http://room.tv/
2. https://groups.google.com/d/msg/django-users/-/fNXaSuOjeKcJ

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



Re: error : need more than 1 value to unpack

2012-07-04 Thread rafiee.nima
Oh 
I find out my mistake :D 

On Wednesday, July 4, 2012 12:38:11 PM UTC+4:30, rafiee.nima wrote:
>
> Hi I got below error from my view which handle ajax request 
> hotel_instance=Hotel.objects.get(id=request.POST['hotel'])
>  need more than 1 value to unpack
>
> here is my code
>
> def add_room(request):
> context={}
> status=''
> if request.is_ajax:
> if request.POST:
> hotel_instance=Hotel.objects.get(request.POST['hotel'])
> if request.POST['id'] > 0 :
> room=HotelRoom.objects.get(id=request.POST['id'])
> room.hotel=hotel_instance
> room.number=request.POST['number']
> room.bed_count=request.POST['bed_count']
> room.ground_sleep=request.POST['ground_sleep']
> room.view=request.POST['view']
> room.reserved=request.POST['reserved']
> room.tv=request.POST['tv']
> room.phone=request.POST['phone']
> room.refrigerator=request.POST['refrigerator']
> room.air_condition=request.POST['air_condition']
> room.toilet=request.POST['toilet']
> room.creator=request.user
> room.save()
> else:
> room = HotelRoom(
> hotel=hotel_instance,
> number=request.POST['number'],
> bed_count=request.POST['bed_count'],
> ground_sleep=request.POST['ground_sleep'],
> view=request.POST['view'],
> reserved=request.POST['reserved'],
> tv=request.POST['tv'],
> phone=request.POST['phone'],
> refrigerator=request.POST['refrigerator'],
> air_condition=request.POST['air_condition'],
> toilet=request.POST['toilet'],
> creator=request.user )
> room.save()
>
> return HttpResponse({status:'success'}, mimetype="application/json")
>

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



error : need more than 1 value to unpack

2012-07-04 Thread rafiee.nima
Hi I got below error from my view which handle ajax request 

 need more than 1 value to unpack

here is my code

def add_room(request):
context={}
status=''
if request.is_ajax:
if request.POST:
hotel_instance=Hotel.objects.get(request.POST['hotel'])
if request.POST['id'] > 0 :
room=HotelRoom.objects.get(id=request.POST['id'])
room.hotel=hotel_instance
room.number=request.POST['number']
room.bed_count=request.POST['bed_count']
room.ground_sleep=request.POST['ground_sleep']
room.view=request.POST['view']
room.reserved=request.POST['reserved']
room.tv=request.POST['tv']
room.phone=request.POST['phone']
room.refrigerator=request.POST['refrigerator']
room.air_condition=request.POST['air_condition']
room.toilet=request.POST['toilet']
room.creator=request.user
room.save()
else:
room = HotelRoom(
hotel=hotel_instance,
number=request.POST['number'],
bed_count=request.POST['bed_count'],
ground_sleep=request.POST['ground_sleep'],
view=request.POST['view'],
reserved=request.POST['reserved'],
tv=request.POST['tv'],
phone=request.POST['phone'],
refrigerator=request.POST['refrigerator'],
air_condition=request.POST['air_condition'],
toilet=request.POST['toilet'],
creator=request.user )
room.save()

return HttpResponse({status:'success'}, mimetype="application/json")

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



Re: many "Broken INTERNAL link" with end string "/undefined/"

2012-07-04 Thread ferran
Hello,

I'm update javascript libraries:
- Jquery from 
http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js to 
http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
- Jquery ui from 
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js to 
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js

But not is a solutions, the problem persist...

Thanks in advanced

On Thursday, June 28, 2012 3:24:39 PM UTC+2, ferran wrote:
>
> Hello Melvyn,
>
> Ohhh in the javascript!. you're good I view my libraries and update 
> it's necessary (Jquery, etc.).
>
> see you with the response of the re-code javascript
>
> Thanks
>
>
> On Thursday, June 28, 2012 2:59:12 PM UTC+2, Melvyn Sopacua wrote:
>>
>> On 27-6-2012 18:37, ferran wrote: 
>>
>> > In the last 3 weeks I'm receiving in my email a many "Broken INTERNAL 
>> link" 
>> > how this: 
>> > 
>> > " 
>> > Referrer: http://www.marquezshop.com/es/catalogo/sales/ 
>> > Requested URL: /es/catalogo/sales/undefined/ 
>> ^ 
>> That's javascript, not python doing that. Python would be 'None'. So 
>> check your javascript code for Google Chrome compliance. 
>>
>> -- 
>> Melvyn Sopacua 
>>
>>
>>

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



edit form cannot be generated for django comments

2012-07-04 Thread Sachin Gupta
I wanted to have a functionality to be able to edit the comments posted 
using the comments app (not from the admin, from the site). As much as I 
know Django, to render an edit form we need to pass an instance of the 
object to the form which has to be edited like

form = SomeForm(instance=some_object)

But when I try to do the same in case of CommentForm imported from 
django.contrib.comments.forms, I get an error  __init__() got an unexpected 
keyword argument 'instance'.
When I check the comment form I find that the __init__() for the comment 
form is overwritten and it does not accept the `instance` argument. If the 
form cannot accept this argument, it means I cannot generate an edit form.

Is there any work around?

Thanks,
Sachin

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



Re: Handling millions of rows + large bulk processing (now 700+ mil rows)

2012-07-04 Thread Timothy Makobu
I'm in.

On Tue, Jul 3, 2012 at 2:35 AM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Just in case anyone missed the URL, you can book your slot here:
>
> http://www.doodle.com/8ptehyqr6uezhtsy
>
> Voting open until 14th July.
>
> Cal
>
> On Mon, Jul 2, 2012 at 9:59 AM, Cal Leeming [Simplicity Media Ltd] <
> cal.leem...@simplicitymedialtd.co.uk> wrote:
>
>> Curious, I'll have to test the quality, but we might potentially use
>> hangouts for the backup stream instead - it'd certainly be a lot easier if
>> the quality was good!
>>
>> Cheers
>>
>> Cal
>>
>>
>> On Mon, Jul 2, 2012 at 5:35 AM, Alec Taylor wrote:
>>
>>> Sounds good, but have you considered using Google+ Hangouts?
>>>
>>> On Mon, Jul 2, 2012 at 1:09 AM, Cal Leeming [Simplicity Media Ltd]
>>>  wrote:
>>> > Wow - glad to see there's people interested in this!
>>> >
>>> > Here is the schedule, could everyone please select which days/times
>>> they are
>>> > available (enter more than one if possible)
>>> >
>>> > http://www.doodle.com/8ptehyqr6uezhtsy
>>> >
>>> > I'll leave the schedule open until 14th July, whichever slot gets the
>>> most
>>> > votes wins.
>>> >
>>> > Given our awful experiences with conferencing software, we'll probably
>>> be
>>> > using livestream, and a backup stream from one of our own servers -
>>> both
>>> > have a maximum capacity of 50 users at 720p.
>>> >
>>> > Cal
>>> >
>>> > On Sat, Jun 30, 2012 at 4:10 PM, Cal Leeming [Simplicity Media Ltd]
>>> >  wrote:
>>> >>
>>> >> Hi all,
>>> >>
>>> >> As some of you know, I did a live webcast last year (July 2011) on
>>> our LLG
>>> >> project, which explained how we overcome some of the problems
>>> associated
>>> >> with large data processing.
>>> >>
>>> >> After reviewing the video, I found that the sound quality was very
>>> poor,
>>> >> the slides weren't very well structured, and some of the information
>>> is now
>>> >> out of date (at the time it was 40mil rows, now we're dealing with
>>> 700+mil
>>> >> rows).
>>> >>
>>> >> Therefore, I'm considering doing another live webcast (except this
>>> time
>>> >> it'll be recorded+posted the next day, the stream will be available in
>>> >> 1080p, it'll be far better structured, and will only last 50 minutes).
>>> >>
>>> >> The topics I'd like to cover are:
>>> >>
>>> >> * Bulk data processing where bulk_insert() is still not viable (we
>>> went
>>> >> from 30 rows/sec to 8000 rows/sec on bulk data processing, whilst
>>> still
>>> >> using the ORM - no raw sql here!!)
>>> >> * Applying faux child/parent relationship when standard ORM is too
>>> >> expensive (allows for ORM approach without the cost)
>>> >> * Applying faux ORM read-only structure to legacy applications
>>> (allows ORM
>>> >> usage on schemas that weren't properly designed, and cannot be
>>> changed - for
>>> >> example, vendor software with no source code).
>>> >> * New Relic is beautiful, but expensive. Hear more about our plans to
>>> make
>>> >> an open source version.
>>> >> * Appropriate use cases for IAAS vs colo with SSDs.
>>> >> * Percona is amazing, some of the tips/tricks we've learned over.
>>> >>
>>> >> If you'd like to see this happen, please leave a reply in the thread
>>> - if
>>> >> enough people want this, then we'll do public vote for the scheduled
>>> date.
>>> >>
>>> >> Cheers
>>> >>
>>> >> Cal
>>> >
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Django users" group.
>>> > To post to this group, send email to django-users@googlegroups.com.
>>> > To unsubscribe from this group, send email to
>>> > django-users+unsubscr...@googlegroups.com.
>>> > For more 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+unsubscr...@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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.