Saturday, October 31, 2015

Re: Translation is not working for Template even though po and mo files are created

The translation for my template finally gets to work after I explicitly have LOCALE_PATHS configured in settings.py!!!!!
Thanks very much for providing the hint :)

Actually the models and template come from different applications:

~/django-swingtime/django-swingtime-master/swingtime # Models come from this swingtime application where translation worked.

~/django-swingtime/django-swingtime-master/demo # Templates come from this demo application where translation didn't work previously. (I'm running the server from demo folder actually... '~/django-swingtime/django-swingtime-master/demo> python manage.py runserver
')
It's weird demo was not recognized while swingtime was recognized for translation, though.

Br
Sean

On Friday, October 30, 2015 at 9:47:53 PM UTC+8, Andréas Kühne wrote:
Hmmm....

I'm a bit at a loss here. But does Django know where to find the .mo files? Is it only your template that isn't getting translated, because you said that the form itself is?

Regards,

Andréas

2015-10-30 12:45 GMT+01:00 Sean Xu <seanx...@gmail.com>:
Now I have corrected the orders of each Middleware class and removed the duplicated SessionMiddleware:
MIDDLEWARE_CLASSES = (
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.middleware.locale.LocaleMiddleware',
   
'django.middleware.common.CommonMiddleware',    
   
'django.contrib.auth.middleware.AuthenticationMiddleware',    
   
'django.contrib.messages.middleware.MessageMiddleware',
)
I also added django.core.context_processors.i18n as one of the context processors. (I just realized that I'm using Django version 1.7 something so django.template.context_processors.i18n should really be django.core.context_processors.i18n).
But unfortunately the translation for my template still does not work :(

On Friday, October 30, 2015 at 7:27:36 PM UTC+8, Sean Xu wrote:
Hi Andréas,

Thanks very much for providing the help.
Currently the middleware classes are configured like this:

MIDDLEWARE_CLASSES = (
   
'django.middleware.common.CommonMiddleware',
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.contrib.auth.middleware.AuthenticationMiddleware',
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.middleware.locale.LocaleMiddleware',
   
'django.contrib.messages.middleware.MessageMiddleware',
)

 I guess the order of these middleware is not correct because LocaleMiddleware should come before CommonMiddleware.

I have LANGUAGES defined in settings.py like this:
from django.utils.translation import ugettext_lazy as _

...
LANGUAGES
= (
 
('zh', _('Chinese')),
 
('en', _('English')),
)
And I don't have django.template.context_processors.i18n defined for TEMPLATE_CONTEXT_PROCESSORS in settings.py. Do I need to add this i18n context processor to settings.py?

Br
Sean

On Friday, October 30, 2015 at 6:07:21 PM UTC+8, Andréas Kühne wrote:
Hi,

Have you made sure that you have activated the languages you want in your application? 
Also, how is the current language being selected?

Regards,

Andréas

2015-10-30 7:45 GMT+01:00 Sean Xu <seanx...@gmail.com>:
Hi,

I'm learning Django Translation using django-swingtime with Django 1.7.9 installed.
I followed the official docs and embedded my string to translate with <title>{% trans "String to translate" %}</title> in my Template and managed to create both the po and mo files successfully.
But, the page is still shown up in English.
Note: the translation works just fine for my models.

Partly of the template I was using can be found from below:
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block title %}Event Occurrence{% endblock %}
{% block main_content %}
     
<h3>{% trans "Swingtime Event Occurrence" %}</h3>
     
<h4>
         
<a href="{{ occurrence.event.get_absolute_url }}">{{ occurrence.title }}</a>
         
&ndash;
         
{% with occurrence.start_time as st  %}
         
<a href="{% url 'swingtime-daily-view' st.year st.month st.day %}">
           
{{ st|date:"l, F jS P" }}</a>
       
</h4>
        {% endwith %}
     <dl>
         <dt>{% trans "Event type:" %}</
dt>
         
<dd>{{ occurrence.event.event_type }}</dd>

The subroutine to render my Template is:
#-------------------------------------------------------------------------------
def occurrence_view(
    request
,
    event_pk
,
    pk
,
   
template='swingtime/occurrence_detail.html',
    form_class
=forms.SingleOccurrenceForm
):
   
'''
    View a specific occurrence and optionally handle any updates.
   
    Context parameters:
   
    ``occurrence``
        the occurrence object keyed by ``pk``


    ``form``
        a form object for updating the occurrence
    '''

 
    occurrence
= get_object_or_404(Occurrence, pk=pk, event__pk=event_pk)
   
if request.method == 'POST':
        form
= form_class(request.POST, instance=occurrence)
       
if form.is_valid():
            form
.save()
           
return http.HttpResponseRedirect(request.path)
   
else:  
        form
= form_class(instance=occurrence)
       
   
return render(request, template, {'occurrence': occurrence, 'form': form})

And the url configuration associated with the Template reads:
    url(
        r
'^events/(\d+)/(\d+)/$',
        views
.occurrence_view,
        name
='swingtime-occurrence'
   
),

Could some one help me solve this problem?
Thanks very much

Br
Sean

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a45afc10-97ad-4574-b541-14ff67e892cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4c2d6bbe-c586-410c-8c61-338ecc01caf1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3d0f50f-a5dd-4d84-915d-3b31266eea9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django templates

Hi,

There aren't any specific templates for windows or any other operating system. Django runs on a webserver and is compatible regardless of OS. I would recommend that you look at the tutorial and see how to get started: https://docs.djangoproject.com/en/1.8/intro/tutorial01/

Regards,

Andréas

2015-10-31 15:58 GMT+01:00 misheck mujeyi <misheckmujeyi@gmail.com>:
hi guys 

a still very new to django so i was wondering is ter a link where i  can find Djnago windows templates

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ec9ef38-a39f-4860-89c1-a1f93a780d2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbm%2B9JHbkotuZVLz8hMN6Y61JzN14x6NXXDXEYM77tsnrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Django bootstrap3_datetime widget in admin site doesn't pass form data

I'm trying to replace the standard AdminSplitDateTime widget in my admin site for better functionality (basically I want to display only 'available' dates in my calender which I couldn't find how to do with the default picker). I decided to use the bootstrap3_datetime widget.

