2 url template tag questions

2011-08-22 Thread Yaşar Arabacı
Hi,

If a use url template tag on a generic view, does urls.py supply required
arguments? For example:

urlpatterns = patterns('django.views.generic.date_based',
(r'^arsiv/(?P\d{4})/$','archive_year',{
'template_name' : 'blog/yillar.html',
'date_field' : 'pub_date',
'queryset' : Post.objects.filter(yayinlandi=True),
'extra_context' : common_data,
'make_object_list' : True,
'template_object_name' : 'makale'
}),
)

Can I access this url with {% url
django.views.generic.date_based.archive_index asdfasdf.year %}

And also, I am using rss framework like this:

from feeds import LatestPosts, TagFeed
urlpatterns += patterns('',
(r'^rss/$', LatestPosts()),
(r'^tag/(?P[^/]+)/rss/$', TagFeed()),
)

Can I access this via url template tag?
-- 
http://yasar.serveblog.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: What I am missing is this Django "logout"?

2011-08-22 Thread Andre Lopes
Hi, thanks your your reply.

And what should be the right way of doing this?

Best Regards,



On Sun, Aug 21, 2011 at 5:00 AM, Subhranath Chunder
 wrote:
> No, it's working is not a mistake by itself. Because now, the regular
> expression is extracting an absolute path, and not a relative url path.
> But, you are surely using things "the wrong way". :)
>
> On Sun, Aug 21, 2011 at 4:57 PM, Andre Lopes  wrote:
>>
>> Hi,
>>
>> Thanks for the reply.
>>
>> I have discovered that If I use this:
>>
>> [code]
>> Welcome {{ request.user.username }}. Logout
>> [/code]
>>
>> Instead of:
>>
>> [code]
>> Welcome {{ request.user.username }}. Logout
>> [/code]
>>
>> I got the code working as expected. The thing is that I got an URL
>> like this: http://localhost:8080/logout//directorio//
>>
>> This should be working like this, or this is just a mistake that works?
>>
>>
>> PS: Sorry my english.
>>
>> On Sat, Aug 20, 2011 at 10:35 PM, Subhranath Chunder
>>  wrote:
>> >> Welcome {{ request.user.username }}. Logout
>> > This part of your code is generating a logout URL like this in your
>> > template: "/logout/directorio"
>> > Now, your urls.py has the pattern:
>> > url(r'^logout/(?P.*)/$',
>> > 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >
>> > This makes, the variable 'next_page' assign the value after the slash
>> > 'login/' section. i.e. next_page = 'directorio'
>> > Now, the logout view is invoked and it's code gets executed. But since
>> > you
>> > provided a relative url value to this view, a http 302 is issued to the
>> > client to fetch the new url. Formed as a result of joining you current
>> > url
>> > and the relative path. i.e. '/login/directorio/directorio'. Which is
>> > basically again matching with the last url pattern. So, this whole thing
>> > keeps on going in a loop where:
>> > '/logout/directorio' is requested the first time. In response, the
>> > client is
>> > requested to fetch url,
>> > '/logout/directorio/directorio' the second time...
>> > '/logout/directorio/directorio/directorio/directorio' the third time...
>> > and so on and on in a loop.
>> > This is why you never see the expected output in the page. The actual
>> > logout
>> > is done in the first request only.
>> > So, when you refresh the page, you are basically pre-empting your
>> > browser
>> > client to break the initial loop, and manually requesting for the new
>> > fetch
>> > request.
>> > I hope I was able to clear the reason behind the outcome you were
>> > experiencing.
>> >
>> >
>> > On Sat, Aug 20, 2011 at 2:39 PM, Andre Lopes 
>> > wrote:
>> >>
>> >> I am new to Django, and I am trying to put the logout to work...
>> >>
>> >> I have installed the an App called, Django-Registration.
>> >>
>> >> My problem is that I can do the logout, but the page does not get
>> >> refreshed, I must to press F5 after the logout to see the page for not
>> >> logged users.
>> >>
>> >> What I have done is the following:
>> >>
>> >> urls.py, added to urlpatterns:
>> >> [code]
>> >> url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page':
>> >> '/'}, name='auth_logout'),
>> >> url(r'^logout/(?P.*)/$',
>> >> 'django.contrib.auth.views.logout', name='auth_logout_next'),
>> >> [/code]
>> >>
>> >> In the template I have this code:
>> >> [code]
>> >> {% if request.user.is_authenticated %}
>> >>    Welcome {{ request.user.username }}. Logout
>> >> {% else %}
>> >>    Welcome. Please login or > >> href="/accounts/register/">register
>> >> {% endif %}
>> >> [/code]
>> >>
>> >> When I click Logout I dont see this in the screen:
>> >> [code]
>> >> Welcome. Please login or > >> href="/accounts/register/">register
>> >> [/code]
>> >>
>> >> I only see this text if I use F5 to refresh the page.
>> >>
>> >> What I am missing here?
>> >>
>> >> Please give me a clue.
>> >>
>> >> Best 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.
>> >>
>> >
>> >
>> >
>> > --
>> > Thanks,
>> > Subhranath Chunder.
>> > www.subhranath.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django-users@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>> >
>>
>> --
>> 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...@googlegro

Re: Weird Model question django

2011-08-22 Thread raj
nvm, I think i'm starting to figure it out. Need to read up on many-to-
many fields.

On Aug 23, 2:21 am, raj  wrote:
> This may be difficult to explain. I'm a little new to django and the
> whole idea of models.
>
> Let's say I'm making an article app, where each article has a creator,
> but other users can edit the article at will. I'm having a little
> difficult on how to create the models for this.
>
> Firstly, I extend the user profile with the following:
>
> class UserProfile(models.Model):
>     #Required field:
>     user = models.OneToOneField(User)
>
>     #Other Fields:
>     headline = models.CharField()
>     industry = models.CharField()
>     article= models.ForeignKey(articleModel.article)
>
> Here is the first place I'm getting confused, do I put the foreignkey
> field in the user model? My reasoning for it being placed here is
> because each article can have many editors.
>
> Now here is my article model:
>
> class article(models.Model):
>     #primary key is already true
>     creator = models.ForeignKey(userModel.UserProfile)
>     title = models.CharField()
>     text = models.TextField()
>
> Over here, I put the ForeignKey field so it would relate back to the
> creator, because every article has a single creator. (As a side note,
> I do want to make it so an article can have multiple creators, but I
> don't know what to do in this scenario). I'm finding it a bit odd that
> the UserProfile model is referencing the article model, and the
> article is referencing it back. Can someone please help me unjumble my
> brain?
>
> Thank you. :)

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



Weird Model question django

2011-08-22 Thread raj
This may be difficult to explain. I'm a little new to django and the
whole idea of models.

Let's say I'm making an article app, where each article has a creator,
but other users can edit the article at will. I'm having a little
difficult on how to create the models for this.

Firstly, I extend the user profile with the following:

class UserProfile(models.Model):
#Required field:
user = models.OneToOneField(User)

#Other Fields:
headline = models.CharField()
industry = models.CharField()
article= models.ForeignKey(articleModel.article)

Here is the first place I'm getting confused, do I put the foreignkey
field in the user model? My reasoning for it being placed here is
because each article can have many editors.

Now here is my article model:

class article(models.Model):
#primary key is already true
creator = models.ForeignKey(userModel.UserProfile)
title = models.CharField()
text = models.TextField()

Over here, I put the ForeignKey field so it would relate back to the
creator, because every article has a single creator. (As a side note,
I do want to make it so an article can have multiple creators, but I
don't know what to do in this scenario). I'm finding it a bit odd that
the UserProfile model is referencing the article model, and the
article is referencing it back. Can someone please help me unjumble my
brain?

Thank you. :)

-- 
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: Quick question on importing

2011-08-22 Thread raj
Ya, well i got it to work by adding the project in front of it. Thank
you for the help!

On Aug 23, 1:55 am, Mike Dewhirst  wrote:
> On 23/08/2011 3:29pm, raj wrote:> I am editing my user model, and I want to 
> place a foreign key to a
> > class in another model, that is in a different app. How would I go
> > about importing it?
>
> > Tree:
> > /project/myapp/model1.py
> > /project/myapp2/model2.py
>
> > can i simply just say:
> > from myapp2 import model2
>
> The easy way to figure this out is to do it then start a Python
> interpreter and say "import myapp.model1"
>
> The fact is it depends on your python path and the existence of
> __init__.py files. Testing the import will show you the situation.
>
> Regards
>
> Mike
>
>
>
>
>
>
>
> > or do I need to edit something in the settings?
> > Thank you.

-- 
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: Need help on admin page

2011-08-22 Thread Kejun He
Visit the django official document about admin

https://docs.djangoproject.com/en/1.3//ref/contrib/admin/

On Tue, Aug 23, 2011 at 2:01 PM, Temulen Odbayar wrote:

> I don't understand about admin page site thing. What should i do with
> this thing??? Sorry my bad english. Any help ^__^
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Need help on admin page

2011-08-22 Thread Temulen Odbayar
I don't understand about admin page site thing. What should i do with
this thing??? Sorry my bad english. Any help ^__^

-- 
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: Quick question on importing

2011-08-22 Thread Mike Dewhirst

On 23/08/2011 3:29pm, raj wrote:

I am editing my user model, and I want to place a foreign key to a
class in another model, that is in a different app. How would I go
about importing it?

Tree:
/project/myapp/model1.py
/project/myapp2/model2.py

can i simply just say:
from myapp2 import model2
The easy way to figure this out is to do it then start a Python 
interpreter and say "import myapp.model1"


The fact is it depends on your python path and the existence of 
__init__.py files. Testing the import will show you the situation.


Regards

Mike

or do I need to edit something in the settings?
Thank you.



--
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: Quick question on importing

2011-08-22 Thread О . Тэмүлэн
Maybe you need to write package name before it like this. if project is
package "from project.myapp2.models import model2"

On Tue, Aug 23, 2011 at 1:29 PM, raj  wrote:

> I am editing my user model, and I want to place a foreign key to a
> class in another model, that is in a different app. How would I go
> about importing it?
>
> Tree:
> /project/myapp/model1.py
> /project/myapp2/model2.py
>
> can i simply just say:
> from myapp2 import model2
> or do I need to edit something in the settings?
> Thank you.
>
> --
> 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.
>
>


-- 
*О.Тэмүлэн - Програм зохиогч
*

USI (United Solutions International Inc)
Програм хангамжийн компани

Баянзүрх дүүрэг, 4 хороо, “Энхүүд” төв
Гар утас: 88826004
Утас: 70151145
Факс: 70141146
P.O.Box: 318-46
И-мэйл: temu...@usi.mn, ryoka@gmail.com


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



Quick question on importing

2011-08-22 Thread raj
I am editing my user model, and I want to place a foreign key to a
class in another model, that is in a different app. How would I go
about importing it?

Tree:
/project/myapp/model1.py
/project/myapp2/model2.py

can i simply just say:
from myapp2 import model2
or do I need to edit something in the settings?
Thank you.

-- 
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: Need help on django admin site

2011-08-22 Thread О . Тэмүлэн
thanks for reply ^__^

On Mon, Aug 22, 2011 at 9:50 PM, Jaspreet Sarao wrote:

