Re: django admin list_editable and custom manager bug?

2012-03-05 Thread Slafs
I'd like to bump this up. Since the rc1 is out I would like to know if this 
deserves a seperate ticket.

Regards


W dniu poniedziałek, 2 stycznia 2012, 22:19:09 UTC+1 użytkownik Slafs 
napisał:
>
> Oh 
>
> Maybe it has something to do with my previous report 
> https://code.djangoproject.com/ticket/13126 ?
>
> And one more thing to mention is that there's no error indication on the 
> changelist.
>
> Regards
>

-- 
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/-/6yFAqmEB4VwJ.
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: django admin list_editable and custom manager bug?

2012-01-02 Thread Slafs
Oh 

Maybe it has something to do with my previous report 
https://code.djangoproject.com/ticket/13126 ?

And one more thing to mention is that there's no error indication on the 
changelist.

Regards

-- 
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/-/UtMN4mn5KQgJ.
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 admin list_editable and custom manager bug?

2012-01-02 Thread Slafs
Hi there!

Can You please examine my code 
https://bitbucket.org/slafs/listeditexample/overview ?

I thinks there's a bug in django admin when using the list_editable with 
overriden queryset method and a custom default manager. Please refer to 
this small example for details. 
Is there anything similar reported already?

Regards

Sławek


-- 
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/-/DQ_8qp5P6lwJ.
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: DjangoCon US 2011 Videos

2011-09-21 Thread Slafs
I would be interested also in watching those videos

Regards

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



Odp: Re: RedirectView with query_string = True and urlencoded unicode string

2011-08-11 Thread Slafs
Should i report a ticket?

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



Odp: Re: RedirectView with query_string = True and urlencoded unicode string

2011-08-11 Thread Slafs
Oh sorry. Here it is

http://dpaste.com/591903/

File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py" in 
get_redirect_url  146. return url % kwargsException Type: 
ValueError at /test/Exception Value: unsupported format character 'C' (0x43) at 
index 15


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



RedirectView with query_string = True and urlencoded unicode string

2011-08-11 Thread Slafs
Hi there! 

I'm having difficulties with the new class based RedirectView with 
query_string = True and some unicode string in QUERY_STRING. 
I made a sample of the error on bitbucket 

https://bitbucket.org/slafs/redirectviewtest/src 

could You please explain what I'm doing wrong? or maybe it is a bug in a 
redirect view ? 
I've read the docs about the "%" sign in urls but I think this behaviour 
should not apply to args (query_string)

Regards

Sławek

-- 
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/-/0zE21qbsE0QJ.
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.



Odp: Re: Constructing / rendering a complex

2011-08-04 Thread Slafs
Hi!

Maybe You should take a look at http://pypi.python.org/pypi/django-tables2

Cheers

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



exclude field from SQL insert

2011-07-13 Thread Slafs
Hello. 

I have a model in Django that is based on database view. One of the fields 
is "virtual" (computed in the view) . 
I would like to exclude this field in my model from being used in SQL Insert 
and Update statements.

Do You know maybe how can I do that ?

Regards

-- 
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/-/u3KlDu41QPQJ.
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: django advent for 1.3

2011-02-02 Thread SlafS
OK. Thanks.

I agree that the number of new features isn't as big as in the 1.2
release and maybe there is no sense for another series before this
one. Although I would love to see an expert article about class based
views. I'm Little bit confused about it right now.

Cheers

On 2 Lut, 20:28, Dan Carroll <dancarr...@gmail.com> wrote:
> Not sure. I really enjoyed the 1.2 series of articles, but I'm not
> sure if they could even do something as big for the 1.3 release.  This
> release is mostly bug fixes, with a few big changes (static files,
> class-based generic views, and logging). With the 1.3 release due by
> the end of February, if the Django Advent guys (Rob Hudson and Idan
> Gazit hosted the first) haven't started yet, I think I would prefer
> them to focus their efforts on another big series targeted for the 1.4
> release.
>
> On Feb 2, 1:23 am, SlafS <slaf...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi there!
>
> > Is there going to be an advent article series for a 1.3 release?
>
> > Regards
>
> > Sławek