After overriding my field to use the new widget, it doesn't seem to be transferred into the 'clean' method (isn't in self.cleaned_data) for validation.

models.py

publish_time = models.DateTimeField('Date to publish')

admin.py

class MyForm(forms.ModelForm):

    def __init__(self, *args, **kwargs):
        super(MyForm, self).__init__(*args, **kwargs)
        bad_dates = []
        #populating bad_dates with application logic

    def clean(self):

        # This will always return None when using the new widget.
        # When working with the default widget, I have the correct value.
        publish_time = self.cleaned_data.get('publish_time', None)


    publish_time = forms.DateTimeField(widget=DateTimePicker(options=
            {"format": "DD-MM-YYYY HH:mm",
             "startDate": timezone.now().strftime('%Y-%m-%d'),
             "disabledDates": bad_dates,
             })

class MyModelAdmin(admin.ModelAdmin):
    form = MyForm

admin.site.register(MyModel, MyModelAdmin)

HTML-wise, the widget works well and the text field is populated with the correct date (and with the 'bad_dates' disabled). The problem is that it seems it isn't saved on the form.

I also tried initializing the widget in the init method by doing:

self.fields['publish_time'].widget = DateTimePicker(options=...)

But the result was the same.

I've analysed the POST request that is sent using each of the widgets. In the default admin widget, I see that it generates two fields: "publish_time_0" (for date) and "publish_time_1" (for time). In the bootstrap3 widget, only a single "publish_time" field is sent.

I'm assuming that the admin site understands that the field is a DateTimeField (from models), looks for id_0 and id_1 and that's why it fails. Does that make sense? Is there anyway around it?

Thanks a lot!
Ilia

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/21215bea-1acb-4f95-b77e-9c00601be69c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django templates

hi guys 

a still very new to django so i was wondering is ter a link where i  can find Djnago windows templates

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6ec9ef38-a39f-4860-89c1-a1f93a780d2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: install gettext tools 0.15

Maybe I download a wrong files I have win 8 x64 and from

https://download.gnome.org/binaries/win64/dependencies/

I download files:

gettext-runtime_0.18.1.1-1_win64.zip

gettext-tools_0.18.1.1-1_win64.zip

create folder in path C:\Program Files\gettext-utils and extract this 2 files there. There isn't msgfmt.exe file

W dniu piątek, 30 października 2015 21:33:52 UTC+1 użytkownik Dariusz Mysior napisał:

I use Windows 8 Python 3.4 Django 1.8 and I try

I set settings and add: USE_I18N = True

add to MIDDLEWARE_CLASSES django.middleware.locale.LocaleMiddleware

like in describe in link below

https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#gettext-on-windows

I download gettext-runtime_0.18.1.1-1_win64 and gettext-tools_0.18.1.1-1_win64 extract to C:\Program Files\gettext-utils add path like in link to Control Panel > System > Advanced > Environment Variables and when I write to terminal C:\Python34\ownsite>manage.py compilemessages I had info :(

CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.

What can I do more??? I have lost a few days on

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2669aec4-ef74-4ef6-94c8-dad4d20a29fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Friday, October 30, 2015

Re: install gettext tools 0.15

On Fri, Oct 30, 2015 at 5:59 PM, Dariusz Mysior <mysior.darek@gmail.com>wrote:
> I do this and I have msfgmt is not recognized as an internal or external
> command, operable program or a batch file.

Then you'll need to identify, among the directories created by the
installation of gettext tools, which is the one that contains
msgfmt.exe. That's the one you need to add to the PATH env var.

>
> W dniu piątek, 30 października 2015 21:33:52 UTC+1 użytkownik Dariusz Mysior
> napisał:
>>
>> I use Windows 8 Python 3.4 Django 1.8 and I try
>>
>> I set settings and add: USE_I18N = True
>>
>> add to MIDDLEWARE_CLASSES django.middleware.locale.LocaleMiddleware
>>
>> like in describe in link below
>>
>>
>> https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#gettext-on-windows
>>
>> I download gettext-runtime_0.18.1.1-1_win64 and
>> gettext-tools_0.18.1.1-1_win64 extract to C:\Program Files\gettext-utils add
>> path like in link to Control Panel > System > Advanced > Environment
>> Variables and when I write to terminal C:\Python34\ownsite>manage.py
>> compilemessages I had info :(
>>
>> CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15
>> or newer installed.
>>
>> What can I do more??? I have lost a few days on
>

--
Ramiro Morales
@ramiromorales

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO7PdF-1ZGuAQV3pOHWLOeLnj_nS7Tue8KSFRR%3DgMrXDyD35VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: install gettext tools 0.15

I do this and I have msfgmt is not recognized as an internal or external command, operable program or a batch file.

W dniu piątek, 30 października 2015 21:33:52 UTC+1 użytkownik Dariusz Mysior napisał:

I use Windows 8 Python 3.4 Django 1.8 and I try

I set settings and add: USE_I18N = True

add to MIDDLEWARE_CLASSES django.middleware.locale.LocaleMiddleware

like in describe in link below

https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#gettext-on-windows

I download gettext-runtime_0.18.1.1-1_win64 and gettext-tools_0.18.1.1-1_win64 extract to C:\Program Files\gettext-utils add path like in link to Control Panel > System > Advanced > Environment Variables and when I write to terminal C:\Python34\ownsite>manage.py compilemessages I had info :(

CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.

What can I do more??? I have lost a few days on

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/11f5728d-5ad6-4c65-9761-facf8ddcd260%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: install gettext tools 0.15

On Fri, Oct 30, 2015 at 5:33 PM, Dariusz Mysior <mysior.darek@gmail.com> wrote:
> I use Windows 8 Python 3.4 Django 1.8 and I try
>
> I set settings and add: USE_I18N = True
>
> add to MIDDLEWARE_CLASSES django.middleware.locale.LocaleMiddleware
>
> like in describe in link below
>
> https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#gettext-on-windows
>
> I download gettext-runtime_0.18.1.1-1_win64 and
> gettext-tools_0.18.1.1-1_win64 extract to C:\Program Files\gettext-utils add
> path like in link to Control Panel > System > Advanced > Environment
> Variables and when I write to terminal C:\Python34\ownsite>manage.py
> compilemessages I had info :(
>
> CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15
> or newer installed.
>
> What can I do more??? I have lost a few days on

Make sure you can execute msgfmt.exe from any path on your system.
That will indicate the directory where it is located has actually and
correctly been added to the PATH environment variable.

For example, open a Command prompt window and type msfgmt<Enter>.

This is more a general Windows system admin topic.

--
Ramiro Morales
@ramiromorales

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAO7PdF-K2XNuxa4cGkp4hmq8mtDL%3DvDY4f22zK7LHgCiXr%3DPtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

install gettext tools 0.15

I use Windows 8 Python 3.4 Django 1.8 and I try

I set settings and add: USE_I18N = True

add to MIDDLEWARE_CLASSES django.middleware.locale.LocaleMiddleware

like in describe in link below

https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#gettext-on-windows

I download gettext-runtime_0.18.1.1-1_win64 and gettext-tools_0.18.1.1-1_win64 extract to C:\Program Files\gettext-utils add path like in link to Control Panel > System > Advanced > Environment Variables and when I write to terminal C:\Python34\ownsite>manage.py compilemessages I had info :(

CommandError: Can't find msgfmt. Make sure you have GNU gettext tools 0.15 or newer installed.

What can I do more??? I have lost a few days on

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a8d67475-b471-4683-aeaf-aa43e9d547e7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Does the bulk delete check the permissions correctly?

I think there are a number of open tickets related to this. See https://code.djangoproject.com/ticket/23869 and the first comment that links to related issues. Feel free to offer a patch if you are able.

On Friday, October 30, 2015 at 3:04:21 PM UTC-4, Szymon Pyżalski wrote:
Hello!

According to the documentation, the behaviour of has_delete_permission
should look like this:

If obj is None, should return True or False to indicate whether deleting
objects of this type is permitted in general (e.g., False will be
interpreted as meaning that the current user is not permitted to delete
any object of this type).

I was amazed therefore when I saw that when this method returns True for
object=None, the *any bulk delete is possible*. This leads to a very
nonintuitive situation, where it is impossible to delete an object
directly, but it is possible to include it in a bulk to delete. Is it
the desired behaviour? Is it possible to check permissions for all
objects in bulk? If no, there should be a big fat warning about it in
the documentation.

Greetings
Szymon

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1184f95b-8931-4d58-a108-fbe2d6b384f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Does the bulk delete check the permissions correctly?

Hello!

According to the documentation, the behaviour of has_delete_permission
should look like this:

If obj is None, should return True or False to indicate whether deleting
objects of this type is permitted in general (e.g., False will be
interpreted as meaning that the current user is not permitted to delete
any object of this type).

I was amazed therefore when I saw that when this method returns True for
object=None, the *any bulk delete is possible*. This leads to a very
nonintuitive situation, where it is impossible to delete an object
directly, but it is possible to include it in a bulk to delete. Is it
the desired behaviour? Is it possible to check permissions for all
objects in bulk? If no, there should be a big fat warning about it in
the documentation.

Greetings
Szymon

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5633B5A2.1010207%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: mssql databASE CONNECTION to Django

np...but thanks for your time

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0f860fa9-7fa0-4045-aa09-92bc7eb3cf73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: mssql databASE CONNECTION to Django

Sorry, I haven't used the library myself and can't provide any additional help.

On Friday, October 30, 2015 at 10:31:35 AM UTC-4, Sid wrote:
sorry tim I know I am asking a dumb question...can you please tell me what is the best way to make it work please if possibe...because I am struck form last 2 days

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/28279fb0-be9c-47bc-b4de-1080a6b5c759%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: mssql databASE CONNECTION to Django

sorry tim I know I am asking a dumb question...can you please tell me what is the best way to make it work please if possibe...because I am struck form last 2 days

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/440c0480-4b24-4495-bb57-ac47a6a00f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: mssql databASE CONNECTION to Django

Please read the documentation: https://django-mssql.readthedocs.org/en/latest/quickstart.html

On Friday, October 30, 2015 at 9:53:42 AM UTC-4, Sid wrote:
so which version will be compatible...

On Friday, October 30, 2015 at 7:54:26 AM UTC-4, Tim Graham wrote:
django-mssql doesn't support Django 1.8 yet:

https://django-mssql.readthedocs.org/en/latest/changelog.html

On Thursday, October 29, 2015 at 9:36:38 PM UTC-4, Sid wrote:
Hi all,
I am trying to connect database which is in server to django, but it is showing many errors like(platform i am using M visual studio)

Traceback (most recent call last):
  File "C:\Users\speesary\Desktop\programs\learn\learn\manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\core\management\__init__.py", line 351, in execute_from_command_line
    utility.execute()
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\core\management\__init__.py", line 325, in execute
    django.setup()
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\apps\config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\contrib\auth\models.py", line 41, in <module>
    class Permission(models.Model):
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\base.py", line 139, in __new__
    new_class.add_to_class('_meta', Options(meta, **kwargs))
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\base.py", line 324, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\options.py", line 250, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\utils.py", line 240, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\utils.py", line 111, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\backends\sqlserver_ado\base.py", line 5, in <module>
    from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseValidation, BaseDatabaseClient
ImportError: cannot import name BaseDatabaseWrapper
The Python REPL process has exited

code in my settings.py
PACKAGES ADDED:
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.client import BaseDatabaseClient
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.backends.base.introspection import BaseDatabaseIntrospection
#from django.db.backends.base.introspection import FieldInfo, TableInfo
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.util import CursorWrapper
from os import path

'default': {
        'ENGINE': 'django.db.backends.sqlserver_ado'  ,                                                                #'django.db.backends.sqlserver_ado'
        'NAME': 'Siddharth',
        'USER': 'SCGLOBAL\speesary@ALMDATA',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT':'',
        'OPTIONS': {
     
        'driver':'SQL Server Native Client 11.0',
        'MARS_Connection': True,
can anyone please tell me the procedure how to do it. it will be very helpful...
your help is much appreciated

Thanks 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c2c7265d-6495-475b-b963-8d7c54ea9cec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: mssql databASE CONNECTION to Django

so which version will be compatible...

On Friday, October 30, 2015 at 7:54:26 AM UTC-4, Tim Graham wrote:
django-mssql doesn't support Django 1.8 yet:

https://django-mssql.readthedocs.org/en/latest/changelog.html

On Thursday, October 29, 2015 at 9:36:38 PM UTC-4, Sid wrote:
Hi all,
I am trying to connect database which is in server to django, but it is showing many errors like(platform i am using M visual studio)

Traceback (most recent call last):
  File "C:\Users\speesary\Desktop\programs\learn\learn\manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\core\management\__init__.py", line 351, in execute_from_command_line
    utility.execute()
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\core\management\__init__.py", line 325, in execute
    django.setup()
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\apps\registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\apps\config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\contrib\auth\models.py", line 41, in <module>
    class Permission(models.Model):
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\base.py", line 139, in __new__
    new_class.add_to_class('_meta', Options(meta, **kwargs))
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\base.py", line 324, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\models\options.py", line 250, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\__init__.py", line 36, in __getattr__
    return getattr(connections[DEFAULT_DB_ALIAS], item)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\utils.py", line 240, in __getitem__
    backend = load_backend(db['ENGINE'])
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\utils.py", line 111, in load_backend
    return import_module('%s.base' % backend_name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "C:\Users\speesary\AppData\Local\Continuum\Anaconda\lib\site-packages\django-1.8.5-py2.7.egg\django\db\backends\sqlserver_ado\base.py", line 5, in <module>
    from django.db.backends import BaseDatabaseWrapper, BaseDatabaseFeatures, BaseDatabaseValidation, BaseDatabaseClient
ImportError: cannot import name BaseDatabaseWrapper
The Python REPL process has exited

code in my settings.py
PACKAGES ADDED:
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.backends.base.client import BaseDatabaseClient
from django.db.backends.base.creation import BaseDatabaseCreation
from django.db.backends.base.features import BaseDatabaseFeatures
from django.db.backends.base.introspection import BaseDatabaseIntrospection
#from django.db.backends.base.introspection import FieldInfo, TableInfo
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.backends.base.validation import BaseDatabaseValidation
from django.db.backends.util import CursorWrapper
from os import path

'default': {
        'ENGINE': 'django.db.backends.sqlserver_ado'  ,                                                                #'django.db.backends.sqlserver_ado'
        'NAME': 'Siddharth',
        'USER': 'SCGLOBAL\speesary@ALMDATA',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT':'',
        'OPTIONS': {
     
        'driver':'SQL Server Native Client 11.0',
        'MARS_Connection': True,
can anyone please tell me the procedure how to do it. it will be very helpful...
your help is much appreciated

Thanks 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8e03eff-d288-44df-889f-6bfc97116cb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Translation is not working for Template even though po and mo files are created

Hmmm....

I'm a bit at a loss here. But does Django know where to find the .mo files? Is it only your template that isn't getting translated, because you said that the form itself is?

Regards,

Andréas

2015-10-30 12:45 GMT+01:00 Sean Xu <seanxu1984@gmail.com>:
Now I have corrected the orders of each Middleware class and removed the duplicated SessionMiddleware:
MIDDLEWARE_CLASSES = (
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.middleware.locale.LocaleMiddleware',
   
'django.middleware.common.CommonMiddleware',    
   
'django.contrib.auth.middleware.AuthenticationMiddleware',    
   
'django.contrib.messages.middleware.MessageMiddleware',
)
I also added django.core.context_processors.i18n as one of the context processors. (I just realized that I'm using Django version 1.7 something so django.template.context_processors.i18n should really be django.core.context_processors.i18n).
But unfortunately the translation for my template still does not work :(

On Friday, October 30, 2015 at 7:27:36 PM UTC+8, Sean Xu wrote:
Hi Andréas,

Thanks very much for providing the help.
Currently the middleware classes are configured like this:

MIDDLEWARE_CLASSES = (
   
'django.middleware.common.CommonMiddleware',
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.contrib.auth.middleware.AuthenticationMiddleware',
   
'django.contrib.sessions.middleware.SessionMiddleware',
   
'django.middleware.locale.LocaleMiddleware',
   
'django.contrib.messages.middleware.MessageMiddleware',
)

 I guess the order of these middleware is not correct because LocaleMiddleware should come before CommonMiddleware.

I have LANGUAGES defined in settings.py like this:
from django.utils.translation import ugettext_lazy as _

...
LANGUAGES
= (
 
('zh', _('Chinese')),
 
('en', _('English')),
)
And I don't have django.template.context_processors.i18n defined for TEMPLATE_CONTEXT_PROCESSORS in settings.py. Do I need to add this i18n context processor to settings.py?

Br
Sean

On Friday, October 30, 2015 at 6:07:21 PM UTC+8, Andréas Kühne wrote:
Hi,

Have you made sure that you have activated the languages you want in your application? 
Also, how is the current language being selected?

Regards,

Andréas

2015-10-30 7:45 GMT+01:00 Sean Xu <seanx...@gmail.com>:
Hi,

I'm learning Django Translation using django-swingtime with Django 1.7.9 installed.
I followed the official docs and embedded my string to translate with <title>{% trans "String to translate" %}</title> in my Template and managed to create both the po and mo files successfully.
But, the page is still shown up in English.
Note: the translation works just fine for my models.

Partly of the template I was using can be found from below:
{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% block title %}Event Occurrence{% endblock %}
{% block main_content %}
     
<h3>{% trans "Swingtime Event Occurrence" %}</h3>
     
<h4>
         
<a href="{{ occurrence.event.get_absolute_url }}">{{ occurrence.title }}</a>
         
&ndash;
         
{% with occurrence.start_time as st  %}
         
<a href="{% url 'swingtime-daily-view' st.year st.month st.day %}">
           
{{ st|date:"l, F jS P" }}</a>
       
</h4>
        {% endwith %}
     <dl>
         <dt>{% trans "Event type:" %}</
dt>
         
<dd>{{ occurrence.event.event_type }}</dd>

The subroutine to render my Template is:
#-------------------------------------------------------------------------------
def occurrence_view(
    request
,
    event_pk
,
    pk
,
   
template='swingtime/occurrence_detail.html',
    form_class
=forms.SingleOccurrenceForm
):
   
'''
    View a specific occurrence and optionally handle any updates.
   
    Context parameters:
   
    ``occurrence``
        the occurrence object keyed by ``pk``


    ``form``
        a form object for updating the occurrence
    '''

 
    occurrence
= get_object_or_404(Occurrence, pk=pk, event__pk=event_pk)
   
if request.method == 'POST':
        form
= form_class(request.POST, instance=occurrence)
       
if form.is_valid():
            form
.save()
           
return http.HttpResponseRedirect(request.path)
   
else:  
        form
= form_class(instance=occurrence)
       
   
return render(request, template, {'occurrence': occurrence, 'form': form})

And the url configuration associated with the Template reads:
    url(
        r
'^events/(\d+)/(\d+)/$',
        views
.occurrence_view,
        name
='swingtime-occurrence'
   
),

Could some one help me solve this problem?
Thanks very much

Br
Sean

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a45afc10-97ad-4574-b541-14ff67e892cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4c2d6bbe-c586-410c-8c61-338ecc01caf1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALXYUbk%3DT_izaRHvvPkxp8UUMN%2BLrLBz8n73s4i6GH4XaOJcig%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Translation is not working on ModelForm when widget is specified for form field

okkk now i dont hv time whenever i get ill let u know


On 30 October 2015 at 17:20, Sean Xu <seanxu1984@gmail.com> wrote:
Hi Andréas,

I have now applied your second approach and now the field names get translated into Chinese as expected...
Thanks so much.

On Friday, October 30, 2015 at 6:12:21 PM UTC+8, Andréas Kühne wrote:
Hi,

The problem is that you are redifining the fields, the fields then don't get any labels (because you haven't specified them). You can achieve what you want in two ways:

Either add the following to your modelform:
start_time = forms.DateTimeField(label=_("start time"), widget=SplitDateTimeWidget)
end_time = forms.DateTimeField(label=_("end time"), widget=SplitDateTimeWidget)

But I would much rather remove the start_time / end_time definitions in your model form and instead add this under the "class Meta:" heading:
widgets = {
    'start_time': SplitDateTimeWidget,
    'end_time': SplitDateTimeWidget,
}

That way you don't have to add the labels once more, but just use them from the model instead.

Regards,

Andréas

2015-10-30 7:21 GMT+01:00 Sean Xu <seanx...@gmail.com>:
Hi,

I was learning Django Translation using django-swingtime as project with Django 1.7.9 installed.
And I found out when Non-default widgets was originally specified for form fields, the preferred language did not show up from my Firefox browser.
The problem has gone when these widgets were removed.
I'm not sure if this is a bug of Django or was there anything I did wrong.

Note: po and mo file can be created correctly with or without the widgets in place.

You can find the Model definition from below:
class Occurrence(models.Model):
   
'''
    Represents the start end time for a specific occurrence of a master ``Event``
    object.
    '''

    start_time
= models.DateTimeField(_('start time'))
    end_time
= models.DateTimeField(_('end time'))
   
event = models.ForeignKey(Event, verbose_name=_('event'), editable=False)
    notes
= GenericRelation(Note, verbose_name=_('notes'))


    objects
= OccurrenceManager()


   
#===========================================================================
   
class Meta:
        verbose_name
= _('occurrence')
        verbose_name_plural
= _('occurrences')
        ordering
= ('start_time', 'end_time')


And the ModelForm is defined as follows:
class SingleOccurrenceForm(forms.ModelForm):
   
'''
    A simple form for adding and updating single Occurrence attributes


    '''



    start_time
= forms.DateTimeField(widget=SplitDateTimeWidget)
    end_time
= forms.DateTimeField(widget=SplitDateTimeWidget)
   
# Translation works if these 2 lines get removed


   
#===========================================================================
   
class Meta:
        model
= Occurrence
       
if FIELDS_REQUIRED:
            fields
= "__all__"


Br
Sean

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/52a50110-4c9d-4f71-9ebf-6ade058fa47e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d350c903-7285-4932-8c9f-0c5c1a4407f4%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADQRGB4zt1rgjjiv1tJ8xoF20A%2BKs5YWuafBzCOOevgb7U2sCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.