> On Mon, Aug 22, 2011 at 12:11 PM, Temulen Odbayar 
> wrote:
> > I'm creating a web with people registration site. And also companies
> > can register people... I think i can use admin site to do these things
> > and don't need to create another page with registration form. But if
> > companies can use admin site they may do anything they want. So i
> > think i can use group permission but it's maybe not good at security.
> > I need advice on this. Sorry my bad english ^_^. Any help?
> You need to create a registrartion form in django for users only
> Don't use admin site for this . There is risk
> All the best
>
> --
> Jaspreet sarao
> email: jaspritsa...@gmail.com
> Blog: jaspreetsarao.wordpress.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
*О.Тэмүлэн - Програм зохиогч
*

USI (United Solutions International Inc)
Програм хангамжийн компани

Баянзүрх дүүрэг, 4 хороо, “Энхүүд” төв
Гар утас: 88826004
Утас: 70151145
Факс: 70141146
P.O.Box: 318-46
И-мэйл: temu...@usi.mn, ryoka@gmail.com


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



Re: models.URLField does not validate a valid url

2011-08-22 Thread Andy McKay

On 2011-08-22, at 5:59 AM, Burcu Hamamcıoğlu wrote:

> Hi all, I 've a strange issue with URLField. It does not validate 
> "http://www.babacanyapi.com"; and "ttp://www.crowntowers.net". When ı use 
> these urls the browser does not open anything I think it troubles into  an 
> infinite loop.  
> Why django does not recognize these urls?

That's an IIS server.

A search of Django issues brings me to this:

https://code.djangoproject.com/ticket/14955

"I've found a variety of IIS servers running ASP.NET that are responding with 
403 errors or simply timing out on HEAD requests"

Sounds like similar is happening here.
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
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: message mark_safe and redirect results in message still showiing with encoded tags

2011-08-22 Thread Andy McKay
> However, it seems that the redirect removes the safe_marking around my
> message! since the result I get in my browser is html-encoded!

It won't work that way, safe string alters the class not the contents of the 
string [1]. The message module turns the string into JSON and stores it. Then 
when read it does the reverse turning it back into a string.

You'll have either to alter that behaviour or find another way around.

[1] 
https://code.djangoproject.com/browser/django/trunk/django/utils/safestring.py#L89
--
  Andy McKay
  a...@clearwind.ca
  twitter: @andymckay
 

-- 
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: Django Development environment

2011-08-22 Thread Mario Gudelj
Mac, sqlite, Eclipse with Pydev or AquaMacs, apache

On 23 August 2011 13:06, Jani Tiainen  wrote:

> Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and
> Oracle.
>
> Stephen Jackson  kirjoitti 23.8.2011 kello
> 1.07:
>
> I am new to the world of Django. I would like to hear from other django
> developers describe their dev environment (tools, os, editors, etc.).
>
> --
> 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/-/Fq-jCVxrK7AJ.
>
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



TabularInline save_model()?

2011-08-22 Thread Lee
I'm trying to automatically update audit fields "updated" and
"updated_by" when an existing record is saved through a TabularInline
subform. In my main forms (ModelAdmin) I do that with save_model():

  5 class AuditAdmin(admin.ModelAdmin):
  6 ordering = ['id']
  7 def save_model(self, request, obj, form, change):
  8 if change:
  9 obj.updated = datetime.datetime.now()
 10 obj.updated_by = request.user.username
 11 else:
 12 obj.created = datetime.datetime.now()
 13 obj.created_by = request.user.username
 14 obj.save()

But that doesn't seem to have any effect on TabularInline. Here's what
I tried:

 16 class AuditTabularAdmin(admin.TabularInline):
 17 ordering = ['id']
 18 def save_model(self, request, obj, form, change):
 19 if change:
 20 obj.updated = datetime.datetime.now()
 21 obj.updated_by = request.user.username
 22 else:
 23 obj.created = datetime.datetime.now()
 24 obj.created_by = request.user.username
 25 obj.save()

The docs say "InlineModelAdmin shares many of the same features as
ModelAdmin" -- I'm guessing save_model() is not one of them? I
experimented with the features TabularInline adds to the ones *not
shared* (?), but couldn't get any to do the trick.

What is the recommended way to programmatically update fields upon
saving an existing record through a TabularInline?

Thanks very much for any help.

Lee

-- 
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: Django Development environment

2011-08-22 Thread Jani Tiainen
Ubuntu or windows, eclipse with pydev, apache, nginx, virtualenv and Oracle.

Stephen Jackson  kirjoitti 23.8.2011 kello 1.07:

> I am new to the world of Django. I would like to hear from other django 
> developers describe their dev environment (tools, os, editors, etc.).
> -- 
> 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/-/Fq-jCVxrK7AJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Django Development environment

2011-08-22 Thread Stephen Jackson
I'll reply to my own question. I started working with django about 4 months 
ago. I have three projects that I'm working on using django.

*Editor*
I've tried Aptana.
I've tried Wing IDE and I am currently testing Pycharm.
Ubuntu
South
MySql

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



Problem updating data

2011-08-22 Thread Karen McNeil
I have a model "Entry" with an "active" field, which is just a
boolean.  All of the current entries were false, and I was trying to
set them all as true, and I'm running into a strange problem.  Here's
an example, trying to set just one entry to inactive:

>>> from dictionary.models import Entry
>>> entries = Entry.objects.filter(active=0)
>>> entries.count()
3642
>>> e1 = entries[0]
>>> e1

>>> e1.active
False
>>> e1.active=True
>>> e1.save()
>>> e1.active
True
>>> Entry.objects.filter(active=0).count()
3642


Even though, when I checked e1.active, it showed it as being "True",
you can tell from the final count of inactive items that it hadn't
actually changed.  I see the same thing when I go into the admin
change page for that item -- "Active" is not checked.

What is going on here?

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



Re: Django Development environment

2011-08-22 Thread Greg Maruszeczka
On Mon, 22 Aug 2011 15:07:24 -0700 (PDT)
Stephen Jackson  wrote:

> I am new to the world of Django. I would like to hear from other
> django developers describe their dev environment (tools, os, editors,
> etc.).
> 

fedora, eclipse (pydev), mercurial, virtualenv, postgres, apache (wsgi)

-- 
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: Django Development environment

2011-08-22 Thread Landy Chapman
-debian (squeeze) with a few KDE "testing" packages
-jEdit with plugins: "Buffer List", "Editor Scheme", "Text
Autocomplete"
-Eterm, nano,git, qgit
-postgresql, sqlite, nginx, apache2


I'd love to hear from people using Windows XP/VISTA/7,  and Mac OS X

