Django Client Put method Data Access from Request View

2013-06-07 Thread Edwin Lunando
Hi everyone,

I'm building a REST API and i need to use the Client.put() method. For 
example 

response = self.client.put(reverse('api:update_user'), {access_token: 
'123123123123'})

When I run the test, I do not know where the data is placed. request.GET 
and request.POST is empty. request.META['QUERY_STRING'] is empty. Where are 
my PUT data?

I tried to see the put method code and it shows like this:

def put(self, path, data='', content_type='application/octet-stream',
**extra):
"Construct a PUT request."
return self.generic('PUT', path, data, content_type, **extra)

def generic(self, method, path,
data='', content_type='application/octet-stream', **extra):
parsed = urlparse(path)
data = force_bytes(data, settings.DEFAULT_CHARSET)
r = {
'PATH_INFO':  self._get_path(parsed),
'QUERY_STRING':   force_str(parsed[4]),
'REQUEST_METHOD': str(method),
}
if data:
r.update({
'CONTENT_LENGTH': len(data),
'CONTENT_TYPE':   str(content_type),
'wsgi.input': FakePayload(data),
})
r.update(extra)
return self.request(**r)

The data parameter is included to 'wsgi.input' not to QUERY_STRING. How can 
i access my data from the request object at my view?

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




Re: properly passing form post data to get_context_data() in detailview

2013-06-07 Thread Greg Maruszeczka
I believe I've found my own solution and it seems more straightforward than 
I originally thought. I'm posting it here in the chance it saves someone 
else some time. When django told me there was no attribute 'object' it set 
me to look at where this attribute was supposed to be assigned and I found 
it in the inherited class' methods.

Anyway, after some refactoring, trial-and-error and reading code I've 
revised the view to this:

class PostDetailView(DetailView):
template_name = 'blog_detail.html'
context_object_name = 'post'
form_class = CommentForm

def get_object(self):
post = Post.objects.get(published=True, slug=self.kwargs['slug'])
return post

def get_context_data(self, **kwargs):
context = super(PostDetailView, self).get_context_data(**kwargs)
context['comments'] = 
Comment.objects.filter(published=True).filter(post_id=context['post'].id)
return context

def get(self, request, *args, **kwargs):
## important ##
super(PostDetailView, self).get(self, request, *args, **kwargs)
form = self.form_class
return self.render_to_response(self.get_context_data(form=form))