-- 
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 advent for 1.3

2011-02-02 Thread SlafS
Hi there!

Is there going to be an advent article series for a 1.3 release?

Regards

Sławek

-- 
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: write a filter for latex that escapes some chars

2010-10-30 Thread SlafS
thx for that.
It's not quite what I was looking for but it led me to the solution

Thank You.

On 29 Paź, 15:42, Brian Bouterse <bmbou...@gmail.com> wrote:
> We have done this before and used something like the code below.  This
> sample is pretty basic.
>
>    def fixchar(string,char):
>
>     #fixes chars for latex
>
>     if char == '<':
>
>         newchar = '$<$'
>
>     elif char == '>':
>
>         newchar = '$>$'
>
>     elif char == '~':
>
>         newchar = '\\~{}'
>
>     else:
>
>         newchar = '\\' + char
>
>     string = string.replace(char,newchar)
>
>     return string
>
>
>
>
>
>
>
>
>
> On Fri, Oct 29, 2010 at 9:03 AM, SlafS <slaf...@gmail.com> wrote:
> > Hi there!
>
> > I'm trying to write a filter that can be used inside of a template
> > that is used for generating latex files.
>
> > The filter should replace the '|' char with '\'. Simple:
>
> > @register.filter("verb_safe")
> > def verb_safe(val):
> >    return str(val).replace('|', '\|')
>
> > is outputting me '\\|'
>
> > I'm littlle confused about that.
>
> > Please help
>
> > Regards
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@google 
> > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> --
> Brian Bouterse
> ITng Services

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



write a filter for latex that escapes some chars

2010-10-29 Thread SlafS
Hi there!

I'm trying to write a filter that can be used inside of a template
that is used for generating latex files.

The filter should replace the '|' char with '\'. Simple:

@register.filter("verb_safe")
def verb_safe(val):
return str(val).replace('|', '\|')

is outputting me '\\|'

I'm littlle confused about that.

Please help

Regards

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



model forms/formset poor performance

2010-10-25 Thread SlafS
Hi there!

I'm developing a small django app with some models and modelformsets.
Using Django Debug-Toolbar I noticed the overhead (in my particular
case) which Django makes by performing extra queries to validate a
form in a formset

http://dpaste.com/hold/263886/

I know that this is needed in many cases, but in mine i would like to
reuse the objects evaluated from the queryset since performance is
crucial in my app. Can i somehow change this behaviour?

Regards

Sławek

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



what describes an url?

2010-09-30 Thread SlafS
Hi there!

I have a question about the urls.
What set of attributes of RegexURLPattern makes a "primary key" of all
the url patterns among applications in a Django project? (notice the
"" signs)

what i mean is: what is the minimal set of attributes of
RegexURLPattern that is sufficient to unambiguously describe all
urlpatterns in a Django project.

what im trying to make is an app that can show MyModel object on a
PAGE of other models/apps e.g on /page/A/. and i would like to
associate those two in an unobtrusive way. so i thought i can store in
MyModel some attributes of an url object so that i can resolve '/page/
A/' get some RegexURLPattern attributes and then search for an
appropriate MyModel object.

Is this even clear :/ ?

Regards

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



Re: url_name from resolve in Django 1.2

2010-09-13 Thread SlafS
It seems it's impossible for now.

So let me change the question.

How to use the already compiled (by Django) url_patterns so i dont
have to import and compile the ROOT_URLCONF on every hit of my
function?

Regards


On 9 Wrz, 22:52, SlafS <slaf...@gmail.com> wrote:
> Hi there!
>
> Is there any way to obtain a name of an url that Django URL dispatcher
> matched by resolving (or anything else) e.g. '/path/to/my/page/'? For
> now resolve returns a tuple :/.
>
> I assume that it will be available in 1.3 according to
>  http://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.ur...
>
> Regards

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



url_name from resolve in Django 1.2

2010-09-09 Thread SlafS
Hi there!

Is there any way to obtain a name of an url that Django URL dispatcher
matched by resolving (or anything else) e.g. '/path/to/my/page/'? For
now resolve returns a tuple :/.

I assume that it will be available in 1.3 according to
 
http://docs.djangoproject.com/en/dev/topics/http/urls/#django.core.urlresolvers.ResolverMatch

Regards

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



Re: Using PostgreSQL Blob from Django

2010-06-25 Thread SlafS
Lately i found the django-storages app and DatabaseStorage[1]
Haven't test it though. But using custom storage along with Django
FileField seems like a good idea.

Regards

Sławek

[1] http://code.welldev.org/django-storages/wiki/DatabaseStorage

On 25 Cze, 04:26, Kenneth Gonsalves  wrote:
> On Friday 25 June 2010 05:19:36 Daniel Espinosa Ortiz wrote:
>
> > I have a PHP application using PostgreSQL backend. I'm storing files
> > on the database. I have different tables with a file (OID), filename
> > and mime to detect the row's associated file. I'm trying to port this
> > application to django.
>
> > How Can Use this blob with django? Exist some suggestions about it?
>
> a. write a script to store the blobs on the file system and insert the 
> filename
> into the db which is how django handles blobs
>
> b. write a custom field to handle this
>
> I suggest you do 'a' as then all the django and django addon file/image
> handling functions will be available to you.
> --
> Regards
> Kenneth Gonsalves
> Senior Associate
> NRC-FOSS at AU-KBC

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



Re: annotate with query set for distinct values

2010-06-10 Thread SlafS
Yes, I'm aware of the background of the problem but i was wondering if
I can somehow "workaround" it.

Thanks for Your help

On 10 Cze, 23:34, Dan Harris <dih0...@gmail.com> wrote:
> The problem is the GROUP BY you are looking to get. The problem with
> doing a group by you don't get the whole object which is what the
> Django queryset is trying to return:
>
> res = queryset.annotate(Count("name"))
>
> This will give you a result set that you want and you can iterate over
> like:
>
> {% for r in res %}
>    {{ r.name }} - {{ r.name__count}}
> {% endfor %}
>
> however there may be duplicated {{ r.name }}
>
> Dan Harris
> dih0...@gmail.com
>
> On Jun 10, 5:24 pm, SlafS <slaf...@gmail.com> wrote:
>
> > Thanks.
>
> > I've already tried that but this isn't quite what i'm looking for. As
> > u wrote this returns a list, but I would like to obtain my calculated
> > property when I'm iterating over this. Like so (let's say the result
> > is in res variable) :
>
> > {% for r in res %}
> >    {{r.xxx}} - {{r.name__count}}
> > {% endfor %}
>
> > I'm starting to think that there's no such nice way to acheive that :/
>
> > On 10 Cze, 23:06, Dan Harris <dih0...@gmail.com> wrote:
>
> > > Here is an example:
>
> > > # In models.py
> > > class TestModel(models.Model):
> > >    name = models.CharField()
>
> > > # Get a listing of unique names and their counts
> > > # In some view
> > > from django.db.models import Count
>
> > > TestModel.objects.values("name").annotate(Count("name"))
>
> > > This will return a list of the form:
>
> > > [{'name__count': 2, 'name': u''}, {'name__count': 1, 'name':
> > > u'bbb'}]
>
> > > Hope this helps!
>
> > > Dan Harris
> > > dih0...@gmail.com
>
> > > On Jun 10, 5:01 pm, SlafS <slaf...@gmail.com> wrote:
>
> > > > Hi there!
> > > > I have a question. If i have a model with some fields (let's say all
> > > > CharFields named aaa,bbb,ccc etc. and some calculated properties named
> > > > xxx and zzz) how can I obtain something similar to
>
> > > > "SELECT aaa, count(aaa) FROM my_model_table GROUP BY aaa;"
> > > > i.e. a list of - lazy loaded - objects with distinct aaa values and an
> > > > extra column which indicates how many entries of a specific aaa are in
> > > > the table.
>
> > > > I would like to acheive that with QuerySet and annotate so that I can
> > > > get a list of objects to use their other properties (xxx or zzz) e.g.
> > > > in my template
>
> > > > Regards

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



annotate with query set for distinct values