-- 
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: Django Development environment

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
uWSGI (this is an absolute MUST)
supervisord
nginx
ddt (django debug toolbar)
Komodo 6 (with modifications - see
http://www.mail-archive.com/django-users@googlegroups.com/msg123666.html )
Debian lenny or squeeze under lxc/cgroups.
winscp (for on-the-fly continuous directory sync from windows)
virtualbox

On Mon, Aug 22, 2011 at 11:07 PM, Stephen Jackson <
jackson.stephe...@gmail.com> wrote:

> I am new to the world of Django. I would like to hear from other django
> developers describe their dev environment (tools, os, editors, etc.).
>
> --
> 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/-/Fq-jCVxrK7AJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: chrome v13 + double-running middleware (django 1.3)

2011-08-22 Thread Yeled Nova
Instead of printing out Watchdog, you can "print request.path" to see
which two requests are triggering the middleware.

When you know which additional request is causing the problem, you can
use a decorator to filter it. Here is what I do:

---
In middleware.py:

Class MyMiddleWare:
@forNonStaticRequest
def process_request(self, request):
 # Your code goes here
 pass
---


And, somewhere else in your project:
===
from functools import wraps
from YOURPROJECTNAME.settings import DEBUG

def __forNonStaticRequest(func):
@wraps(func)
def wrapper(SELF, request):
prefix = ('/js/', '/images/', '/upload/', '/style/', '/
__debug__/')
if request.path.startswith(prefix):
return None
return func(SELF, request)
return wrapper

forNonStaticRequest = __forNonStaticRequest if DEBUG else (lambda u:
u)
===

What these codes do is to prevent static files request from triggering
the middleware *only* when you're running development server.
You need to properly handle static files when you actually deploy them
in production environment.

I think this will help you.


On Aug 23, 1:17 am, mcrk  wrote:
> Hi everyone!
>
> I've created a simple middleware for mobile detection and when testing
> values in dev console I came up with some pretty strange behavior.
> Let's say, I have this simple middleware class:
>
> class MobileRedirect(object):
>     def process_request(self, request):
>         print "watchdog"
>         return None
>
> and of course it's loaded in my settings:
>
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'middleware.mobile_redirect.MobileRedirect',
>
> and when I go into my login page, this is the results I get in
> Firefox:
>
> watchdog
> [22/Aug/2011 19:08:02] "GET /login/ HTTP/1.1" 200 742
> [22/Aug/2011 19:08:02] "GET /static/css/base.css HTTP/1.1"
> [22/Aug/2011 19:08:02] "GET /static/css/fonts/OpenSans/Ope
> /1.1" 304 0
>
> and this is using Chrome v13:
>
> watchdog
> [22/Aug/2011 19:09:41] "GET /login/ HTTP/1.1" 200 742
> [22/Aug/2011 19:09:41] "GET /static/css/base.css HTTP/1.1" 2
> [22/Aug/2011 19:09:41] "GET /static/css/fonts/OpenSans/OpenS
> /1.1" 304 0
> watchdog
>
> "watchdog" is printed out twice, when using chrome!! Using IE gives
> the same result as FF.. so how on earth is chrome running the
> middleware twice??
>
> Can anyone please make a similar test and let me know, if You get the
> same problem.. or just tell me, if I'm doing smth wrong here. I'm new
> to django..
>
> Thanks in advance

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



Problems on using multiple databases

2011-08-22 Thread Jim
Hello folks,

I am learning to set up multiple databases routing in Django.

Before I started, I had everything working properly. Then, I wrote 
dbrouter.py under the site directory, basically by copying the example in the 
Django document about using multiple 
databases. 
Here is what's in dbrouter.py:
#
class DBRouter(object):
def db_for_read(self, model, **hints):
label = model._meta.app_label
if label == 'books':
dbName = 'test' # dbName is a name in settings.DATABASES
else:
dbName = None
return dbName

def db_for_write(self, model, **hints):
label = model._meta.app_label
if label == 'books':
dbName = 'test'
else:
dbName = None
return dbName

def allow_syncdb(self, db, model):
# db is a string of database name.
label = model._meta.app_label
if label == 'books':
dbName = 'test'
else:
dbName = None
return dbName == db
#

As you can see from dbrouter.py, I have an app called books. 

Here is the DATABASES setting:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': dbPath + os.sep + 'default.sqlite',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
'test': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': dbPath + os.sep + 'test.sqlite',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}


Then, I added the following setting to settings.py.
DATABASE_ROUTERS = [siteName + '.dbrouter.DBRouter']

Finally, I ran ./manage.py syncdb. And got these error messages:

>$ ./manage.py syncdb
Creating tables ...
Traceback (most recent call last):
  File "./manage.py", line 17, in 
execute_manager(settings)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 438, in execute_manager
utility.execute()
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/base.py",
 
line 191, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/base.py",
 
line 220, in execute
output = self.handle(*args, **options)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/base.py",
 
line 351, in handle
return self.handle_noargs(**options)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/commands/syncdb.py",
 
line 109, in handle_noargs
emit_post_sync_signal(created_models, verbosity, interactive, db)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/core/management/sql.py",
 
line 190, in emit_post_sync_signal
interactive=interactive, db=db)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/dispatch/dispatcher.py",
 
line 172, in send
response = receiver(signal=self, sender=sender, **named)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py",
 
line 30, in create_permissions
ctype = ContentType.objects.get_for_model(klass)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/contrib/contenttypes/models.py",
 
line 38, in get_for_model
defaults = {'name': smart_unicode(opts.verbose_name_raw)},
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/db/models/manager.py",
 
line 135, in get_or_create
return self.get_query_set().get_or_create(**kwargs)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/db/models/query.py",
 
line 378, in get_or_create
return self.get(**lookup), False
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/db/models/query.py",
 
line 344, in get
num = len(clone)
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/db/models/query.py",
 
line 82, in __len__
self._result_cache = list(self.iterator())
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/django/db/models/query.py",
 
line 273, in iterator
for row in compiler.results_iter():
  File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/dj

Re: Model caching per python session

2011-08-22 Thread Julian Hodgson
Ok, that makes sense.

The thing is, we've written some python plugins for Softimage to read and
write to the db that get loaded and stay in memory.   When the plugins are
loaded, the django models are imported.  So during the lifetime of the host
application, the python session is the same.

So I really need a way of closing the transaction or flushing the sql in
django,  without starting a new python session.

Any ideas warmly received.

Julian.
On Aug 22, 2011 8:30 PM, "Daniel Roseman"  wrote:
> On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote:
>>
>> Hi there,
>>
>> I'm running a production linux django server using wsgi, and have found
the
>> following issue. Django version (1, 2, 5, 'final', 0).
>>
>> If I open a python shell I get:
>>
>> >>> from passion.cg.models import *
>> >>> print Sequence.objects.all()
>> [, , , ]
>>
>>
>> But if I go into the admin and delete sequence DD, leaving the python
>> session running, then I still get
>>
>> >>> print Sequence.objects.all()
>> [, , , ]
>>
>> so the Sequence table doesn't appear to be updated as far as the model is

>> concerned.
>>
>> It's pretty fundamental that this can be resolved since many different
>> users will be using the database at the same time, and it should be
possible
>> for each user to see the latest state of the DB.
>>
>> Any suggestions welcomed.
>>
>> Cheers,
>>
>> Julian
>>
>
> This isn't anything to do with caching. It's a result of the fact that the

> shell session is running within a single transaction, and therefore
doesn't
> see changes from outside that. If you quit the shell and restart it,
you'll
> be able to see the change.
>
> This isn't a problem in production, because transactions in views are tied

> to the request/response cycle, which is short-lived.
> --
> DR.
>
>>
>>
>
> --
> 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/-/qX11CSPon3MJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: on-site deployment

2011-08-22 Thread Sam Bull

On 2011-08-22, at 4:04 PM, Cal Leeming [Simplicity Media Ltd] wrote:

>> > - How will new versions of the product (new code and new content) be 
>> > provided?
>> 
>> New versions are part of our contract. We're going to provide them via a 
>> tarball containing the code, the media files, a content fixture, and a pip 
>> bundle containing the project's python dependencies. We'll use a deployment 
>> script that will put all those things in place on the server once the 
>> tarball is unpacked and activate the new version in a way that minimizes 
>> downtime and allows for a rollback if anything seems screwy with the new 
>> version.
> 
> Assuming your engineers are going to be doing these updates manually, and you 
> are not looking for some sort of auto deployment update system, then this 
> approach is fine.
> 
> Does your product need to consider licensing/obfuscation??

Good question. I don't think so, but I'll ask. I sure hope not.

>> Out of all of that, the part I like the least is the deployment script part. 
>> I don't think we can provide much less than this without creating serious 
>> roadblocks to actually getting this thing deployed by disinterested IT 
>> departments, but maybe we're over-thinking it. And if we're not, I'm worried 
>> that there are tools or conventions out there that we should be using. We 
>> use fabric, pip, virtualenv and puppet, but there's still this script for 
>> putting everything in place on the server and smoothly switching over from 
>> one version to the next that's basically home grown.
> 
> A lot of places that give customers 'appliances' in the form of VM images, 
> will just insist they export their data, re-install the latest appliance, 
> then re-import. Although thankfully, most now realise this is a retarded 
> approach and allow updates without re-imaging.
> 
> To allow auto update, you need to have a very very very robust testing and 
> release procedure. You need to ensure clients are given appropriate notice, 
> risk assessment etc.
> 
> Don't automate if it causes more problems than solutions :)

I assume by "auto update" you mean a completely autonomous updating solution. 
We don't plan to offer that, at least not any time soon. Our plan is to require 
a sysadmin to deploy the update, but the deployment workflow will be as close 
to "turnkey" as we can get.

For our initial release the deployment interface will be via the shell, but in 
some future version I'd like to wrap it in a web interface and add support for 

Sam

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



mod_wsgi cannot load MySQLdb

2011-08-22 Thread Jim
Hello folks,

This probably has been discussed many times, but I still can't find any 
solution yet. Basically, it turns out that python can load MySQLdb just 
fine, but Apache can't load MySQLdb from the wsgi script.

I am using python2.7 in a virtual environment created by virtualenv. Here is 
the error info extracted from the Apache error log. To make the lines 
shorter, I deleted all the time tags in the brackets.

Any ideas how to fix it?

[] mod_wsgi (pid=3136): Target WSGI script 
'/Users/jianbao/projects/tao.com/mysite/apache/django.wsgi' cannot be loaded 
as Python module.
[] mod_wsgi (pid=3136): Exception occurred processing WSGI script 
'/Users/jianbao/projects/tao.com/mysite/apache/django.wsgi'.
[] Traceback (most recent call last):
[]   File "/Users/jianbao/projects/tao.com/mysite/apache/django.wsgi", line 
56, in 
[] import MySQLdb
[]   File 
"/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/MySQLdb/__init__.py",
 
line 19, in 
[] import _mysql
[] ImportError: 
dlopen(/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/_mysql.so,
 
2): Library not loaded: libmysqlclient.18.dylib
[]   Referenced from: 
/Users/jianbao/projects/tao.com/mysite/lib/python2.7/site-packages/_mysql.so
[]   Reason: image not found

-- 
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/-/eXS-nCx7Ut4J.
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 Development environment

2011-08-22 Thread dm03514
Ubuntu, VIM, mercurial, DebugToolbar(sometimes)
Sqlite3 for many projects.

On Aug 22, 6:07 pm, Stephen Jackson 
wrote:
> I am new to the world of Django. I would like to hear from other django
> developers describe their dev environment (tools, os, editors, etc.).

-- 
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: Django Development environment

2011-08-22 Thread ozgur yilmaz
Windows XP and windows 7. Notepad++. Mysql. South.

2011/8/23 Shawn Milochik :
> On 08/22/2011 06:07 PM, Stephen Jackson wrote:
>>
>> I am new to the world of Django. I would like to hear from other django
>> developers describe their dev environment (tools, os, editors, etc.).
>
> Ubuntu, virtualenv, Komodo Edit, vim, git
>
>    Must-haves:
>        Development:
>            South, pyflakes, selenium
>        Deployment:
>            supervisord, gunicorn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django Development environment

2011-08-22 Thread Matt Mansour
Howdy -
Welcome. So far I like the following:

Editors: PyCharm and VIM
OS (Dev) OS X
Tools: Django Debug ToolBar, South
DB: Postgres

I am looking forward to hearing what others are using as well.

Matt

On Mon, Aug 22, 2011 at 3:07 PM, Stephen Jackson
 wrote:
> I am new to the world of Django. I would like to hear from other django
> developers describe their dev environment (tools, os, editors, etc.).
>
> --
> 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/-/Fq-jCVxrK7AJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
Thanks Shawn,

I think i satisfied with this way. It seems a suitable way for Django.
I'll use it. Thanks again,

2011/8/23 Shawn Milochik :
> On 08/22/2011 05:44 PM, ozgur yilmaz wrote:
>>
>> Ok. Thank you so much. So, formset is a suitable way to achieve this.
>> But, is it the most django-oriented way? Is there any alternative way?
>> Maybe using popup window to select a product, and handle the return
>> value of popup, then use a hiddenvalue to hold the return value. And
>> repeat this for many times, to add multiple product? Is it a common
>> way? Thanks again,
>>
>
> Given that a Django formset is a feature of Django, I'd say it's a pretty
> django-oriented way. However, the way I suggested doesn't require formsets.
>
> Briefly:
>
>    1. Have JavaScript on your page that can dynamically add elements to your
> HTML form.
>
>    2. Ensure that your JavaScript attaches a unique prefix to each set of
> elements that belong together. Example, if you'll have a product ID and
> quantity, you need to make sure that each pair share the same prefix and no
> other elements share that prefix.
>        Example:
>            
>            
>
>            
>            
>
>    3. In your view, get a list of the prefixes from your request.POST.
>
>    4. For each prefix, create a ModelForm instance passing the prefix kwarg
> with the prefix and request.POST as the data kwarg.
>
> From there it's straightforward.
>
> Shawn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Django Development environment

2011-08-22 Thread Shawn Milochik

On 08/22/2011 06:07 PM, Stephen Jackson wrote:

I am new to the world of Django. I would like to hear from other django
developers describe their dev environment (tools, os, editors, etc.).


Ubuntu, virtualenv, Komodo Edit, vim, git

Must-haves:
Development:
South, pyflakes, selenium
Deployment:
supervisord, gunicorn

--
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 Development environment

2011-08-22 Thread Stephen Jackson
I am new to the world of Django. I would like to hear from other django 
developers describe their dev environment (tools, os, editors, etc.).

-- 
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/-/Fq-jCVxrK7AJ.
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: dynamic form with popup

2011-08-22 Thread Shawn Milochik

On 08/22/2011 05:44 PM, ozgur yilmaz wrote:

Ok. Thank you so much. So, formset is a suitable way to achieve this.
But, is it the most django-oriented way? Is there any alternative way?
Maybe using popup window to select a product, and handle the return
value of popup, then use a hiddenvalue to hold the return value. And
repeat this for many times, to add multiple product? Is it a common
way? Thanks again,



Given that a Django formset is a feature of Django, I'd say it's a 
pretty django-oriented way. However, the way I suggested doesn't require 
formsets.


Briefly:

1. Have JavaScript on your page that can dynamically add elements 
to your HTML form.


2. Ensure that your JavaScript attaches a unique prefix to each set 
of elements that belong together. Example, if you'll have a product ID 
and quantity, you need to make sure that each pair share the same prefix 
and no other elements share that prefix.

Example:






3. In your view, get a list of the prefixes from your request.POST.

4. For each prefix, create a ModelForm instance passing the prefix 
kwarg with the prefix and request.POST as the data kwarg.


From there it's straightforward.

Shawn

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-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: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
Ok. Thank you so much. So, formset is a suitable way to achieve this.
But, is it the most django-oriented way? Is there any alternative way?
Maybe using popup window to select a product, and handle the return
value of popup, then use a hiddenvalue to hold the return value. And
repeat this for many times, to add multiple product? Is it a common
way? Thanks again,

2011/8/23 Shawn Milochik :
> On 08/22/2011 05:33 PM, ozgur yilmaz wrote:
>>
>> thanks,
>>
>> but i think i have to use a suitable js for adding a new product. am i
>> wrong?
>>
>
> To do it the way you want you'll have to use JavaScript, but it's easy
> (especially with jQuery) to dynamically add elements to your form. No
> refreshing necessary. Then handle the contents of request.POST appropriately
> in your view.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: dynamic form with popup

2011-08-22 Thread Shawn Milochik

On 08/22/2011 05:33 PM, ozgur yilmaz wrote:

thanks,

but i think i have to use a suitable js for adding a new product. am i wrong?



To do it the way you want you'll have to use JavaScript, but it's easy 
(especially with jQuery) to dynamically add elements to your form. No 
refreshing necessary. Then handle the contents of request.POST 
appropriately in your view.


--
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: dynamic form with popup

2011-08-22 Thread Yaşar Arabacı
If you want to dynamically update your Cart without refreshing the page, yes
you will need to write some heavy ajax. But if you are okey with page
refreshing, you can temprorarily save your cart in session and use formsets
as shawn suggested.

2011/8/23 ozgur yilmaz 

> thanks,
>
> but i think i have to use a suitable js for adding a new product. am i
> wrong?
>
> 2011/8/23 Shawn Milochik :
> > On 08/22/2011 05:21 PM, ozgur yilmaz wrote:
> >>
> >> thats not the answer. you can add item to basket by clicking a button
> >> "add to basket" on every item page. My purpose is to fill a single
> >> form, with 1 or many products. Than a single button, saves a checkout
> >> object and many product object.
> >
> > Use formsets, or dynamically generate HTML input fields with prefixes in
> the
> > names and, in your view, dynamically instantiate ModelForm instances with
> > each prefix and save them.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
http://yasar.serveblog.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
thanks,

but i think i have to use a suitable js for adding a new product. am i wrong?

2011/8/23 Shawn Milochik :
> On 08/22/2011 05:21 PM, ozgur yilmaz wrote:
>>
>> thats not the answer. you can add item to basket by clicking a button
>> "add to basket" on every item page. My purpose is to fill a single
>> form, with 1 or many products. Than a single button, saves a checkout
>> object and many product object.
>
> Use formsets, or dynamically generate HTML input fields with prefixes in the
> names and, in your view, dynamically instantiate ModelForm instances with
> each prefix and save them.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: dynamic form with popup

2011-08-22 Thread Shawn Milochik

On 08/22/2011 05:21 PM, ozgur yilmaz wrote:

thats not the answer. you can add item to basket by clicking a button
"add to basket" on every item page. My purpose is to fill a single
form, with 1 or many products. Than a single button, saves a checkout
object and many product object.


Use formsets, or dynamically generate HTML input fields with prefixes in 
the names and, in your view, dynamically instantiate ModelForm instances 
with each prefix and save them.



--
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: dynamic form with popup

2011-08-22 Thread Yaşar Arabacı
And also, I suggest that you create Cart model, with ManyToMany field to
your product. And you can add your checkout date there too, and other cart
related information like total price etc. Keep your cart as a session
variable until checked out, you can then save your cart. So that you could
have see checked out Carts on the admin panel.

23 Ağustos 2011 00:12 tarihinde Yaşar Arabacı  yazdı:

> I don't know the answer, but you may want to check this out:
> http://www.satchmoproject.com/
>
>
> 2011/8/23 ozgur yilmaz 
>
>> Hi, I have a problem.
>>
>> I have two models:
>>
>> class CheckOut(models.Model):
>>   models.DateField()
>>
>> class Product(models.Model):
>>   checkout = models.ForeignKey( CheckOut )
>>   name = models.CharField()
>>   price = models.FloatField()
>>
>> With these models, i want to contruct a CheckOut form, and select
>> multiple products, calculate the amount ( price * item_number ).
>>
>> What is the most popular or best way to achieve this thought?
>>
>> I want to use popup windows to select a product and item number for
>> checkout. If i can use a "add product" link in the form, and show a
>> popup window to select the product and number, and return the values
>> to the form, i would be glad.
>>
>> Thanks for your help,
>>
>> --
>> 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.
>>
>>
>
>
> --
> http://yasar.serveblog.net/
>
>


-- 
http://yasar.serveblog.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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: dynamic form with popup

2011-08-22 Thread ozgur yilmaz
thats not the answer. you can add item to basket by clicking a button
"add to basket" on every item page. My purpose is to fill a single
form, with 1 or many products. Than a single button, saves a checkout
object and many product object.

23 Ağustos 2011 00:12 tarihinde Yaşar Arabacı  yazdı:
> I don't know the answer, but you may want to check this
> out: http://www.satchmoproject.com/
>
> 2011/8/23 ozgur yilmaz 
>>
>> Hi, I have a problem.
>>
>> I have two models:
>>
>> class CheckOut(models.Model):
>>   models.DateField()
>>
>> class Product(models.Model):
>>   checkout = models.ForeignKey( CheckOut )
>>   name = models.CharField()
>>   price = models.FloatField()
>>
>> With these models, i want to contruct a CheckOut form, and select
>> multiple products, calculate the amount ( price * item_number ).
>>
>> What is the most popular or best way to achieve this thought?
>>
>> I want to use popup windows to select a product and item number for
>> checkout. If i can use a "add product" link in the form, and show a
>> popup window to select the product and number, and return the values
>> to the form, i would be glad.
>>
>> Thanks for your help,
>>
>> --
>> 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.
>>
>
>
>
> --
> http://yasar.serveblog.net/
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: dynamic form with popup

2011-08-22 Thread Yaşar Arabacı
I don't know the answer, but you may want to check this out:
http://www.satchmoproject.com/

2011/8/23 ozgur yilmaz 

> Hi, I have a problem.
>
> I have two models:
>
> class CheckOut(models.Model):
>   models.DateField()
>
> class Product(models.Model):
>   checkout = models.ForeignKey( CheckOut )
>   name = models.CharField()
>   price = models.FloatField()
>
> With these models, i want to contruct a CheckOut form, and select
> multiple products, calculate the amount ( price * item_number ).
>
> What is the most popular or best way to achieve this thought?
>
> I want to use popup windows to select a product and item number for
> checkout. If i can use a "add product" link in the form, and show a
> popup window to select the product and number, and return the values
> to the form, i would be glad.
>
> Thanks for your help,
>
> --
> 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.
>
>


-- 
http://yasar.serveblog.net/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-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.



dynamic form with popup

2011-08-22 Thread ozgur yilmaz
Hi, I have a problem.

I have two models:

class CheckOut(models.Model):
   models.DateField()

class Product(models.Model):
   checkout = models.ForeignKey( CheckOut )
   name = models.CharField()
   price = models.FloatField()

With these models, i want to contruct a CheckOut form, and select
multiple products, calculate the amount ( price * item_number ).

What is the most popular or best way to achieve this thought?

I want to use popup windows to select a product and item number for
checkout. If i can use a "add product" link in the form, and show a
popup window to select the product and number, and return the values
to the form, i would be glad.

Thanks for your help,

-- 
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: CSS question

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
Really would advice against using inline-block - for same reasons as before.

Like anything though, CSS is another one of those things you have to
sometimes learn the hard way... But the trick is, CSS/HTML shouldn't be
hard, it should be one of those things that just rolls off the finger tips.

Again, others may disagree.

On Mon, Aug 22, 2011 at 9:59 PM, Axel Bock
wrote:

> well. inline-block is around since … at least 2007ish, and according to
> this  table it _really_ should
> be no problem for a somewhat new browser.
> and I honestly think IE6&7 support is … not an option, given that ie8 is
> around since 2006!
>
> *if* you have the written requirement … bad. if not, well, I'd go for it.
>
> of course the table might be wrong. that'd be bad, too :)
>
>
> greets,
> axel.
>
>
> Am 22.08.2011 um 21:19 schrieb Cal Leeming [Simplicity Media Ltd]:
>
> Sorry to be a party pooper, but inline-block is yet again another one of
> those big no-nos when it comes to cross browser/version.
>
> http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/
>
>
>
> On Mon, Aug 22, 2011 at 7:35 PM, Axel Bock  > wrote:
>
>> Hah! I can answer something on a Django-list - oh joy :) .
>> Yes, indeed I have an idea. *inline-block* may be the css thing for you.
>>
>> A very nice example for that is here:
>> http://www.brunildo.org/test/inline-block.html
>> Go to http://www.brunildo.org/ to have an overview over a lot of other
>> stuff, quite helpful.
>>
>>
>> Greetings,
>> Axel.
>>
>>
>> p.s.: does that mean I'm intelligent? ;)
>>
>>
>> Am 21.08.2011 um 23:47 schrieb Joshua Russo:
>>
>> I know this is a bit off topic but I know this place is full of very
>> helpful intelligent people. :o)
>>
>> Ok so I have an html block (div, p, doesn't matter what kind), and I fill
>> it with a label and an input text field. The input is always larger than the
>> label (rightly so), but the label is always aligned to the top of the block.
>> I want to center the label in the block but for the life of me, I can't
>> figure out how.
>>
>> Any ideas on how to fix it or where to go to get an answer?
>>
>> --
>> 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/-/-6G_bvvoyM0J.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

-- 
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: CSS question

2011-08-22 Thread Axel Bock
well. inline-block is around since … at least 2007ish, and according to this 
table it _really_ should be no problem for a somewhat new browser. 
and I honestly think IE6&7 support is … not an option, given that ie8 is around 
since 2006!

*if* you have the written requirement … bad. if not, well, I'd go for it. 

of course the table might be wrong. that'd be bad, too :)


greets, 
axel.


Am 22.08.2011 um 21:19 schrieb Cal Leeming [Simplicity Media Ltd]:

> Sorry to be a party pooper, but inline-block is yet again another one of 
> those big no-nos when it comes to cross browser/version.
> 
> http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/
> 
> 
> 
> On Mon, Aug 22, 2011 at 7:35 PM, Axel Bock  
> wrote:
> Hah! I can answer something on a Django-list - oh joy :) .
> Yes, indeed I have an idea. *inline-block* may be the css thing for you. 
> 
> A very nice example for that is here: 
> http://www.brunildo.org/test/inline-block.html
> Go to http://www.brunildo.org/ to have an overview over a lot of other stuff, 
> quite helpful.
> 
> 
> Greetings, 
> Axel.
> 
> 
> p.s.: does that mean I'm intelligent? ;)
> 
> 
> Am 21.08.2011 um 23:47 schrieb Joshua Russo:
> 
>> I know this is a bit off topic but I know this place is full of very helpful 
>> intelligent people. :o)
>> 
>> Ok so I have an html block (div, p, doesn't matter what kind), and I fill it 
>> with a label and an input text field. The input is always larger than the 
>> label (rightly so), but the label is always aligned to the top of the block. 
>> I want to center the label in the block but for the life of me, I can't 
>> figure out how.
>> 
>> Any ideas on how to fix it or where to go to get an answer?
>> 
>> -- 
>> 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/-/-6G_bvvoyM0J.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Django 1.3 logging not working as I'd expect

2011-08-22 Thread Gelonida N
On 08/20/2011 06:51 AM, Scott Danzig wrote:
> I have Django 1.3 working with Python 2.7 and MySQL 5.5 on Mac OSX Lion...
> 
> I'm betting I'm missing something straight forward, but:
> 
> I have a simple Django app in development that uses a dictConfig setting
> simpler than the default in settings.py:
> 
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'formatters': {
> 'verbose': {
> 'format': '%(levelname)s %(asctime)s %(module)s %(process)d
> %(thread)d %(message)s'
> },
> },
> 'handlers': {
> 'console':{
> 'level':'DEBUG',
> 'class':'logging.StreamHandler',
> 'formatter': 'verbose'
> },
> 'file':{
> 'level':'DEBUG',
> 'class':'logging.FileHandler',
> 'formatter': 'verbose',
> 'filename': 'testdjango.log',
> },
> },
> 'loggers': {
> 'testlogger': {
> 'handlers': ['console','file'],
> 'level': 'DEBUG',
> 'propagate': True,
>},
> },
> }
> 
> 
> Then later in code that I know is run... (I tried in my app's views.py
> and also the backend).. I put something like this:
> 
> import logging
> logger = logging.getLogger('testlogger')
> logger.warn('hello')
> logger.info('please appear')
> 
> 
> And I just don't see it, neither in the console, nor the file.
> 
> I have also tried something like this:
> import logging
> logger = logging.getLogger('otherlogger')
> hdlr = logging.FileHandler('newlogger.log')
> formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
> hdlr.setFormatter(formatter)
> logger.addHandler(hdlr) 
> logger.setLevel(logging.DEBUG)
> logger.warn('In settings.py!')
> 
You  have to be sure, that logging is configured before actually logging
anything.

So before your three lines:
> import logging
> logger = logging.getLogger('otherlogger')
> logger.warn('hello')
you had to be sure, that the django settings and thus the logging
configuration has really been completed.


You could for example add following two lines before:
> from django.conf import settings
> LOGGING = settings.LOGGING # force import

The second line is needed, as the first line is a 'lazy import' and will
only read the settings and configure logging  when you access the first
time a element of settings.
I just used settings.LOGGING, as it should always exist, when you try to
log.


I am not sure whether there is a more elegant solution.
When I asked this question recently on this list, I didn't receive any
other suggestions.




> And that doesn't work either, unless I put it right in settings.py.. in
> which case it appears 4 times, because, from what I understand,
> settings.py gets loaded that many times.  But then this doesn't work in
> the views.py/backend .. perhaps because the dictConfig gets loaded after
> settings.py is run?  I don't know.
> 
> I'm hoping for someone to give me a heads up about what I'm missing
> here.  Django's been pretty easy to deal with until I started to look
> into logging.
> 
> Thanks.
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/JvmqgFNPMu4J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.


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



Re: CSS question

2011-08-22 Thread Micky Hulse
Hi Cal,

On Mon, Aug 22, 2011 at 12:49 AM, Cal Leeming [Simplicity Media Ltd]
 wrote:
> OP - let me know if you resolved your issue. If not, ill show you the
> standard way of doing it.

I have always considered vertical-align pretty standard. ;)

> For the record - vertical align in some usages isnt going to work very
> nicely cross browser/versions.

I get pretty good results for the major browsers plus IE going back to
version 6.

Demo:



CSS/HTML tested via:

MAC:
Firefox 5.0.1, Safari 5.1, Opera 11.50, Chrome 13.0.x

PC:
Firefox 6.0, Firefox 5.0, Firefox 3.6.18, Safari 5.1, Opera 11.50,
Chrome 13.0.x,
IE 9.0.x, IE 8.0.x, IE 7.0.x, IE 6.0.x

Of course, that's just OS X and Vista/XP... I don't have an easy way
to quickly/directly test other platforms.

Cheers,
Micky

-- 
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: on-site deployment

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
On Mon, Aug 22, 2011 at 8:58 PM, Sam Bull  wrote:

> Thanks for the reply.
>
> Please don't think I'm looking for anyone to do our work for us. We've
> already implemented a first pass at our solution. I just worried that we
> might be reinventing the wheel and wanted to figure out if there were any
> strong conventions out there. I didn't answer the questions myself because I
> thought I might get answers that challenged my assumptions if I didn't put
> anyone on a certain track by explaining what we're doing.
>
> Having said that, here are our answers:
>
> On 2011-08-22, at 2:17 PM, Cal Leeming [Simplicity Media Ltd] wrote:
>
> > On Mon, Aug 22, 2011 at 7:09 PM, Sam Bull  wrote:
> > - What will we ultimately be delivering to our clients (a tarball of the
> code, a physical server, a VM image, a WAR file, etc.)?
>
> We're providing an ubuntu 10.04 VM image.
>

Good when combined with the below option.


>
> > - Who is responsible for the upkeep of the server?
>
> The client will be, unless something special is negotiated.
>

Good. Never fall into the trap of "free support" :) Make sure your T&Cs
exclude you from any liability from lack of maintenance of the server.


>
> > - How will new versions of the product (new code and new content) be
> provided?
>
> New versions are part of our contract. We're going to provide them via a
> tarball containing the code, the media files, a content fixture, and a pip
> bundle containing the project's python dependencies. We'll use a deployment
> script that will put all those things in place on the server once the
> tarball is unpacked and activate the new version in a way that minimizes
> downtime and allows for a rollback if anything seems screwy with the new
> version.
>

Assuming your engineers are going to be doing these updates manually, and
you are not looking for some sort of auto deployment update system, then
this approach is fine.

Does your product need to consider licensing/obfuscation??


>
> > - How will python dependencies be maintained?
>
> We compile them locally using pip's bundle feature and then deploy them as
> part of the project deployment. We run virtualenv on the server.
>

Good.


>
> > - Can we assume that the server can access the Internet?
> > - Can we assume that we can access the server from the Internet?
>
> No.
>

Good.


>
>
> Out of all of that, the part I like the least is the deployment script
> part. I don't think we can provide much less than this without creating
> serious roadblocks to actually getting this thing deployed by disinterested
> IT departments, but maybe we're over-thinking it. And if we're not, I'm
> worried that there are tools or conventions out there that we should be
> using. We use fabric, pip, virtualenv and puppet, but there's still this
> script for putting everything in place on the server and smoothly switching
> over from one version to the next that's basically home grown.
>

A lot of places that give customers 'appliances' in the form of VM images,
will just insist they export their data, re-install the latest appliance,
then re-import. Although thankfully, most now realise this is a retarded
approach and allow updates without re-imaging.

To allow auto update, you need to have a very very very robust testing and
release procedure. You need to ensure clients are given appropriate notice,
risk assessment etc.

Don't automate if it causes more problems than solutions :)


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

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



Re: on-site deployment

2011-08-22 Thread Sam Bull
Thanks for the reply.

Please don't think I'm looking for anyone to do our work for us. We've already 
implemented a first pass at our solution. I just worried that we might be 
reinventing the wheel and wanted to figure out if there were any strong 
conventions out there. I didn't answer the questions myself because I thought I 
might get answers that challenged my assumptions if I didn't put anyone on a 
certain track by explaining what we're doing.

Having said that, here are our answers:

On 2011-08-22, at 2:17 PM, Cal Leeming [Simplicity Media Ltd] wrote:

> On Mon, Aug 22, 2011 at 7:09 PM, Sam Bull  wrote:
> - What will we ultimately be delivering to our clients (a tarball of the 
> code, a physical server, a VM image, a WAR file, etc.)?

We're providing an ubuntu 10.04 VM image.

> - Who is responsible for the upkeep of the server?

The client will be, unless something special is negotiated.

> - How will new versions of the product (new code and new content) be provided?

New versions are part of our contract. We're going to provide them via a 
tarball containing the code, the media files, a content fixture, and a pip 
bundle containing the project's python dependencies. We'll use a deployment 
script that will put all those things in place on the server once the tarball 
is unpacked and activate the new version in a way that minimizes downtime and 
allows for a rollback if anything seems screwy with the new version.

> - How will python dependencies be maintained?

We compile them locally using pip's bundle feature and then deploy them as part 
of the project deployment. We run virtualenv on the server.

> - Can we assume that the server can access the Internet?
> - Can we assume that we can access the server from the Internet?

No.


Out of all of that, the part I like the least is the deployment script part. I 
don't think we can provide much less than this without creating serious 
roadblocks to actually getting this thing deployed by disinterested IT 
departments, but maybe we're over-thinking it. And if we're not, I'm worried 
that there are tools or conventions out there that we should be using. We use 
fabric, pip, virtualenv and puppet, but there's still this script for putting 
everything in place on the server and smoothly switching over from one version 
to the next that's basically home grown.

Sam

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



Re: Admin TabularInline collapsed fieldset missing expand button

2011-08-22 Thread Lee
Is no one else having problems with collapsed TabularInlines? Seems
like this would be a very popular widget, and very important for any
serious database app.

-- 
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: Model caching per python session

2011-08-22 Thread Daniel Roseman
On Monday, 22 August 2011 17:16:24 UTC+1, Julian Hodgson wrote:
>
> Hi there,
>
> I'm running a production linux django server using wsgi, and have found the 
> following issue. Django version (1, 2, 5, 'final', 0).
>
> If I open a python shell I get:
>
> >>> from passion.cg.models import *
> >>> print Sequence.objects.all()
> [, , , ]
>
>
> But if I go into the admin and delete sequence DD, leaving the python 
> session running, then I still get
>
> >>> print Sequence.objects.all()
> [, , , ]
>
> so the Sequence table doesn't appear to be updated as far as the model is 
> concerned.
>
> It's pretty fundamental that this can be resolved since many different 
> users will be using the database at the same time, and it should be possible 
> for each user to see the latest state of the DB.
>
> Any suggestions welcomed.
>
> Cheers,
>
> Julian
>

This isn't anything to do with caching. It's a result of the fact that the 
shell session is running within a single transaction, and therefore doesn't 
see changes from outside that. If you quit the shell and restart it, you'll 
be able to see the change.

This isn't a problem in production, because transactions in views are tied 
to the request/response cycle, which is short-lived.
--
DR.

>  
>

-- 
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/-/qX11CSPon3MJ.
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: chrome v13 + double-running middleware (django 1.3)

2011-08-22 Thread Daniel Roseman
On Monday, 22 August 2011 18:17:09 UTC+1, mcrk wrote:
>
> Hi everyone! 
>
> I've created a simple middleware for mobile detection and when testing 
> values in dev console I came up with some pretty strange behavior. 
> Let's say, I have this simple middleware class: 
>
> class MobileRedirect(object): 
> def process_request(self, request): 
> print "watchdog" 
> return None 
>
> and of course it's loaded in my settings: 
>
> 'django.contrib.messages.middleware.MessageMiddleware', 
> 'middleware.mobile_redirect.MobileRedirect', 
>
> and when I go into my login page, this is the results I get in 
> Firefox: 
>
> watchdog 
> [22/Aug/2011 19:08:02] "GET /login/ HTTP/1.1" 200 742 
> [22/Aug/2011 19:08:02] "GET /static/css/base.css HTTP/1.1" 
> [22/Aug/2011 19:08:02] "GET /static/css/fonts/OpenSans/Ope 
> /1.1" 304 0 
>
> and this is using Chrome v13: 
>
> watchdog 
> [22/Aug/2011 19:09:41] "GET /login/ HTTP/1.1" 200 742 
> [22/Aug/2011 19:09:41] "GET /static/css/base.css HTTP/1.1" 2 
> [22/Aug/2011 19:09:41] "GET /static/css/fonts/OpenSans/OpenS 
> /1.1" 304 0 
> watchdog 
>
> "watchdog" is printed out twice, when using chrome!! Using IE gives 
> the same result as FF.. so how on earth is chrome running the 
> middleware twice?? 
>
> Can anyone please make a similar test and let me know, if You get the 
> same problem.. or just tell me, if I'm doing smth wrong here. I'm new 
> to django.. 
>
> Thanks in advance