def post(self, request, *args, **kwargs):
## important ##
self.object = self.get_object()
form = self.form_class(request.POST)
if form.is_valid():
f = form.save(commit=False)
f.post_id = self.object.id
f.ip_address = self.get_client_ip(self.request)
f.save()
form.send_email(self.object)
messages.add_message(self.request, messages.SUCCESS, 'Comment 
submitted and will be published pending administrator approval. Thanks!')
return redirect(self.object)
else:
messages.add_message(self.request, messages.ERROR, 'There was a 
problem with your submission. Please check the form below for errors and 
try again.')
return self.render_to_response(self.get_context_data(form=form))

def get_client_ip(self, request):
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
if x_forwarded_for:
ip = x_forwarded_for.split(',')[0]
else:
ip = request.META.get('REMOTE_ADDR')
return ip

The super() call in PostDetailView.get() and the self.object = 
self.get_object() call in PostDetailView.post() ensures there's a 
self.object and I no longer get the 'attribute error'. As well empty fields 
in the submission form are now properly flagged by validation errors. It 
appears to work as intended and now I can review again in light of best 
practices. If anyone has suggestions on that I would appreciate it

Thanks,
GM



On Tuesday, 4 June 2013 17:51:24 UTC-7, Greg Maruszeczka wrote:
>
> Hi,
>
> I'm trying to process a form through a detailview that adds a comment to a 
> blog post. Here's my view code:
>
> class PostDetailView(DetailView):
> model = Post
> template_name = 'blog_detail.html'
> queryset = Post.objects.filter(published=True)
> form_class = CommentForm
>   
> def get_context_data(self, **kwargs):
> context = super(PostDetailView, self).get_context_data(**kwargs)
> post = self.get_object()
> context['comments'] = 
> Comment.objects.filter(published=True).filter(post_id=post.id)
> context['form'] = CommentForm
> return context
> 
> def post(self, request, *args, **kwargs):
> post = self.get_object()
> form = CommentForm(request.POST)
> if form.is_valid():
> f = form.save(commit=False)
> f.post_id = post.id
> f.ip_address = self.get_client_ip(self.request)
> f.save()
> form.send_email()
> messages.add_message(self.request, messages.SUCCESS, 'Comment 
> submitted. Thanks!')
> return HttpResponseRedirect(request.META.get('HTTP_REFERER', 
> None))
> else:
> # this fails with attribute error: 'PostDetailView' object 
> has no attribute 'object'
> return 
> self.render_to_response(self.get_context_data(form=form))
> 
> def get_client_ip(self, request):
> x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR')
> if x_forwarded_for:
> ip = x_forwarded_for.split(',')[0]
> else:
> ip = request.META.get('REMOTE_ADDR')
> return ip
>
>
> And here's the relevant form code:
>
> class CommentForm(ModelForm):
> class Meta:
> model = Comment
> exclude = ('post', 'published')
> 
> def send_email(self):
> text = self.cleaned_data['text']
> name = self.cleaned_data['name']
> send_mail(
> 'comment submission',
> name + ' wrote:\n' + text,
> [from_email_address],
> ([to_email_address])
> )
>
> Form processing appears to work as expected when the form fields are 
> 

Re: LiveServerTestCase database has no tables...

2013-06-07 Thread Steve Hiemstra
Ignore the first sentence.  That works because it creates a test MySQL 
database.  Only when using the :memory: database does it fail.

On Friday, June 7, 2013 3:17:29 PM UTC-4, Steve Hiemstra wrote:
>
> I've got a LiveServerTestCase and I'm not sure what's going on.  I have to 
> include my normal database settings for it to work.  It still writes to the 
> memory test database, but all the other tests use the normal one which 
> breaks things.
>
> In LiveServerTestCase.setUpClass I put the following:
>
> print cls.server_thread.connections_override['default'], 
> len(cls.server_thread.connections_override['default'].introspection.table_names())
> cls.server_thread.start()
>
> # Wait for the live server to be ready
> cls.server_thread.is_ready.wait()
>
>
> And in LiveServerThread.run I put a similar print statement:
>
>  # provided by the main thread.
>  for alias, conn in self.connections_override.items():
>  print 'New Thread', conn, len(conn.introspection.table_names())
>
> Which prints out:
>
>  122
> New Thread  0x1057a4188> 0
>
> I don't get it.  The override is there and they are the same object... but 
> somehow the second time it has no tables :(  
>

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




LiveServerTestCase database has no tables...

2013-06-07 Thread Steve Hiemstra
I've got a LiveServerTestCase and I'm not sure what's going on.  I have to 
include my normal database settings for it to work.  It still writes to the 
memory test database, but all the other tests use the normal one which 
breaks things.

In LiveServerTestCase.setUpClass I put the following:

print cls.server_thread.connections_override['default'], 
len(cls.server_thread.connections_override['default'].introspection.table_names())
cls.server_thread.start()

# Wait for the live server to be ready
cls.server_thread.is_ready.wait()


And in LiveServerThread.run I put a similar print statement:

 # provided by the main thread.
 for alias, conn in self.connections_override.items():
 print 'New Thread', conn, len(conn.introspection.table_names())

Which prints out:

 122
New Thread  0

I don't get it.  The override is there and they are the same object... but 
somehow the second time it has no tables :(  

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




dictionary update sequence

2013-06-07 Thread Rene Zelaya
Hi,

I am getting the following error when the server tries to load one of my
templates and I am not sure what the problem is:

dictionary update sequence element #0 has length 1; 2 is required


The error occurs at the following line in my template:



However, I thought I was already passing it both of those arguments
(geneset.user and geneset.slug).  Does that have anything to do with it? I
also recently installed the Django tastypie API - Could that be causing the
problem at all?

Many thanks!

Rene

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




What are the best examples of the use of Dynamic Models? (real situation)

2013-06-07 Thread enemytet
 

I learn dynamic models in Django but I don't understand when to use them.

What are the best examples of the use of dynamic models? (real situation)

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




Re: How send data to UpdateView from javascript. (Django 1.5)

2013-06-07 Thread Nikolas Stevenson-Molnar
I assume that MatterUpdateView is a subclass of the generic UpdateView
class. If so, that class expects an object pk (id) or slug to be
included as part of the URL pattern, and yours doesn't include either.
Your URL pattern should look something more like:
r"^manage/(?P\d+)/update/"

_Nik

On 6/6/2013 10:16 PM, Ariel V. R. wrote:
> Code:
>
> HTML
> 
>  
>
> 
>
> JS
> $('.icon-edit').click( function() {
> $object_id = $(this).parents().eq(0).attr('id');
> $('#form-edit #input-pk').attr('value', $object_id);
> $('#form-edit').submit();
> })
>
> URL.PY
>
> ...
> url(r'^manage_p1/update/', MatterUpdateView.as_view()), 
> ...
>
>
>
> El jueves, 6 de junio de 2013 23:45:59 UTC-5, Ariel V. R. escribió:
>
> Hello:
>
> I need to send data from html using javascript to UpdateView.
> Django sends me an error:  "Generic detail view MatterUpdateView
> must be called with either an object pk or a slug."
>
> I think that the problem exists because the method as_view() does
> not receive the correct data.
>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

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




how to make project template?

2013-06-07 Thread kl4us
Anyone know how to push changes upstream back to the template after having 
started the project? i'm in this snenario:

1) I start a project from pinax:

$ virtualenv mysite
$ source mysite/bin/activate
(mysite)$ pip install Django==1.4.5
(mysite)$ django-admin.py startproject 
--template=https://github.com/pinax/pinax-project-social/zipball/master mysite
(mysite)$ cd mysite
(mysite)$ pip install -r requirements.txt
(mysite)$ python manage.py syncdb
(mysite)$ python manage.py runserver

2) make stuff 
3) i want to pull to pinax repository my changes

The question is: How can i change my named project "mysite" with {{ 
project_name}} back?


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




Re: session_key varies

2013-06-07 Thread Wim Feijen
Hi Tom,

Thanks for making this clear!

Now I explicitly save the session and everything works as supposed.

Thanks again!

Wim


On 3 June 2013 15:19, Tom Evans  wrote:

> On Mon, Jun 3, 2013 at 11:48 AM, Wim Feijen  wrote:
> > Hi,
> >
> > Is it normal that a session_key varies when a user is not logged in? And
> if
> > so, should I then use request.COOKIES instead to store information in?
> >
> > In one of my projects, users can order a calendar and upload their own
> > photos, one for each month. In between, I like to keep track of which
> photos
> > have been uploaded to a certain calendar. Users don't need to login to do
> > this.
> >
> > First, I was using the session_key to keep track of a calendar order,
> but I
> > noticed that the key kept on varyingr when a colleague on a Mac clicked a
> > button.
> >
> > Now I am wondering whether this is normal behavior, or can I do
> something to
> > prevent it.
> >
> > And should I use request.COOKIES instead?
> >
> > Thanks for your help!
> >
> > Wim
> >
>
> Hi Wim
>
> In fact, what happens is that the session id will not be fixed unless
> the session has been persisted, ie something has been put inside the
> session and the session saved.
>
> Basically, the code flow is like this:
>
> Session backend initiated with session id=None
> You print out/access request.session.session_id
> Accessing the session id if there is no current session id causes a
> new session id to be generated.
> The session referred to by the session id is only persisted into the
> database if the session is modified.
> Simply accessing the session id is not sufficient to mark the session
> as modified
> Since the session was not saved, the session cookie is not sent to the
> client.
> The client reloads the page, with no session id cookie
> Session backend initiated with session id=None
>
> Probably in your unauthenticated scenario, the session is completely
> untouched, and therefore the (apparent) session id fluctuates between
> requests, because a new session id is created for each request until
> something on the request uses the session.
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/QADDLwsCeFI/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Wim Feijen
Eigenaar

*Wij zijn verhuisd:*
Go2People Websites
La Guardiaweg 88 (toren B)
1043 DK Amsterdam

T:  088 170 0718 (tijdelijk) / 06  3316
W: http://go2people-websites.nl

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




Re: database -> model -> charting

2013-06-07 Thread Jani Tiainen
On Fri, 7 Jun 2013 01:20:27 -0700 (PDT)
tony gair  wrote:

> 
> 
> I would like to hear peoples opinions on third party django charting apps, 
> with various considerations. My primary consideration would ease of use by 
> a django noob. Thanks
>

You can quite easily use pretty much any JS charting libraries. Google Charts 
for example. And pretty much any JS framework you pick do seem to have some 
kind of a charting library available.

Simplest way in most cases is to render data for char as a JSON (which in turn 
can be uses as-is in for JS)

-- 

Jani Tiainen

"Impossible just takes a little longer"

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




Re: Is there any good tutorial on how to daemonize celery?

2013-06-07 Thread manuga...@gmail.com
Mike, with those settings removed I'm still getting the same errors.

And I'm now trying to do everything from scratch in a new server without
virtualenv. Could somebody please help with the last issue I need to fix? I
raised a stack overflow question here -
http://stackoverflow.com/questions/16970379/environment-variables-with-supervisor

I'm just amazed by the community support here. Thanks a lot, everyone!

Regards,
-- 
Manu Ganji,
Mobile: +91-8500719336.

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




Re: Some problems with Paginator

2013-06-07 Thread Marcin Szamotulski
We all make mistakes, don't worry :)

Best regards,
Marcin

On 00:02 Fri 07 Jun , Federico Erbea wrote:
> I'm really stupid, why i never think to the easiest way, never...I wrong 
> "{% for film in attore.film_set.all %}" because i had write "{% for film in 
> film_attore %}"...Sorry...;)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 

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




Re: database -> model -> charting

2013-06-07 Thread tony gair
Been trying out a couple over the last few hours. I have to say, the one 
you mention seems streets ahead of anything else, and its documented really 
well, which is the clincher for me.
Many thanks for that super helpful info!

On Friday, 7 June 2013 11:33:07 UTC+1, Christian Schulz wrote:
>
> When you have some experience with JS/Highcharts django-chartit might be 
> interesting. 
> Easy is relativ but I got it and I'm really not a django/JS pro. It's 
> nice work, but dev progress seems fallen asleep. 
>
> http://chartit.shutupandship.com/ 
>
>
> > 
> > 
> > I would like to hear peoples opinions on third party django charting 
> > apps, with various considerations. My primary consideration would ease 
> > of use by a django noob. Thanks 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to django-users...@googlegroups.com . 
> > To post to this group, send email to 
> > django...@googlegroups.com. 
>
> > Visit this group at http://groups.google.com/group/django-users?hl=en. 
> > For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
>
>

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




Re: database -> model -> charting

2013-06-07 Thread Christian Schulz
When you have some experience with JS/Highcharts django-chartit might be 
interesting.
Easy is relativ but I got it and I'm really not a django/JS pro. It's 
nice work, but dev progress seems fallen asleep.


http://chartit.shutupandship.com/





I would like to hear peoples opinions on third party django charting 
apps, with various considerations. My primary consideration would ease 
of use by a django noob. Thanks

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com.

To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




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




Re: Understanding an existing big web application written in Django

2013-06-07 Thread Tom Evans
On Thu, Jun 6, 2013 at 8:00 PM, Javier Guerra Giraldez
 wrote:
> On Thu, Jun 6, 2013 at 6:46 PM, Sam Walters  wrote:
>> find . -name '*.py' -exec grep -E -H -n 'import LocationAirfieldLookup' '{}'
>> \; -print
>
>
> far faster and better use of grep's capabilities:
>
> grep -n 'import LocationAirfieldLookup' -R . --include '*.py'
>

Quicker to type and quicker to run since it knows what kind of files to look in:

ack 'import LocationAirfieldLookup'

http://betterthangrep.com/

Cheers

Tom

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




database -> model -> charting

2013-06-07 Thread tony gair


I would like to hear peoples opinions on third party django charting apps, 
with various considerations. My primary consideration would ease of use by 
a django noob. Thanks

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




Re: getting information from a many to many model from user

2013-06-07 Thread tony gair
That would work nicely if I had done my own user management app but I 
lazily used Userena. I think I need to override a function of their profile 
form so it only displays fields if the superuser or a designated boolean in 
same said profile is set to true:)
Do you know how I would over ride a class function ?