2010-06-10 Thread SlafS
Hi there!
I have a question. If i have a model with some fields (let's say all
CharFields named aaa,bbb,ccc etc. and some calculated properties named
xxx and zzz) how can I obtain something similar to

"SELECT aaa, count(aaa) FROM my_model_table GROUP BY aaa;"
i.e. a list of - lazy loaded - objects with distinct aaa values and an
extra column which indicates how many entries of a specific aaa are in
the table.

I would like to acheive that with QuerySet and annotate so that I can
get a list of objects to use their other properties (xxx or zzz) e.g.
in my template

Regards

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



Re: annotate with query set for distinct values

2010-06-10 Thread SlafS
Thanks.

I've already tried that but this isn't quite what i'm looking for. As
u wrote this returns a list, but I would like to obtain my calculated
property when I'm iterating over this. Like so (let's say the result
is in res variable) :

{% for r in res %}
   {{r.xxx}} - {{r.name__count}}
{% endfor %}

I'm starting to think that there's no such nice way to acheive that :/

On 10 Cze, 23:06, Dan Harris <dih0...@gmail.com> wrote:
> Here is an example:
>
> # In models.py
> class TestModel(models.Model):
>    name = models.CharField()
>
> # Get a listing of unique names and their counts
> # In some view
> from django.db.models import Count
>
> TestModel.objects.values("name").annotate(Count("name"))
>
> This will return a list of the form:
>
> [{'name__count': 2, 'name': u''}, {'name__count': 1, 'name':
> u'bbb'}]
>
> Hope this helps!
>
> Dan Harris
> dih0...@gmail.com
>
> On Jun 10, 5:01 pm, SlafS <slaf...@gmail.com> wrote:
>
> > Hi there!
> > I have a question. If i have a model with some fields (let's say all
> > CharFields named aaa,bbb,ccc etc. and some calculated properties named
> > xxx and zzz) how can I obtain something similar to
>
> > "SELECT aaa, count(aaa) FROM my_model_table GROUP BY aaa;"
> > i.e. a list of - lazy loaded - objects with distinct aaa values and an
> > extra column which indicates how many entries of a specific aaa are in
> > the table.
>
> > I would like to acheive that with QuerySet and annotate so that I can
> > get a list of objects to use their other properties (xxx or zzz) e.g.
> > in my template
>
> > Regards

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



admin delete action

2010-03-17 Thread SlafS
Hi there!

Anyone else can't delete objects on admin change list with newest
Django (12801)?

When the list has list_editable fields it raises Validation Error

Is there a ticket already for this ?

Regards

---
stack:


Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/v/slafs/
Django Version: 1.2 beta 1 SVN-12801
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.admin',
 'v']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  100. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