Chrome is probably making a request for /favicon.ico, which is being routed 
through your middleware.
--
DR. 

-- 
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/-/dMzQekzzDBsJ.
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: CSS question

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
Sorry to be a party pooper, but inline-block is yet again another one of
those big no-nos when it comes to cross browser/version.

http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/



On Mon, Aug 22, 2011 at 7:35 PM, Axel Bock
wrote:

> Hah! I can answer something on a Django-list - oh joy :) .
> Yes, indeed I have an idea. *inline-block* may be the css thing for you.
>
> A very nice example for that is here:
> http://www.brunildo.org/test/inline-block.html
> Go to http://www.brunildo.org/ to have an overview over a lot of other
> stuff, quite helpful.
>
>
> Greetings,
> Axel.
>
>
> p.s.: does that mean I'm intelligent? ;)
>
>
> Am 21.08.2011 um 23:47 schrieb Joshua Russo:
>
> I know this is a bit off topic but I know this place is full of very
> helpful intelligent people. :o)
>
> Ok so I have an html block (div, p, doesn't matter what kind), and I fill
> it with a label and an input text field. The input is always larger than the
> label (rightly so), but the label is always aligned to the top of the block.
> I want to center the label in the block but for the life of me, I can't
> figure out how.
>
> Any ideas on how to fix it or where to go to get an answer?
>
> --
> 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/-/-6G_bvvoyM0J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: on-site deployment

2011-08-22 Thread Baurzhan Ismagulov
On Mon, Aug 22, 2011 at 02:09:23PM -0400, Sam Bull wrote:
> Here are some of the questions we've come across:

Whew, those are very general questions where there are no right and
wrong answers (like "how should we run our business" -- which you should
know better), just advantages and disadvantages.


> - What will we ultimately be delivering to our clients (a tarball of
>   the code, a physical server, a VM image, a WAR file, etc.)?

I'd go for the software package alone.


> - Who is responsible for the upkeep of the server?

I'd leave that to the customer, and offer to do that for an additional
fee.


> - How will new versions of the product (new code and new content) be
>   provided?

If you're asking about the technical side (not about cost models for
upgrade versions), this depends on how you delivered it in the first
place. If it's a package, I'd supply a new package.


> - How will python dependencies be maintained?

I don't see other choices other than document it or require it
technically. The latter is possible if you deliver a distro-specific
package.


> - Can we assume that the server can access the Internet?

If the software isn't something requiring Internet, I wouldn't assume
that.


> - Can we assume that we can access the server from the Internet?

In general, I wouldn't assume that. However, this could be an option
that has to be agreed with the customer (I've heard about large
organizations allowing this for 24/7 support of their financial
software).


With kind regards,
Baurzhan,.

-- 
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: CSS question

2011-08-22 Thread Axel Bock
Hah! I can answer something on a Django-list - oh joy :) .
Yes, indeed I have an idea. *inline-block* may be the css thing for you. 

A very nice example for that is here: 
http://www.brunildo.org/test/inline-block.html
Go to http://www.brunildo.org/ to have an overview over a lot of other stuff, 
quite helpful.


Greetings, 
Axel.


p.s.: does that mean I'm intelligent? ;)


Am 21.08.2011 um 23:47 schrieb Joshua Russo:

> I know this is a bit off topic but I know this place is full of very helpful 
> intelligent people. :o)
> 
> Ok so I have an html block (div, p, doesn't matter what kind), and I fill it 
> with a label and an input text field. The input is always larger than the 
> label (rightly so), but the label is always aligned to the top of the block. 
> I want to center the label in the block but for the life of me, I can't 
> figure out how.
> 
> Any ideas on how to fix it or where to go to get an answer?
> 
> -- 
> 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/-/-6G_bvvoyM0J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



dynamic field display

2011-08-22 Thread Axel Bock
Hi group, 

I have another question about Django forms. I designed a Form for a Model, but 
now I want to remove fields depending on some user settings. 
Can I do that?

Lets assume the following: 

class MyModel(models.Model):
field1 = TextField(null=True, blank=True)
field2 = Textfield(null=True, blank=True)

class MyModelform(forms.Form):
field1 = TextField()
fiels2 = TextField()

def viewform(request):
# some magic here :)
return render_to_response(context_instance=RequestContext(request, 
{'form':MyModelForm()}))

Now I want to disable field2 in the form on display, depending on the user 
settings. Any suggestions? 

Greetings & thanks, 
Axel.

-- 
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: on-site deployment

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
Hmm, this email is *bordering* on asking the list to do your work for you,
especially since it is for an enterprise product, and not FOSS.

A lot of the subjects you mentioned have been discussed at length on the
mailing list, three of which quite recently.

I think you might get a better response if you tell us what your current
methods are (for each question), and ask for feedback on that.

Others may disagree though.

Cal

On Mon, Aug 22, 2011 at 7:09 PM, Sam Bull  wrote:

> Hi friends,
>
> My company is developing a product using Django that's being sold to the
> enterprise. Many of our prospective clients require that we offer a way for
> them to deploy the product internally. We've settled on a tentative
> solution, but I'd like to know if anyone else has dealt with these
> challenges. Here are some of the questions we've come across:
>
> - What will we ultimately be delivering to our clients (a tarball of the
> code, a physical server, a VM image, a WAR file, etc.)?
>
> - Who is responsible for the upkeep of the server?
>
> - How will new versions of the product (new code and new content) be
> provided?
>
> - How will python dependencies be maintained?
>
> - Can we assume that the server can access the Internet?
>
> - Can we assume that we can access the server from the Internet?
>
> I'd love to connect with anyone who's had to answer these questions. I'd be
> happy to share the solutions we came up with.
>
> Sam
>
> PS- Is on-site deployment even the right name for this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



on-site deployment

2011-08-22 Thread Sam Bull
Hi friends,

My company is developing a product using Django that's being sold to the 
enterprise. Many of our prospective clients require that we offer a way for 
them to deploy the product internally. We've settled on a tentative solution, 
but I'd like to know if anyone else has dealt with these challenges. Here are 
some of the questions we've come across:

- What will we ultimately be delivering to our clients (a tarball of the code, 
a physical server, a VM image, a WAR file, etc.)?

- Who is responsible for the upkeep of the server?

- How will new versions of the product (new code and new content) be provided?

- How will python dependencies be maintained?

- Can we assume that the server can access the Internet?

- Can we assume that we can access the server from the Internet?

I'd love to connect with anyone who's had to answer these questions. I'd be 
happy to share the solutions we came up with.

Sam

PS- Is on-site deployment even the right name for this?

-- 
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: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread hg
Hi,
Just to let everyone know - I uninstalled the mysql-python package for
the server (not just in my virtualenv) and re-installed it, and that
fixed the issue.
Thanks for your help!

On Aug 22, 4:56 pm, Cal Leeming  wrote:
> Do this:
>
> import sys
> print sys.path
>
> Then paste result
>
> Thanks
>
> Cal
>
> On Mon, Aug 22, 2011 at 2:44 PM, hg  wrote:
> > Hi All,
> > Thanks for  taking the time to respond to my question.
> > Cal: I did try uninstalling and re-installing.
> > Kejun: Yes, it's installed.
>
> > On Aug 22, 11:18 am, Kejun He  wrote:
> > > Did you install python-mysqldb  in your mechine??
>
> > > On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
>
> > > cal.leem...@simplicitymedialtd.co.uk> wrote:
> > > > Hold on, i would say this is a django-related question (albeit not
> > related
> > > > to a problem within django). OP - try removing and reinstalling mysqldb
> > on
> > > > your python install and/or env.
> > > > On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > > > > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz <
> > hgo...@gmail.com>
> > > > wrote:
>
> > > > >> Hi everyone,
>
> > > > >> Thank you for taking the time to look at my question.
>
> > > > >> I’m setting up a django project that I got from a code repository,
> > and
> > > > in
> > > > >> trying to run ./manage.py syncdb I get the following error:
>
> > > > >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > > > module:
> > > > >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version
> > (1,
> > > > 2,
> > > > >> 2, 'final', 0).
>
> > > > > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > > > > MySQL databases) installation is borked.
>
> > > > > mysqldb is composed of two layers:
>
> > > > > _mysql is a low level one, a more or less thin wrapper over the C
> > mysql
> > > > client
> > > > > libraries.
>
> > > > > On top of that there is mysldb itself, that uses the services of
> > _mysql
> > > > > and implemets the DB-API specification.
>
> > > > > You seem to have a a corrupt copy because both pieces are released
> > > > together,
> > > > > and when a correct installation has been performed, they are built
> > and
> > > > installed
> > > > > together with matching version IDs.
>
> > > > > You might find better answers in a mailing list or IRC channel
> > > > > devoted to mysqldb. This isn't a Django -related or -specific issue.
>
> > > > > Regards,
>
> > > > > --
> > > > > Ramiro Morales
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > > To post to this group, send email to django-users@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



chrome v13 + double-running middleware (django 1.3)

2011-08-22 Thread mcrk
Hi everyone!

I've created a simple middleware for mobile detection and when testing
values in dev console I came up with some pretty strange behavior.
Let's say, I have this simple middleware class:

class MobileRedirect(object):
def process_request(self, request):
print "watchdog"
return None

and of course it's loaded in my settings:

'django.contrib.messages.middleware.MessageMiddleware',
'middleware.mobile_redirect.MobileRedirect',

and when I go into my login page, this is the results I get in
Firefox:

watchdog
[22/Aug/2011 19:08:02] "GET /login/ HTTP/1.1" 200 742
[22/Aug/2011 19:08:02] "GET /static/css/base.css HTTP/1.1"
[22/Aug/2011 19:08:02] "GET /static/css/fonts/OpenSans/Ope
/1.1" 304 0

and this is using Chrome v13:

watchdog
[22/Aug/2011 19:09:41] "GET /login/ HTTP/1.1" 200 742
[22/Aug/2011 19:09:41] "GET /static/css/base.css HTTP/1.1" 2
[22/Aug/2011 19:09:41] "GET /static/css/fonts/OpenSans/OpenS
/1.1" 304 0
watchdog

"watchdog" is printed out twice, when using chrome!! Using IE gives
the same result as FF.. so how on earth is chrome running the
middleware twice??

Can anyone please make a similar test and let me know, if You get the
same problem.. or just tell me, if I'm doing smth wrong here. I'm new
to django..

Thanks in advance

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



Model caching per python session

2011-08-22 Thread Julian Hodgson
Hi there,

I'm running a production linux django server using wsgi, and have found the
following issue. Django version (1, 2, 5, 'final', 0).

If I open a python shell I get:

>>> from passion.cg.models import *
>>> print Sequence.objects.all()
[, , , ]


But if I go into the admin and delete sequence DD, leaving the python
session running, then I still get

>>> print Sequence.objects.all()
[, , , ]

so the Sequence table doesn't appear to be updated as far as the model is
concerned.

It's pretty fundamental that this can be resolved since many different users
will be using the database at the same time, and it should be possible for
each user to see the latest state of the DB.