On Thursday, 6 June 2013 13:02:02 UTC, Daniel Roseman wrote:
>
> On Thursday, 6 June 2013 11:00:40 UTC+1, tony gair wrote:
>
>>
>>
>>
>> I use the Userena app to manage my users but I want the superuser to 
>> choose the organisation for them so they cannot wonder around other 
>> organisations information.
>>
>> I can either create a foreign key in their profile to point to the 
>> organisation but then I expect they can change it, which would not be 
>> acceptable. 
>>
>> I could create a many to many set of models (as per the documentation) 
>> but then I need to discover the organisation they are part of, every time a 
>> form is entered into, in which case I would need a function to discover the 
>> organisation id from the querying the user object in my group model.
>>
>> My favourite would probably be to have unmodifiable fields (by them) but 
>> which the superuser can alter. Anyone know how I would do this?
>>
>>
>>
> Users can only alter fields if you write code that allows them to do so. 
> If you don't want them to alter a particular field in their profile, just 
> don't include that field on the form (or specifically exclude it).
> --
> DR.
>

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




Re: Some problems with Paginator

2013-06-07 Thread Federico Erbea
I'm really stupid, why i never think to the easiest way, never...I wrong 
"{% for film in attore.film_set.all %}" because i had write "{% for film in 
film_attore %}"...Sorry...;)

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




