Re: Problem Django Admin app is read only!

2013-06-06 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.




Re: problem with logical and

2013-06-06 Thread Mike Dewhirst

On 7/06/2013 1:31pm, Mike Dewhirst wrote:

I can't work this one out. I have a blind spot. Any help appreciated.


Accidentally fixed this trying workarounds. Still not sure what was 
happening but I suspect I don't fully understand None in the boolean 
context. Anyway, I'm being more explicit now - with some success!


Sorry to bother you ...

Mike



My unit tests indicate a problem with the following method (is_current)
on a model. Because I couldn't figure it out I instrumented with a whole
mess of print statements. The problem occurs on the line with
self.quality_tag. Note the print statement before and after ...

 def is_current(self):
 current = self.effective and self.effective <= when()
 print('\n%s %s - when = %s' %(current, self.effective, when()))

 print('\n%s - 1 quality_tag = %s' % (current, self.quality_tag))
 current = current and (self.quality_tag is None)
 print('\n%s - 2 quality_tag = %s' % (current, self.quality_tag))

 current = current and not self.withdrawn
 print('\n%s - withdrawn = %s' %(current, self.withdrawn))
 return current

Here is the unit test output ... which seems to indicate there is a bug
in (my) boolean logic where (self.quality_tag is None) returns False
instead of True when self.quality_tag really *is* None

True 2013-06-07 03:18:14.418000+00:00 - when = 2013-06-07
03:18:15.231000+00:00

True - 1 quality_tag = None

False - 2 quality_tag = None

False - withdrawn = False
F
==
FAIL: test_attach_current (items.tests.test_utils.TestAttach)
--
Traceback (most recent call last):
   File "C:\users\miked\py\xxx_project\xxx\items\tests\test_utils.py",
line 272, in test_attach_current
 self.assertEqual(obj.is_current(), True)
AssertionError: False != True

--

Windows XP
Python 2.7
Django 1.5

Thanks

Mike



--
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-06 Thread Ariel V. R.
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.




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

2013-06-06 Thread Ariel V. R.
Hello:

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.




problem with logical and

2013-06-06 Thread Mike Dewhirst

I can't work this one out. I have a blind spot. Any help appreciated.

My unit tests indicate a problem with the following method (is_current) 
on a model. Because I couldn't figure it out I instrumented with a whole 
mess of print statements. The problem occurs on the line with 
self.quality_tag. Note the print statement before and after ...


def is_current(self):
current = self.effective and self.effective <= when()
print('\n%s %s - when = %s' %(current, self.effective, when()))

print('\n%s - 1 quality_tag = %s' % (current, self.quality_tag))
current = current and (self.quality_tag is None)
print('\n%s - 2 quality_tag = %s' % (current, self.quality_tag))

current = current and not self.withdrawn
print('\n%s - withdrawn = %s' %(current, self.withdrawn))
return current

Here is the unit test output ... which seems to indicate there is a bug 
in (my) boolean logic where (self.quality_tag is None) returns False 
instead of True when self.quality_tag really *is* None


True 2013-06-07 03:18:14.418000+00:00 - when = 2013-06-07 
03:18:15.231000+00:00


True - 1 quality_tag = None

False - 2 quality_tag = None

False - withdrawn = False
F
==
FAIL: test_attach_current (items.tests.test_utils.TestAttach)
--
Traceback (most recent call last):
  File "C:\users\miked\py\xxx_project\xxx\items\tests\test_utils.py", 
line 272, in test_attach_current

self.assertEqual(obj.is_current(), True)
AssertionError: False != True

--

Windows XP
Python 2.7
Django 1.5

Thanks

Mike

--
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: Cant get to admin login page

2013-06-06 Thread Gladson Simplício Brito
you forgot:
https://docs.djangoproject.com/en/dev/intro/tutorial01/#database-setup

configs in settgins.py

manage.py syncdb


2013/6/6 Rebecca 