Any suggestions welcomed.

Cheers,

Julian

-- 
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: Django-SMS-GAteway

2011-08-22 Thread damola oyeniyi
click-a-tell?




From: damola oyeniyi 
To: "django-users@googlegroups.com" 
Sent: Monday, August 22, 2011 4:03:48 PM
Subject: Django-SMS-GAteway



Is there documentation available on how to use the django-sms -gateway API? I 
am new to django entirely, even slightly new to web development, but I have a 
model that might not need webpages if I get my sms application right. At least 
I can to push a demo to my investors, before I take time to learn templating 
languages etc


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

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



Re: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread Kejun He
On Mon, Aug 22, 2011 at 9:44 PM, hg  wrote:

> Hi All,
> Thanks for  taking the time to respond to my question.
> Cal: I did try uninstalling and re-installing.
> Kejun: Yes, it's installed.
>
> May be you can try to remove the mysql and python-mysqldb, and then
reinstall them.
and ensure the  new python-mysqldb and  the  mysql match.

Good Luck.

>
> On Aug 22, 11:18 am, Kejun He  wrote:
> > Did you install python-mysqldb  in your mechine??
> >
> > On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
> >
> > cal.leem...@simplicitymedialtd.co.uk> wrote:
> > > Hold on, i would say this is a django-related question (albeit not
> related
> > > to a problem within django). OP - try removing and reinstalling mysqldb
> on
> > > your python install and/or env.
> > > On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > > > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz <
> hgo...@gmail.com>
> > > wrote:
> >
> > > >> Hi everyone,
> >
> > > >> Thank you for taking the time to look at my question.
> >
> > > >> I’m setting up a django project that I got from a code repository,
> and
> > > in
> > > >> trying to run ./manage.py syncdb I get the following error:
> >
> > > >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > > module:
> > > >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version
> (1,
> > > 2,
> > > >> 2, 'final', 0).
> >
> > > > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > > > MySQL databases) installation is borked.
> >
> > > > mysqldb is composed of two layers:
> >
> > > > _mysql is a low level one, a more or less thin wrapper over the C
> mysql
> > > client
> > > > libraries.
> >
> > > > On top of that there is mysldb itself, that uses the services of
> _mysql
> > > > and implemets the DB-API specification.
> >
> > > > You seem to have a a corrupt copy because both pieces are released
> > > together,
> > > > and when a correct installation has been performed, they are built
> and
> > > installed
> > > > together with matching version IDs.
> >
> > > > You might find better answers in a mailing list or IRC channel
> > > > devoted to mysqldb. This isn't a Django -related or -specific issue.
> >
> > > > Regards,
> >
> > > > --
> > > > Ramiro Morales
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Django-SMS-GAteway

2011-08-22 Thread damola oyeniyi

Is there documentation available on how to use the django-sms -gateway API? I 
am new to django entirely, even slightly new to web development, but I have a 
model that might not need webpages if I get my sms application right. At least 
I can to push a demo to my investors, before I take time to learn templating 
languages etc

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



message mark_safe and redirect results in message still showiing with encoded tags

2011-08-22 Thread Leon van der Ree
Hello all,

I think I have found a bug, but this time I am not completely sure, so
I post it first in this group.

What I want to do is set an error message in the message-queue and
show this to the user after a redirect. Something pretty common I
guess. So I have the following code:

messages.error(request, mark_safe('some text'))
return HttpResponseRedirect(reverse("intro"))

I know at this time the message is safe, so I mark it as safe. I don't
want to do this in my template of course, since I don't know if all my
messages are safe.

However, it seems that the redirect removes the safe_marking around my
message! since the result I get in my browser is html-encoded!

I did a test and added

messages.info(request, mark_safe('some other text'));

in my controller, and now I get the following result

some other text

some text

some other text So as you can clearly see the two messages before the redirect have lost their safe-state, while the last message shows up as expected. Am I missing something, or why do I seems the only one mentioning this problem? (I don't see anything on the net regarding this issue). -- 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: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread Cal Leeming
Do this:

import sys
print sys.path

Then paste result

Thanks

Cal

On Mon, Aug 22, 2011 at 2:44 PM, hg  wrote:

> Hi All,
> Thanks for  taking the time to respond to my question.
> Cal: I did try uninstalling and re-installing.
> Kejun: Yes, it's installed.
>
>
> On Aug 22, 11:18 am, Kejun He  wrote:
> > Did you install python-mysqldb  in your mechine??
> >
> > On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
> >
> > cal.leem...@simplicitymedialtd.co.uk> wrote:
> > > Hold on, i would say this is a django-related question (albeit not
> related
> > > to a problem within django). OP - try removing and reinstalling mysqldb
> on
> > > your python install and/or env.
> > > On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > > > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz <
> hgo...@gmail.com>
> > > wrote:
> >
> > > >> Hi everyone,
> >
> > > >> Thank you for taking the time to look at my question.
> >
> > > >> I’m setting up a django project that I got from a code repository,
> and
> > > in
> > > >> trying to run ./manage.py syncdb I get the following error:
> >
> > > >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > > module:
> > > >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version
> (1,
> > > 2,
> > > >> 2, 'final', 0).
> >
> > > > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > > > MySQL databases) installation is borked.
> >
> > > > mysqldb is composed of two layers:
> >
> > > > _mysql is a low level one, a more or less thin wrapper over the C
> mysql
> > > client
> > > > libraries.
> >
> > > > On top of that there is mysldb itself, that uses the services of
> _mysql
> > > > and implemets the DB-API specification.
> >
> > > > You seem to have a a corrupt copy because both pieces are released
> > > together,
> > > > and when a correct installation has been performed, they are built
> and
> > > installed
> > > > together with matching version IDs.
> >
> > > > You might find better answers in a mailing list or IRC channel
> > > > devoted to mysqldb. This isn't a Django -related or -specific issue.
> >
> > > > Regards,
> >
> > > > --
> > > > Ramiro Morales
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
Do this:

import sys
print sys.path

Then paste result

Thanks


On Mon, Aug 22, 2011 at 2:44 PM, hg  wrote:

> Hi All,
> Thanks for  taking the time to respond to my question.
> Cal: I did try uninstalling and re-installing.
> Kejun: Yes, it's installed.
>
>
> On Aug 22, 11:18 am, Kejun He  wrote:
> > Did you install python-mysqldb  in your mechine??
> >
> > On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
> >
> > cal.leem...@simplicitymedialtd.co.uk> wrote:
> > > Hold on, i would say this is a django-related question (albeit not
> related
> > > to a problem within django). OP - try removing and reinstalling mysqldb
> on
> > > your python install and/or env.
> > > On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > > > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz <
> hgo...@gmail.com>
> > > wrote:
> >
> > > >> Hi everyone,
> >
> > > >> Thank you for taking the time to look at my question.
> >
> > > >> I’m setting up a django project that I got from a code repository,
> and
> > > in
> > > >> trying to run ./manage.py syncdb I get the following error:
> >
> > > >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > > module:
> > > >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version
> (1,
> > > 2,
> > > >> 2, 'final', 0).
> >
> > > > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > > > MySQL databases) installation is borked.
> >
> > > > mysqldb is composed of two layers:
> >
> > > > _mysql is a low level one, a more or less thin wrapper over the C
> mysql
> > > client
> > > > libraries.
> >
> > > > On top of that there is mysldb itself, that uses the services of
> _mysql
> > > > and implemets the DB-API specification.
> >
> > > > You seem to have a a corrupt copy because both pieces are released
> > > together,
> > > > and when a correct installation has been performed, they are built
> and
> > > installed
> > > > together with matching version IDs.
> >
> > > > You might find better answers in a mailing list or IRC channel
> > > > devoted to mysqldb. This isn't a Django -related or -specific issue.
> >
> > > > Regards,
> >
> > > > --
> > > > Ramiro Morales
> >
> > > > --
> > > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

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



Re: Need help on django admin site

2011-08-22 Thread Jaspreet Sarao
On Mon, Aug 22, 2011 at 12:11 PM, Temulen Odbayar  wrote:
> I'm creating a web with people registration site. And also companies
> can register people... I think i can use admin site to do these things
> and don't need to create another page with registration form. But if
> companies can use admin site they may do anything they want. So i
> think i can use group permission but it's maybe not good at security.
> I need advice on this. Sorry my bad english ^_^. Any help?
You need to create a registrartion form in django for users only
Don't use admin site for this . There is risk
All the best

--
Jaspreet sarao
email: jaspritsa...@gmail.com
Blog: jaspreetsarao.wordpress.com

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



Re: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread hg
Hi All,
Thanks for  taking the time to respond to my question.
Cal: I did try uninstalling and re-installing.
Kejun: Yes, it's installed.


On Aug 22, 11:18 am, Kejun He  wrote:
> Did you install python-mysqldb  in your mechine??
>
> On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
>
> cal.leem...@simplicitymedialtd.co.uk> wrote:
> > Hold on, i would say this is a django-related question (albeit not related
> > to a problem within django). OP - try removing and reinstalling mysqldb on
> > your python install and/or env.
> > On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz 
> > wrote:
>
> > >> Hi everyone,
>
> > >> Thank you for taking the time to look at my question.
>
> > >> I’m setting up a django project that I got from a code repository, and
> > in
> > >> trying to run ./manage.py syncdb I get the following error:
>
> > >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> > module:
> > >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version (1,
> > 2,
> > >> 2, 'final', 0).
>
> > > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > > MySQL databases) installation is borked.
>
> > > mysqldb is composed of two layers:
>
> > > _mysql is a low level one, a more or less thin wrapper over the C mysql
> > client
> > > libraries.
>
> > > On top of that there is mysldb itself, that uses the services of _mysql
> > > and implemets the DB-API specification.
>
> > > You seem to have a a corrupt copy because both pieces are released
> > together,
> > > and when a correct installation has been performed, they are built and
> > installed
> > > together with matching version IDs.
>
> > > You might find better answers in a mailing list or IRC channel
> > > devoted to mysqldb. This isn't a Django -related or -specific issue.
>
> > > Regards,
>
> > > --
> > > Ramiro Morales
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

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



Cant view Django using IIS6, with Python 2.6 on Win2K3

2011-08-22 Thread siddhartha veedaluru
Hi,

i'm new to Django,tyring to create a website for myself, on win2k3 with
python 2.6 and backend as MSSQL.
i have made all the configurations mentioned in the below link and i'm not
able to make it work.
Any body tried and make it work. please share you knowledge.

https://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer

thanks
Siddhartha

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



Need help on django admin site

2011-08-22 Thread Temulen Odbayar
I'm creating a web with people registration site. And also companies
can register people... I think i can use admin site to do these things
and don't need to create another page with registration form. But if
companies can use admin site they may do anything they want. So i
think i can use group permission but it's maybe not good at security.
I need advice on this. Sorry my bad english ^_^. Any help?

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



models.URLField does not validate a valid url

2011-08-22 Thread Burcu Hamamcıoğlu
Hi all, I 've a strange issue with URLField. It does not validate "
http://www.babacanyapi.com"; and "ttp://www.crowntowers.net". When ı use
these urls the browser does not open anything I think it troubles into  an
infinite loop.  Why django does not recognize these urls?

-- 
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: Specific models without a database table