options.py" in wrapper
  240. return self.admin_site.admin_view(view)(*args,
**kwargs)
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in
_wrapped_view
  74. response = view_func(request, *args,
**kwargs)
File "/usr/lib/python2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  69. response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
in inner
  194. return view(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in
_wrapper
  21. return decorator(bound_func)(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in
_wrapped_view
  74. response = view_func(request, *args,
**kwargs)
File "/usr/lib/python2.5/site-packages/django/utils/decorators.py" in
bound_func
  17. return func(self, *args2, **kwargs2)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
options.py" in changelist_view
  996. formset = cl.formset = FormSet(request.POST,
request.FILES, queryset=cl.result_list)
File "/usr/lib/python2.5/site-packages/django/forms/models.py" in
__init__
  408. super(BaseModelFormSet, self).__init__(**defaults)
File "/usr/lib/python2.5/site-packages/django/forms/formsets.py" in
__init__
  47. self._construct_forms()
File "/usr/lib/python2.5/site-packages/django/forms/formsets.py" in
_construct_forms
  91. for i in xrange(self.total_form_count()):
File "/usr/lib/python2.5/site-packages/django/forms/formsets.py" in
total_form_count
  70. return
self.management_form.cleaned_data[TOTAL_FORM_COUNT]
File "/usr/lib/python2.5/site-packages/django/forms/formsets.py" in
_management_form
  57. raise ValidationError('ManagementForm data is
missing or has been tampered with')

Exception Type: ValidationError at /admin/v/slafs/
Exception Value: [u'ManagementForm data is missing or has been
tampered with']

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



Best way to present proxy model data

2010-02-18 Thread SlafS
Hi there!

I am thinking about the best way of presenting some data from a proxy
model.

I have some model classes let's say: http://bpaste.net/show/3338/
and a view:
def proxy_view(request, year, month, day):
 qs = ExModel.objects.all()
 # maybe some stuff here with `some_logic` method
 # some extending qs maybe??? (but how?)
 return render(request, ...)

what i'm struggling is when i want to display my objects in a template
I don't know how to nicely gain access to proxy model data
(`some_logic` value with appropriate `date` param build with `year`,
`month` and `day`):

{% for object in qs %}

   {{ object.name }}
   {{ object.some_attr }}
   {#{ what now? how to display some_logic value? }#} 

{% endfor %}


My first solutions are:
1) build a template tag which will take object, date and method_string
(`some_logic) as a param and then invoke the some_logic method with
date param and return appropriate value.
2) somehow (i dont know how) extend each object of qs in a view (like
an annotate method maybe?) and then just pass modified qs to the
template and then simply display values

Any suggestions ?

Thanks in advance.

Sławek

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



Re: some modifications of Django admin change_list

2010-01-20 Thread SlafS
any chance for help? please.

On 20 Sty, 00:43, SlafS <slaf...@gmail.com> wrote:
> Hi there!
>
> I need to do some changes in the django admin change_list template (I
> think so). What I need is to add some class or id (html) to every
> displayed row (that list is a tree with mptt) so i can add a
> javascript accordion when clicking given row. I noticed the
> templatetag {% result_list cl %} and it's template
> change_list_results.html but how can I gain access to some attrs of
> the queryset(?) on that list?
>
> Maybe my approach is bad? Please correct me if so. Basicly I want my
> tree to have some JS accordion with minimal effort within django
> templates (i don't mean JS code).
>
> Thanks in advance
>
> Regards
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




some modifications of Django admin change_list

2010-01-19 Thread SlafS
Hi there!

I need to do some changes in the django admin change_list template (I
think so). What I need is to add some class or id (html) to every
displayed row (that list is a tree with mptt) so i can add a
javascript accordion when clicking given row. I noticed the
templatetag {% result_list cl %} and it's template
change_list_results.html but how can I gain access to some attrs of
the queryset(?) on that list?

Maybe my approach is bad? Please correct me if so. Basicly I want my
tree to have some JS accordion with minimal effort within django
templates (i don't mean JS code).

Thanks in advance

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




Re: Editors of choice

2009-09-10 Thread slafs

Vim
with omnicompletion (CTRL+X, CTRL+O), filetype=htmldjango, TList and
NERDTree

Regards

On Sep 9, 9:31 am, Benjamin Buch  wrote:
> I second that.
>
>
>
> > Vim
>
>
--~--~-~--~~~---~--~~
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: Logging mechanism in Django

2009-08-18 Thread slafs

Hi!

Found this about django-logging also...

http://ericholscher.com/blog/2008/aug/29/screencast-2-logging-fun-and-profit/

Regards

On Aug 18, 12:30 am, Rafael Ferreira  wrote:
> the problem is that logging to a file is not going to work in a multiprocess
> environment. I'm using the logging library configured to log to syslog with
> fcgi and it is working out quite well.
>
> On Mon, Aug 17, 2009 at 11:10 AM, Mike Ramirez  wrote:
> > On Monday 17 August 2009 10:24:18 am Lokesh Maremalla wrote:
> > > Hi,
>
> > > Included django-logging as described in the link.
>
> > > From the django-logging I can view the log messages on the screen at run
> > > time. But, I am not sure on saving the log messages from django-logging.
> > > Can I capture the log messages into my log file on a daily basis instead
> > of
> > > redirecting to screen.
>
> > > Regards,
> > > Lokesh
>
> > you would set up the file access similar to using the python logging module
> > [1]
>
> > import logging
> > logging.FileHandler('myfile')
>
> > Mike
>
> > [1]
>
> >http://www.mechanicalcat.net/richard/log/Python/Simple_usage_of_Pytho...
>
> > This is also linked on django-logging's overview page.
>
> > --
> > "Hard work now leads to less work full stop"
>
> >        - Alan Cox
>
>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



ORACLE_HOME in wsgi script

2009-06-04 Thread SlafS

Hi!

I'm trying to run Django app with mod_wsgi and Oracle, but when I try
to configure it I always get an internal server error (500) with this
error.log:

ImproperlyConfigured: Error loading cx_Oracle module: libclntsh.so.
11.1: cannot open shared object file: No such file or directory

It seems that there's no ORACLE_HOME or LD_LIBRARY_PATH but my script
looks like:

import os
import sys

sys.path.append('/home/slafs/django2/djproj/')
sys.path.append('/home/slafs/django2/djproj/projekty/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'projekty.settings_oracle2'
os.environ['PYTHON_EGG_CACHE'] = '/home/slafs/django2/djproj/egg-
cache'
os.environ['ORACLE_HOME'] = '/home/slafs/paczki/instantclient_11_1'
os.environ['LD_LIBRARY_PATH'] = '/home/slafs/paczki/
instantclient_11_1'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

and I'm wondering what's wrong...
Can anyone help me ?

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



Oracle unicode sorting

2009-06-04 Thread SlafS

Hi there!

I've got a Django app working on the Oracle backend. I have a table/
model with a char field and I store there strings (names) that contain
polish letters. On the admin panel when I sort those names, ones that
are starting with polish letters are after those that are starting
with letter 'z'. Weird thing is that $ORACLE_HOME/sqlplus is sorting
correctly the query and moreover even cx_Oracle sample
'ReturnUnicode.py' is printing the results correctly.

my model looks like this (sorry for polish naming) :
#encoding: utf-8

class Projekt(models.Model):
id = models.AutoField(db_column='id', primary_key=True)
nazwa = models.CharField(db_column='nazwa', unique=True,
max_length = 100)
...
class Meta:
db_table = 'Projekty'
verbose_name = _(u'Projekt')
verbose_name_plural = _(u'Projekty')
ordering = ['nazwa']
def __unicode__(self):
return u"%s" % (self.nazwa[:35],)

Can anyone tell me what could be the issue ?

Regards

--~--~-~--~~~---~--~~
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: Test client DoesNotExists exception

2009-06-02 Thread Slafs

Thanks a lot!
That was it!

Regards

On 3 Cze, 00:21, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Jun 2, 2009 at 4:30 PM, SlafS <slaf...@gmail.com> wrote:
>
> > Hi!
>
> > Im trying to test my app with django test Client.
> > When I try to do 'get' to the '/accounts/' which in my urls.py is
> > equiv to generic login view I get DoesNotExists exception and a
> > traceback. check it herehttp://dpaste.com/50688/.
> > Can You tell me what am I doing wrong ?
>
> You've apparently got  'django.contrib.sites' listed in your INSTALLED_APPS
> and you have set SITE_ID in your settings file to a value that has no match
> in your Sites table.  As mentioned here:
>
> http://docs.djangoproject.com/en/dev/ref/contrib/sites/#how-django-us...
>
> the auth app's login view, which the url you are testing is mapped to,
> attempts get the current site name (if the sites app is installed) and pass
> it as the variable site_name to the template.  It's not finding a match when
> it attempt to retrieve the currents (i.e. SITE_ID) site.
>
> > PS. when Im 'get'ing 'accounts/' I Get the "TypeError: 'NoneType'
> > object is not iterable"
>
> I believe that's ticket #10834:
>
> http://code.djangoproject.com/ticket/10834
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Test client DoesNotExists exception

2009-06-02 Thread SlafS

Hi!

Im trying to test my app with django test Client.
When I try to do 'get' to the '/accounts/' which in my urls.py is
equiv to generic login view I get DoesNotExists exception and a
traceback. check it here http://dpaste.com/50688/ .
Can You tell me what am I doing wrong ?

PS. when Im 'get'ing 'accounts/' I Get the "TypeError: 'NoneType'
object is not iterable"

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