> I'm on part 2 of the django book tutorial (
> https://docs.djangoproject.com/en/dev/intro/tutorial02/) and am trying to
> get onto the admin login page in my browser.  When I go to the admin site
> on my local domain (http://127.0.0.1:8000/admin/), I dont get to the
> login screen.  I get to something else from django
>
> "
> It worked!Congratulations on your first Django-powered page.
>
> Of course, you haven't actually done any work yet. Here's what to do next:
>
>- If you plan to use a database, edit the DATABASES setting in
>myproject/settings.py.
>- Start your first app by running python manage.py startapp [appname].
>
> You're seeing this message because you have DEBUG = True in your Django
> settings file and you haven't configured any URLs. Get to work!"
>
>
>
> but not the login screen it said i would get in the tutorial.  Anyone know
> why? or how to get to the login page?
>
>
> 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: Cant get to admin login page

2013-06-06 Thread Nikolas Stevenson-Molnar
And also did you uncomment the appropriate lines to enable the admin
app?
https://docs.djangoproject.com/en/1.5/intro/tutorial01/#activating-models

_Nik

On 6/6/2013 2:53 PM, Rebecca wrote:
> I'm on part 2 of the django book tutorial
> (https://docs.djangoproject.com/en/dev/intro/tutorial02/) and am
> trying to get onto the admin login page in my browser.  When I go to
> the admin site on my local domain (http://127.0.0.1:8000/admin/), I
> dont get to the login screen.  I get to something else from django 
>
> "
>
>
>   It worked!
>
>
> Congratulations on your first Django-powered page.
>
> Of course, you haven't actually done any work yet. Here's what to do next:
>
>   * If you plan to use a database, edit the |DATABASES| setting
> in |myproject/settings.py|.
>   * Start your first app by running |python manage.py startapp [appname]|.
>
> You're seeing this message because you have |DEBUG = True| in your
> Django settings file and you haven't configured any URLs. Get to work!"
>
>
>
> but not the login screen it said i would get in the tutorial.  Anyone
> know why? or how to get to the login page?
>
>
> 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: Cant get to admin login page

2013-06-06 Thread Nikolas Stevenson-Molnar
Did you configure your database in settings.py as described in part 1?

_Nik

On 6/6/2013 2:53 PM, Rebecca wrote:
> I'm on part 2 of the django book tutorial
> (https://docs.djangoproject.com/en/dev/intro/tutorial02/) and am
> trying to get onto the admin login page in my browser.  When I go to
> the admin site on my local domain (http://127.0.0.1:8000/admin/), I
> dont get to the login screen.  I get to something else from django 
>
> "
>
>
>   It worked!
>
>
> Congratulations on your first Django-powered page.
>
> Of course, you haven't actually done any work yet. Here's what to do next:
>
>   * If you plan to use a database, edit the |DATABASES| setting
> in |myproject/settings.py|.
>   * Start your first app by running |python manage.py startapp [appname]|.
>
> You're seeing this message because you have |DEBUG = True| in your
> Django settings file and you haven't configured any URLs. Get to work!"
>
>
>
> but not the login screen it said i would get in the tutorial.  Anyone
> know why? or how to get to the login page?
>
>
> 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.




Cant get to admin login page

2013-06-06 Thread Rebecca
I'm on part 2 of the django book tutorial (
https://docs.djangoproject.com/en/dev/intro/tutorial02/) and am trying to 
get onto the admin login page in my browser.  When I go to the admin site 
on my local domain (http://127.0.0.1:8000/admin/), I dont get to the login 
screen.  I get to something else from django 

"
It worked!Congratulations on your first Django-powered page.

Of course, you haven't actually done any work yet. Here's what to do next:

   - If you plan to use a database, edit the DATABASES setting in 
   myproject/settings.py.
   - Start your first app by running python manage.py startapp [appname].

You're seeing this message because you have DEBUG = True in your Django 
settings file and you haven't configured any URLs. Get to work!"



but not the login screen it said i would get in the tutorial.  Anyone know 
why? or how to get to the login page?


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: Understanding an existing big web application written in Django

2013-06-06 Thread Dow Street
I also find it helpful to generate a diagram of the model relationships - e.g. 
using graph_models in django-extensions:

http://pythonhosted.org/django-extensions/



On Jun 6, 2013, at 7:06 AM, si  wrote:

> I have already existing web application code written by a someone else now I 
> need to work on it.
> So I am trying to understand the architecture of the various classes and 
> interaction. I want to know where jump in and how to understand the 
> architecture of the code.
> Urls.py seems to be a good place to start off. 
> Thanks for the suggestions. 
> 
> -- 
> 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: Problem Django Admin app is read only!

2013-06-06 Thread 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

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+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-06 Thread Javier Guerra Giraldez
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'



--
Javier

-- 
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-06 Thread Sam Walters
Hi

In addition to what has already been said.

Make use of command line search tools. Hoe to search through all the python
files using BASH is a good example.

eg: In one of my projects i have to find all the places where a particular
class is called or instantiated: 'LocationAirfieldLookup'

find . -name '*.py' -exec grep -E -H -n 'import LocationAirfieldLookup'
'{}' \; -print

will return every python file where that is instantiated:
/users/views.py:94:from Aeroclub.common.LocationsUtils import
LocationAirfieldLookup

Very useful.

Firstly, get an idea of what each 'app' eg: polls app in the tutorial is
supposed to do. Where its functionality starts/ends, what common resources
it uses.

Then i look at the various urls.py files with a conventional analoge
notepad nearby to map out some of the important stuff.

I also look at models.py for important parts of the software.(afterall this
is how it uses the DB). Here you may want to use a tool like grep to just
get the class names.
models often have a lot of custom functionality in them. Eg: cusomised
'save' methods etc.

This all really boils down to good documentation practices. If there's good
docs then its easier, otherwise expect to spend a day or two learning to
understand the program.

cheers




On Thu, Jun 6, 2013 at 2:06 PM, si  wrote:

> I have already existing web application code written by a someone else now
> I need to work on it.
> So I am trying to understand the architecture of the various classes and
> interaction. I want to know where jump in and how to understand the
> architecture of the code.
> Urls.py seems to be a good place to start off.
> Thanks for the suggestions.
>
> --
> 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: django1.5 - url resolver vs i18n_patterns : wrong behaviour

2013-06-06 Thread Ivan Tatarchuk
Not shure if I understand you correctly, but if I use static linking all 
works fine.
Problem appears only with dynamic linking(like in admin templates).
Is this a feature or a kind of bug? 
really want to use django's i18n_patterns in my project, but can't 
understand how to escape from this case. ='(

вторник, 4 июня 2013 г., 17:38:05 UTC+3 пользователь Ramiro Morales написал:
>
> On Tue, Jun 4, 2013 at 6:23 AM, Ivan Tatarchuk 
> > wrote: 
>
> > from django.conf.urls import patterns, include, url 
> > from django.conf.urls.i18n import i18n_patterns 
> > 
> > urlpatterns = patterns('', 
> > url(r'^admin/', include(admin.site.urls)), 
> > ) 
> > 
> > urlpatterns += i18n_patterns('', 
> > #   url(r'^other/', include('apps.other.urls')), 
> > } 
> > 
> > now {% url 'admin:password_change' %} resolved as 
> 'admin/password_change' 
> > (normal behaviour) 
> > but if we uncomment line in i18n_patterns it will be resolved  as 
> > 'curr_lang/admin/password_change' 
> > 
> > Can somebody explaine my why? 
>
> Can you try to isolate reduce and isolate your environment to something 
> similar 
> to a test case so we can find the reason of that behavior? 
>
> I've just added a test to our test suite exercising (correct behavior 
> in) a similar scenario: 
>
>
> https://github.com/django/django/blob/master/tests/i18n/patterns/urls/default.py#L9
>  
>
> https://github.com/django/django/blob/master/tests/i18n/patterns/urls/included.py
>  
>
> https://github.com/django/django/blob/master/tests/i18n/patterns/tests.py#L52 
>
> The only difference is that in your case you are including the admin 
> dynamic, 
> namespaced url map so laying with some variation there would be a good way 
> to 
> get further. 
>
> Regards, 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

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




Some problems with Paginator

2013-06-06 Thread Federico Erbea


I'm new in python and django, so i'm sorry for the stupid question...:)

This is in views.py

def attore(request, id):
attore = get_object_or_404( Attore, pk=id )
# return render_to_response('Attore.html', { 'film': Film.objects.filter( 
attori=attore ), 'attore': attore })
film_attore = Film.objects.filter( attori=attore )
paginator = Paginator( film_attore, 1 )
try:
pagina = int( request.GET.get( "pagina", "1" ) )
except ValueError:
pagina = 1
try:
pagine = paginator.page( pagina )
except ( EmptyPage, InvalidPage ):
pagine = paginator.page ( paginator.num_pages )
return render_to_response('Attore.html', { 'film_attore': pagine, 'pagine': 
range( 1, paginator.num_pages + 1 ) } )

And this in the template:

{% for attore in film_attore %}{{ attore.nome }}
   {% for film in attore.film_set.all %}
  {{ film.titolo }}
  {% for umori in film.umori.all %}{{ umori.umore }}{% endfor %}
   {% endfor %}
{% endfor %}

{% if film_attore.has_previous %}
  precedente
{% endif %}
{% for i in pagine %}
{% if i != film_attore.number %}
  {{ i }}
{% else %}
  {{ i }}
{% endif %}
{% endfor %}
{% if film_attore.has_next %}
  successivo
{% endif %}


But in this way it doesn't work because it don't load anything. If i delete 
"{% for attore in film_attore %}" and add "'attore':attore" in the 
dictionary in the views and obviously it load the element but four element 
for each page even if I wrote 1. Someone can halp me, i miss something but 
i don't understand what...Thanks all of you

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




Problem Django Admin app is read only!

2013-06-06 Thread 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+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: django's database system

2013-06-06 Thread Vernon D. Cole
You can write a "django management command" which runs on a workstation.  
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/

I use this a lot for command-line operation to do batch processing kinds of 
things.
Since "django is just Python", there is nothing to prevent you from running 
a GUI application the same way, and using the django ORM.


On Thursday, June 6, 2013 2:24:35 PM UTC+1, Amirouche wrote:
>
> peewee  looks more like django ORM
>
>
> 2013/6/5 Nikolas Stevenson-Molnar >
>
>> Have you had a look at SQLAlchemy? http://www.sqlalchemy.org/
>>
>> _Nik
>>
>> On 6/5/2013 3:29 AM, heni yemun wrote:
>> > Hi,
>> > I'm starting to develop some python program to address some database
>> > needs- this is for desktop usage not on the web. So i was wondering if
>> > django's database system can be integrated to my program instead of
>> > writing the routing python database access api. I like django's easy
>> > interface. THANK YOU!
>> > --
>> > 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...@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: Understanding an existing big web application written in Django

2013-06-06 Thread sidddd
I have already existing web application code written by a someone else now 
I need to work on it.
So I am trying to understand the architecture of the various classes and 
interaction. I want to know where jump in and how to understand the 
architecture of the code.
Urls.py seems to be a good place to start off. 
Thanks for the suggestions. 

-- 
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-06 Thread sidddd
Thank you for the blog it is helpful.

On Wednesday, 5 June 2013 22:17:45 UTC-4, Siddharth Shah wrote:
>
> I think you can definitely learn from:
> http://dangoldin.com/2013/05/07/eighteen-months-of-django/. 
>
> Lots of pointers and tips. My suggestion would be pick up a popular site 
> Hacker News, AirBnB, Kickstarter etc and try to write a clone. 
>
> Thank you, 
> Sidharth
>
> On Thursday, June 6, 2013 5:53:06 AM UTC+5:30, si wrote:
>>
>> I am a beginner in web dev and I built few small Django web apps like 
>> blogging application etc. Now I am in a fix as I need to understand a big 
>> web app written in Django and I dont know where to start.
>>
>> Can anyone suggest me how to understand an existing Django code, I mean 
>> where should I start looking at ? Is there a software which will show a MVC 
>> visual of the code?
>>
>> Thanks in Advance.
>>
>

-- 
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: django's database system

2013-06-06 Thread Amirouche Boubekki
peewee  looks more like django ORM


2013/6/5 Nikolas Stevenson-Molnar 

> Have you had a look at SQLAlchemy? http://www.sqlalchemy.org/
>
> _Nik
>
> On 6/5/2013 3:29 AM, heni yemun wrote:
> > Hi,
> > I'm starting to develop some python program to address some database
> > needs- this is for desktop usage not on the web. So i was wondering if
> > django's database system can be integrated to my program instead of
> > writing the routing python database access api. I like django's easy
> > interface. THANK YOU!
> > --
> > 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.
>
>
>

-- 
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-06 Thread Daniel Roseman
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: Is there any good tutorial on how to daemonize celery?

2013-06-06 Thread Michael Thon
> CELERY_RESULT_BACKEND = "database"
> CELERY_RESULT_DBURI = 
> "postgresql://"+get_env_setting('DB_USER')+":"+get_env_setting('DB_PASSWD')+"@localhost/"+get_env_setting('DB_NAME')
>  

> Now I tried to run it with this manage.py command
> 
> python manage.py celery worker --app=project.settings.production
> 
> It's starting up succesfully but I'm seeing several KeyErrors that celery 
> received an unregistered task. I tried inserting the solutions I found when I 
> researched. For example, adding a setting CELERY_IMPORTS hasn't solved it. 
> Restarting celery also didn't help. Any idea why this could be happening?
> 

What happens if you don't set CELERY_RESULT_DBURI and CELERY_RESULT_BACKEND ?

-- 
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: A ready made python/django validation class

2013-06-06 Thread Daniel Roseman
On Thursday, 6 June 2013 12:08:14 UTC+1, niiati wrote:

> Hello Snr Python/Django programmers,
>
> I am very new to python/Django and I find writing validation classes for 
> my application very tedious and repetitive. I am wondering if there is a 
> ready made class for validation. I mean validating things like date, 
> integers, address, currency and stuff like that.
>
> Please help.
>

You're doing things wrong if you're validating dates and integers.  They 
are validated for you as long as you use the correct fields (DateField and 
IntegerField, for example).
--
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.




A ready made python/django validation class

2013-06-06 Thread niiati
Hello Snr Python/Django programmers,

I am very new to python/Django and I find writing validation classes for my 
application very tedious and repetitive. I am wondering if there is a ready 
made class for validation. I mean validating things like date, integers, 
address, currency and stuff like that.

Please help.

-- 
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: Django foreing keys joins

2013-06-06 Thread Jani Tiainen
That is how Django works. 

So as you see, django makes query where it compares _joined_ table id as a 
null. To make it happen (left outer) join must happen, otherwise it wouldn't 
return any rows.

I agree that Django _could_ do a better and optimize query so that it would 
query instead of underlying fk field as a null value, though that would not be 
simple since a you know, filters may be chained and in case of chaining 
rewriting whole query would require quite a bit of reworkings.

If you absolutely know that your query stops there you can use underlying id 
field for faster testing:

>>> print Counter.on_medicos.filter(loc_id__isnull=True).only('id').query

That should return what you might have been expecting.

-- 

Jani Tiainen

"Impossible just takes a little longer"

On Thu, 6 Jun 2013 01:05:32 +0200
Àlex Pérez  wrote:

> Can someone tell me why the or in that query:
> print Counter.on_medicos.filter(loc__isnull=True).only("id").query
> 
> ""SELECT `web_counter`.`id` FROM `web_counter` LEFT OUTER JOIN
> `locations_localidad` ON (`web_counter`.`loc` = `locations_localidad`.`id`)
> WHERE (`web_counter`.`mode` = 1  AND `locations_localidad`.`id` IS NULL)"""
> 
> The orm is making a JOIN?? i can't understant!
> 
> The foreignkey loc is nullable and blank, i don't understant why making a
> filter the orm is performing the join and making an exclude the ORM is not
> performing the JOIN...
> 
> print Counter.on_medicos.exclude(loc__isnull=True).only("id").query
> SELECT `web_counter`.`id` FROM `web_counter` WHERE (`web_counter`.`mode` =
> 1  AND NOT (`web_counter`.`loc` IS NULL))
> 
> Thank's!
> 
> -- 
> Alex Perez
> alex.pe...@bebabum.com
> 
>  *bebabum* be successful
> 
> c/ Còrsega 301-303, Àtic 2
> 08008 Barcelona
> http://www.bebabum.com
> http://www.facebook.com/bebabum
> http://twitter.com/bebabum
> 
> This message is intended exclusively for its addressee and may contain
> information that is confidential and protected by professional privilege.
> If you are not the intended recipient you are hereby notified that any
> dissemination, copy or disclosure of this communication is strictly
> prohibited by law.
> 
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si no es vd. el destinatario
> indicado,
> queda notificado que la utilización, divulgación y/o copia sin autorización
> está prohibida en virtud de la legislación vigente.
> 
> Le informamos que los datos personales que facilite/ha facilitado pasarán a
> formar parte de un fichero responsabilidad de bebabum, S.L. y que tiene
> por finalidad gestionar las relaciones con usted.
> Tiene derecho al acceso, rectificación cancelación y oposición en nuestra
> oficina ubicada en c/ Còrsega 301-303, Àtic 2 de Barcelona o a la dirección
> de e-mail l...@bebabum.com
> 
> -- 
> 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: Is there any good tutorial on how to daemonize celery?

2013-06-06 Thread manuga...@gmail.com
Mike,

Thanks for the last reply! That gives some clarity. So I put the following
settings in my settings file.
_

BROKER_URL = "amqp://:@localhost:5672/"
CELERY_RESULT_BACKEND = "database"

CELERY_RESULT_DBURI =
"postgresql://"+get_env_setting('DB_USER')+":"+get_env_setting('DB_PASSWD')+"@localhost/"+get_env_setting('DB_NAME')

# CELERY_IMPORTS = ('tasks','users.tasks',)

# put these two lines at the very bottom of the settings file
import djcelery
djcelery.setup_loader()

from celery import Celery
celery = Celery(broker=BROKER_URL)
___

Now I tried to run it with this manage.py command

python manage.py celery worker --app=project.settings.production

It's starting up succesfully but I'm seeing several KeyErrors that celery
received an unregistered task. I tried inserting the solutions I found when
I researched. For example, adding a setting CELERY_IMPORTS hasn't solved
it. Restarting celery also didn't help. Any idea why this could be
happening?

Regards,



On 5 June 2013 21:29, Mike  wrote:

>
>
> On Wednesday, June 5, 2013 5:42:39 PM UTC+2, Manu wrote:
>
>> Mike,
>>
>> Please find my replies below.
>>
>> On 5 June 2013 20:27, Mike  wrote:
>>
>>> Thats why I installed it using the package provided in my Ubuntu linux
>>> server.  Then I used the template .conf file (I think from the celery
>>> documentation) and customized it for my project.  I did have some trouble
>>> to get it running the first time but I think there is a delay between when
>>> you restart supervisord and when the daemons it controls restart.  In fact,
>>> I don't use the 'restart' command to restart supervisord, I use to 'stop'
>>> and then confirm that the celery processes have stopped by using 'ps'.
>>>  then I use '/etc/init.d/supervisord start' to start it up again.
>>>
>>
>> Ok, I'll look into that.
>>
>>>
>>> Is your worker running fine when you execute:
>>> python manage.py celery worker
>>> ?
>>>
>>  I'm getting an error that it's unable to import some of the files in my
>> django project. This, even when I run after activating my virtual
>> environment.
>>
>>>
>>>
>>> In your SO question you say that you have set up  /etc/default/celeryd
> but you don't need this for running celery in a Django project.  In your
> settings.py file you should have this:
>
> import djcelery
> djcelery.setup_loader()
> BROKER_URL = 'amqp://guest:guest@localhost:5672//'
> (BROKER_URL should be set to whatever broker you're using)
>
> your INSTALLED_APPS should also have 'djcelery'
>
> get the command 'python manage.py celery worker' working first, before you
> mess around with supervisor or init scripts.  If you can't run a worker on
> the command line it probably won't work in a daemon either.
>
>
>
> --
> 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/F0dH6WdwFBA/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.
>
>
>



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




getting information from a many to many model from user

2013-06-06 Thread tony gair



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?


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