2011-08-22 Thread bruno desthuilliers
On 20 août, 03:33, Kristofer Pettijohn 
wrote:
> Hello,
>
> Is it possible to create specific models without a database table?


Depends on your definition of "models". If you mean "django.db.Model"
subclasses, nope - this part is nothing but a layer between your app
and the database. Now you can obviously write "domain model" classes
that are not tied to a relational DB, but you won't have the
querying / persistance support provided by Django's ORM.

-- 
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: Specific models without a database table

2011-08-22 Thread bruno desthuilliers
On 20 août, 12:51, Malcolm Box  wrote:
> On 20 August 2011 02:33, Kristofer Pettijohn wrote:
>
> > Hello,
>
> > Is it possible to create specific models without a database table?
>
> Yes, it's possible. You want the "managed" attribute on the model - 
> seehttps://docs.djangoproject.com/en/1.3/ref/models/options/#managed
>
> This will prevent Django from creating or modifying the db table


It won't make the model work without the corresponding DB table.

-- 
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: Django 1.3 logging not working as I'd expect

2011-08-22 Thread bruno desthuilliers
On 22 août, 13:27, Reinout van Rees  wrote:
>
> Probably all your logging statements are executed right at file import
> time before the logging is actually configured.

Using the DictConfig in settings.py, the logger is configured before
the apps models / views / whatever  are imported.

@Scott: Are you running the dev server ? If yes, the settings module
should be imported "only" twice so you may import it directly (ie:
"import settings") from your app. If yes, replace this with "from
django.conf import settings", which is the right way to access the
settings from an app.

-- 
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: Help installing django-sentry

2011-08-22 Thread Malcolm Box
Post your urls.py file - it looks like you have a pattern that is over 
aggressively matching /sentry as a poll. 

Malcolm

Sent from my iPhone, please excuse any typos

On 21 Aug 2011, at 21:18, tharshan muthulingam  wrote:

> Hi, 
> I have been having alot of trouble trying to install and run django-sentry. 
> My project directory is ~/django_projects/Project
> 
> Inside there i have the simple polls app from the tutorial, and I have 
> installed sentry using pip. I have added it to the list of installed apps.
> 
> When I go to the sentry directory I got this error:
> http://127.0.0.1:8000/sentry/
> 
> ViewDoesNotExist at /sentry/Tried result in module polls.views. Error was: 
> 'module' object has no attribute 'result'
> 
> I honestly have no clue what that means, and I would really appreciate some 
> help with fixing this.
> 
> Thank you!!
> -- 
> 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/-/XAczs-79BVMJ.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.

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



Re: Django 1.3 logging not working as I'd expect

2011-08-22 Thread Reinout van Rees

On 20-08-11 06:51, Scott Danzig wrote:


I have a simple Django app in development that uses a dictConfig setting
simpler than the default in settings.py:

LOGGING = {

[snip]

}

Then later in code that I know is run... (I tried in my app's views.py
and also the backend).. I put something like this:

import logging
logger = logging.getLogger('testlogger')
logger.warn('hello')
logger.info('please appear')

And I just don't see it, neither in the console, nor the file.


Probably all your logging statements are executed right at file import 
time before the logging is actually configured.


Just as a simple test, put such a logging statement inside one of your 
view methods and hit it in your browser. Just to make sure your logging 
setup as such works.



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

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



Re: How to create a sub-app directly

2011-08-22 Thread kenneth gonsalves
On Mon, 2011-08-22 at 00:57 -0700, i...@webbricks.co.uk wrote:
> which is fine, but you've missed the only step that actually makes the
> folder a python module.
> 
> do this or it'll never import
> touch __init__.py 

got distracted and pressed send too soon.
-- 
regards
Kenneth Gonsalves

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



Re: Help installing django-sentry

2011-08-22 Thread Praveen Krishna R
*(I have never used the package you mentioned. )
Do you think you have configured the urls ( /sentry in your case ) for the
django-sentry !?
*
On Sun, Aug 21, 2011 at 11:18 PM, tharshan muthulingam  wrote:

> Hi,
> I have been having alot of trouble trying to install and run django-sentry.
> My project directory is ~/django_projects/Project
>
> Inside there i have the simple polls app from the tutorial, and I have
> installed sentry using pip. I have added it to the list of installed apps.
>
> When I go to the sentry directory I got this error:
> http://127.0.0.1:8000/sentry/
>
> ViewDoesNotExist at /sentry/Tried result in module polls.views. Error was:
> 'module' object has no attribute 'result'
>
> I honestly have no clue what that means, and I would really appreciate some
> help with fixing this.
>
> Thank you!!
>
> --
> 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/-/XAczs-79BVMJ.
> 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.
>



-- 
Thanks and Regards,
*Praveen Krishna R*

-- 
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: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread Kejun He
Did you install python-mysqldb  in your mechine??

On Mon, Aug 22, 2011 at 3:45 PM, Cal Leeming [Simplicity Media Ltd] <
cal.leem...@simplicitymedialtd.co.uk> wrote:

> Hold on, i would say this is a django-related question (albeit not related
> to a problem within django). OP - try removing and reinstalling mysqldb on
> your python install and/or env.
> On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> > On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz 
> wrote:
> >>
> >>
> >> Hi everyone,
> >>
> >> Thank you for taking the time to look at my question.
> >>
> >>
> >>
> >> I’m setting up a django project that I got from a code repository, and
> in
> >> trying to run ./manage.py syncdb I get the following error:
> >>
> >>
> >>
> >> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
> module:
> >> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version (1,
> 2,
> >> 2, 'final', 0).
> >
> > Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> > MySQL databases) installation is borked.
> >
> > mysqldb is composed of two layers:
> >
> > _mysql is a low level one, a more or less thin wrapper over the C mysql
> client
> > libraries.
> >
> > On top of that there is mysldb itself, that uses the services of _mysql
> > and implemets the DB-API specification.
> >
> > You seem to have a a corrupt copy because both pieces are released
> together,
> > and when a correct installation has been performed, they are built and
> installed
> > together with matching version IDs.
> >
> > You might find better answers in a mailing list or IRC channel
> > devoted to mysqldb. This isn't a Django -related or -specific issue.
> >
> > Regards,
> >
> > --
> > Ramiro Morales
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>

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



Re: How to create a sub-app directly

2011-08-22 Thread i...@webbricks.co.uk
which is fine, but you've missed the only step that actually makes the
folder a python module.

do this or it'll never import
touch __init__.py



On Aug 22, 8:32 am, kenneth gonsalves  wrote:
> On Sun, 2011-08-21 at 08:22 -0700, Jim wrote:
>
> > Here is the story. I created a site, mysite, with this command
> > django-admin startproject mysite. Then, under the directory mysite/, I
> > created an app named apps with this command ./manage.py startapp apps.
> > apps is meant to hold all applications for mysite. Now, here comes the
> > question:  How do I create a sub-app under apps with manage.py
> > directly?
>
> one way to do this:
> cd apps
> mkdir subapp
> cd subapp
> touch models.py
> touch views.py
> touch tests.py
>
> --
> regards
> Kenneth Gonsalves

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



Re: CSS question

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
-- Forwarded message --
From: "Cal Leeming" 
Date: Aug 22, 2011 8:49 AM
Subject: Re: CSS question
To: 

OP - let me know if you resolved your issue. If not, ill show you the
standard way of doing it.

For the record - vertical align in some usages isnt going to work very
nicely cross browser/versions.
On Aug 21, 2011 10:47 PM, "Joshua Russo"  wrote:
> I know this is a bit off topic but I know this place is full of very
> helpful intelligent people. :o)
>
> Ok so I have an html block (div, p, doesn't matter what kind), and I fill
it
> with a label and an input text field. The input is always larger than the
> label (rightly so), but the label is always aligned to the top of the
block.
> I want to center the label in the block but for the life of me, I can't
> figure out how.
>
> Any ideas on how to fix it or where to go to get an answer?
>
> --
> 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/-/-6G_bvvoyM0J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: CSS question

2011-08-22 Thread Cal Leeming
OP - let me know if you resolved your issue. If not, ill show you the
standard way of doing it.

For the record - vertical align in some usages isnt going to work very
nicely cross browser/versions.
On Aug 21, 2011 10:47 PM, "Joshua Russo"  wrote:
> I know this is a bit off topic but I know this place is full of very
> helpful intelligent people. :o)
>
> Ok so I have an html block (div, p, doesn't matter what kind), and I fill
it
> with a label and an input text field. The input is always larger than the
> label (rightly so), but the label is always aligned to the top of the
block.
> I want to center the label in the block but for the life of me, I can't
> figure out how.
>
> Any ideas on how to fix it or where to go to get an answer?
>
> --
> 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/-/-6G_bvvoyM0J.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: FW: MySQLdb version doesn't match _mysql version

2011-08-22 Thread Cal Leeming [Simplicity Media Ltd]
Hold on, i would say this is a django-related question (albeit not related
to a problem within django). OP - try removing and reinstalling mysqldb on
your python install and/or env.
On Aug 21, 2011 2:20 PM, "Ramiro Morales"  wrote:
> On Sun, Aug 21, 2011 at 5:08 AM, Hadassa Golovenshitz 
wrote:
>>
>>
>> Hi everyone,
>>
>> Thank you for taking the time to look at my question.
>>
>>
>>
>> I’m setting up a django project that I got from a code repository, and in
>> trying to run ./manage.py syncdb I get the following error:
>>
>>
>>
>> django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb
module:
>> this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version (1,
2,
>> 2, 'final', 0).
>
> Seems you mysqldb (the Python DB-API 2.0 compatible library to access
> MySQL databases) installation is borked.
>
> mysqldb is composed of two layers:
>
> _mysql is a low level one, a more or less thin wrapper over the C mysql
client
> libraries.
>
> On top of that there is mysldb itself, that uses the services of _mysql
> and implemets the DB-API specification.
>
> You seem to have a a corrupt copy because both pieces are released
together,
> and when a correct installation has been performed, they are built and
installed
> together with matching version IDs.
>
> You might find better answers in a mailing list or IRC channel
> devoted to mysqldb. This isn't a Django -related or -specific issue.
>
> Regards,
>
> --
> Ramiro Morales
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>

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



Re: How to create a sub-app directly

2011-08-22 Thread kenneth gonsalves
On Sun, 2011-08-21 at 08:22 -0700, Jim wrote:
> 
> Here is the story. I created a site, mysite, with this command
> django-admin startproject mysite. Then, under the directory mysite/, I
> created an app named apps with this command ./manage.py startapp apps.
> apps is meant to hold all applications for mysite. Now, here comes the
> question:  How do I create a sub-app under apps with manage.py
> directly? 

one way to do this:
cd apps
mkdir subapp
cd subapp
touch models.py
touch views.py
touch tests.py

-- 
regards
Kenneth Gonsalves

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



Re: Port of Django Template Language to PHP

2011-08-22 Thread kenneth gonsalves
On Sun, 2011-08-21 at 16:22 +0200, Rune Kaagaard wrote:
> @Kenneth+@Masklinn: You are right, there are a lot of template
> languages already, but this particular wheel is - unlike twig - not a
> compiled language but implemented in pure PHP as an Iterator, allowing
> it to blend in as an extension to your existing PHP templates.
> 
> 

I think you misunderstood me - I meant that continually reinventing the
wheel is a good thing, and leads to better and better wheels of all
sizes and shapes.
-- 
regards
Kenneth Gonsalves

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