Re: Problem Django Admin app is read only!

2013-06-07 Thread Enaut Waldmeier


Am Donnerstag, 6. Juni 2013 23:42:25 UTC+2 schrieb Frank Bieniek:
>
>  Hi,
> who is serving your media files? apache?
> In debug mode django is not delivering them, if it is run through mod_wsgi
>
 
I know it is not about media files! The css aswell as the images are served 
correctly by apache. I just can't modify the entries of the "Belegung" app 
through django-admin.
 

> Greets from Ratingen
> Frank
>
>
> Am 06.06.13 17:08, schrieb Enaut Waldmeier:
>  
> Hi,
>
> I have a problem with django-admin whenever I deploy my page to the apache 
> server with DEBUG=False django-admin displys all the entries of this app as 
> if they had `has_change_permission(): return false`.
>
> I can't find any errors and it only happens on apache.
>
> what works and what does not: 
>
>- manage.py runserver `DEBUG=True` *works* 
> - manage.py runserver `DEBUG=False` *works* 
> - apache `DEBUG=True` *works* 
> - apache `DEBUG=False` *does not work* 
>
> *Works *means I can edit and it looks like:
>
> http://imodspace.iig.uni-freiburg.de/django/should.png
>
> *Does not work* means the entries are black and no modification via 
> django-admin is possible:
>
> http://imodspace.iig.uni-freiburg.de/django/state.png
>  
>
>  The code that generates the models: 
>
> class Belegung(models.Model):
> name = models.CharField(max_length=40)
> bemerkung = models.TextField(max_length=200, blank=True)
> begin = models.DateField()
> ende = models.DateField()
>
> def __unicode__(self): ...
>
> class Meta:
> verbose_name_plural = "Belegungen"
> ordering = ['begin']
>
>
> class CalendarContent(mainpage.ContentBlock):
> month = models.DateField()
>
> def __unicode__(self): ...
> def save(self, *args, **kwargs): ...
> def headline(self): ...
> def nexturl(self): ...
> def prevurl(self): ...
> def extract_begin_end(self, entries, day):...
> def weeks(self): ...
>
>
> class BelegungAdmin(admin.ModelAdmin):
> list_display = ["name", "bemerkung", "begin", "ende"]
> list_filter = ["begin"]
> admin.site.register(Belegung, BelegungAdmin)
>
>
> class CalendarContentAdmin(admin.ModelAdmin):
> exclude = ('content_type',)
> pass
> admin.site.register(CalendarContent, CalendarContentAdmin)
>
> Is there some secret switch or something else I have not yet found that can 
> make the fields disabled in django-admin?
>
> I'm just stuck here and would be greatfull for any advice.
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
>  

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