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+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/52a50110-4c9d-4f71-9ebf-6ade058fa47e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment