Re: Translation doesn't work?

2019-03-21 Thread ANi
That's right, nothing changed.



Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時49分29秒寫道:
>
> Even after you rerun these commands?
>
> python manage.py makemessages -l zh_Hant
>
> python manage.py compilemessages
>
>
> On Fri, Mar 22, 2019 at 11:41 AM ANi > 
> wrote:
>
>> Oh yes, thank you, Aldian.
>> But it doesn't work, either. :-\
>>
>>
>> Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道:
>>>
>>> Hi ANi,
>>>
>>> I think the settings should you lower case letter like this:
>>>
>>> LANGUAGE = [
>>>  ('en-us', 'English'), 
>>>  ('zh-hant','繁體中文'), 
>>> ]
>>>
>>> LANGUAGE_CODE = 'zh-hant'
>>>
>>> And the locale folder should use underscore instead of dash, and use 
>>> uppercase 'H', like this:
>>> - locale
>>>  - zh_Hant
>>>
>>> Regards,
>>>
>>> Aldian Fazrihady
>>> https://www.aldianfazrihady.com/
>>>
>>> On Fri, Mar 22, 2019 at 11:12 AM ANi  wrote:
>>>
 Hello.
 The only word that has been translated is "name", but it seems that it 
 is the default one in Django.
 So basically my translation does not work at all..
 please help 

 Here is what I've done so far...

 settings.py
 MIDDLEWARE = [
  ...
  'django.contrib.sessions.middleware.SessionMiddleware',
  'django.middleware.locale.LocaleMiddleware',
  ...
 ]


 LANGUAGE = [
  ('en-us', 'English'), 
  ('zh-Hant','繁體中文'), 
 ]


 LANGUAGE_CODE = 'zh-Hant'


 USE_I18N = True

 USE_L10N = True

 ...


 LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")


 part of django.po

 #: .\main\models\center.py:43 .\main\models\company.py:18
 #: .\main\models\company.py:33 .\main\models\log.py:70
 #: .\main\models\select.py:17 .\main\models\select.py:33
 #: .\main\models\item.py:95 .\templates\main\main.html:11
 msgid "name"
 msgstr "名稱"


 #: .\main\models\item.py:98 .\templates\main\main.html:13
 msgid "value"
 msgstr "價值"


 #: .\main\models\item.py:102 .\main\models\log.py:98
 msgid "currency"
 msgstr "幣別"



 part of main.html
 {% load static %}
 {% load filters %}
 {% load i18n %}
 {% block container %}
  
  
  
  {% trans 'name' %}
  {% tans 'value' %}>>> >
  ...


 part of item.py
 from django.utils.translation import gettext_lazy as _
 ...

 class Asset(models.Model):
  name = models.CharField(_('name'), max_length=255)
  value = models.IntegerField(_('value'))
  currency = models.ForeignKey(Currency,
   null=True,
   on_delete=models.SET_NULL,
verbose_name=_('currency'))
  ...

 filte structure
 myproject
  - main_app
  - common-statics
  - templates
  - myproject
  - locale
  - zh-hant
-LC_MESSAGES
  - django.mo
  - django.po


 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...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/fe9682be-358a-433b-af3a-ba8e6e3afd12%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To 

initial data inlineAdmin

2019-03-21 Thread carlos
Hi, what is the best way fill all extra data inline, my code is

model.py
ModelA(models.Model):
   name = charfield(...)

CHOICE_OPTION = ((1,'One'),(2,'Two'),(3, 'Three')

ModelB(models.Model):
fk(ModelA)
option = integerfield(choice=CHOICE_OPTION)
field1 = boolfield()
field2 = boolfield()
field3 = boolfield()


forms.py
class ModelBInlineAdminForm(forms.ModelForm):
class Meta:
model = ModelB
fields = '__all__'

def __init__(self, *args, **kwargs):
super(ModelBInlineAdminForm, self).__init__(*args, **kwargs)
self.initial = {
'option': 1,
'option': 2,
'option': 3,
}

admin.py
class InlineModelB(admin.TabularInline):
form = ModelBInlineAdminForm
model = ModelB
extra = 3
max_num = 3

class ModelAAdmin(admin.ModelAdmin):
inlines = [InlineModelB]

but the result is not as expected, I repeat only the last option,
i need One, Two, Three

my inline look like this

option | field1 | field2 | field3
Three |   []  |  []   |  []
Three |   []  |  []   |  []
Three |   []  |  []   |  []

i use django 1.11.18, python3.6
What is the best way to do this, some link to read to guide me in the right
way

Cheers
-- 
att.
Carlos Rocha

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


Re: Translation doesn't work?

2019-03-21 Thread Aldian Fazrihady
Even after you rerun these commands?

python manage.py makemessages -l zh_Hant

python manage.py compilemessages


On Fri, Mar 22, 2019 at 11:41 AM ANi  wrote:

> Oh yes, thank you, Aldian.
> But it doesn't work, either. :-\
>
>
> Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道:
>>
>> Hi ANi,
>>
>> I think the settings should you lower case letter like this:
>>
>> LANGUAGE = [
>>  ('en-us', 'English'),
>>  ('zh-hant','繁體中文'),
>> ]
>>
>> LANGUAGE_CODE = 'zh-hant'
>>
>> And the locale folder should use underscore instead of dash, and use
>> uppercase 'H', like this:
>> - locale
>>  - zh_Hant
>>
>> Regards,
>>
>> Aldian Fazrihady
>> https://www.aldianfazrihady.com/
>>
>> On Fri, Mar 22, 2019 at 11:12 AM ANi  wrote:
>>
>>> Hello.
>>> The only word that has been translated is "name", but it seems that it
>>> is the default one in Django.
>>> So basically my translation does not work at all..
>>> please help
>>>
>>> Here is what I've done so far...
>>>
>>> settings.py
>>> MIDDLEWARE = [
>>>  ...
>>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>>  'django.middleware.locale.LocaleMiddleware',
>>>  ...
>>> ]
>>>
>>>
>>> LANGUAGE = [
>>>  ('en-us', 'English'),
>>>  ('zh-Hant','繁體中文'),
>>> ]
>>>
>>>
>>> LANGUAGE_CODE = 'zh-Hant'
>>>
>>>
>>> USE_I18N = True
>>>
>>> USE_L10N = True
>>>
>>> ...
>>>
>>>
>>> LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")
>>>
>>>
>>> part of django.po
>>>
>>> #: .\main\models\center.py:43 .\main\models\company.py:18
>>> #: .\main\models\company.py:33 .\main\models\log.py:70
>>> #: .\main\models\select.py:17 .\main\models\select.py:33
>>> #: .\main\models\item.py:95 .\templates\main\main.html:11
>>> msgid "name"
>>> msgstr "名稱"
>>>
>>>
>>> #: .\main\models\item.py:98 .\templates\main\main.html:13
>>> msgid "value"
>>> msgstr "價值"
>>>
>>>
>>> #: .\main\models\item.py:102 .\main\models\log.py:98
>>> msgid "currency"
>>> msgstr "幣別"
>>>
>>>
>>>
>>> part of main.html
>>> {% load static %}
>>> {% load filters %}
>>> {% load i18n %}
>>> {% block container %}
>>>  
>>>  
>>>  
>>>  {% trans 'name' %}
>>>  {% tans 'value' %}
>>>  ...
>>>
>>>
>>> part of item.py
>>> from django.utils.translation import gettext_lazy as _
>>> ...
>>>
>>> class Asset(models.Model):
>>>  name = models.CharField(_('name'), max_length=255)
>>>  value = models.IntegerField(_('value'))
>>>  currency = models.ForeignKey(Currency,
>>>   null=True,
>>>   on_delete=models.SET_NULL,
>>>verbose_name=_('currency'))
>>>  ...
>>>
>>> filte structure
>>> myproject
>>>  - main_app
>>>  - common-statics
>>>  - templates
>>>  - myproject
>>>  - locale
>>>  - zh-hant
>>>-LC_MESSAGES
>>>  - django.mo
>>>  - django.po
>>>
>>>
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/fe9682be-358a-433b-af3a-ba8e6e3afd12%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAbzZap_1iq-GtRL3BPdqgvMTWu175He%2BPA4r4zDiZ3RBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Translation doesn't work?

2019-03-21 Thread ANi
Oh yes, thank you, Aldian.
But it doesn't work, either. :-\


Aldian Fazrihady於 2019年3月22日星期五 UTC+8上午11時20分54秒寫道:
>
> Hi ANi,
>
> I think the settings should you lower case letter like this:
>
> LANGUAGE = [
>  ('en-us', 'English'), 
>  ('zh-hant','繁體中文'), 
> ]
>
> LANGUAGE_CODE = 'zh-hant'
>
> And the locale folder should use underscore instead of dash, and use 
> uppercase 'H', like this:
> - locale
>  - zh_Hant
>
> Regards,
>
> Aldian Fazrihady
> https://www.aldianfazrihady.com/
>
> On Fri, Mar 22, 2019 at 11:12 AM ANi > 
> wrote:
>
>> Hello.
>> The only word that has been translated is "name", but it seems that it is 
>> the default one in Django.
>> So basically my translation does not work at all..
>> please help 
>>
>> Here is what I've done so far...
>>
>> settings.py
>> MIDDLEWARE = [
>>  ...
>>  'django.contrib.sessions.middleware.SessionMiddleware',
>>  'django.middleware.locale.LocaleMiddleware',
>>  ...
>> ]
>>
>>
>> LANGUAGE = [
>>  ('en-us', 'English'), 
>>  ('zh-Hant','繁體中文'), 
>> ]
>>
>>
>> LANGUAGE_CODE = 'zh-Hant'
>>
>>
>> USE_I18N = True
>>
>> USE_L10N = True
>>
>> ...
>>
>>
>> LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")
>>
>>
>> part of django.po
>>
>> #: .\main\models\center.py:43 .\main\models\company.py:18
>> #: .\main\models\company.py:33 .\main\models\log.py:70
>> #: .\main\models\select.py:17 .\main\models\select.py:33
>> #: .\main\models\item.py:95 .\templates\main\main.html:11
>> msgid "name"
>> msgstr "名稱"
>>
>>
>> #: .\main\models\item.py:98 .\templates\main\main.html:13
>> msgid "value"
>> msgstr "價值"
>>
>>
>> #: .\main\models\item.py:102 .\main\models\log.py:98
>> msgid "currency"
>> msgstr "幣別"
>>
>>
>>
>> part of main.html
>> {% load static %}
>> {% load filters %}
>> {% load i18n %}
>> {% block container %}
>>  
>>  
>>  
>>  {% trans 'name' %}
>>  {% tans 'value' %}
>>  ...
>>
>>
>> part of item.py
>> from django.utils.translation import gettext_lazy as _
>> ...
>>
>> class Asset(models.Model):
>>  name = models.CharField(_('name'), max_length=255)
>>  value = models.IntegerField(_('value'))
>>  currency = models.ForeignKey(Currency,
>>   null=True,
>>   on_delete=models.SET_NULL,
>>verbose_name=_('currency'))
>>  ...
>>
>> filte structure
>> myproject
>>  - main_app
>>  - common-statics
>>  - templates
>>  - myproject
>>  - locale
>>  - zh-hant
>>-LC_MESSAGES
>>  - django.mo
>>  - django.po
>>
>>
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe9682be-358a-433b-af3a-ba8e6e3afd12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Translation doesn't work?

2019-03-21 Thread Aldian Fazrihady
Hi ANi,

I think the settings should you lower case letter like this:

LANGUAGE = [
 ('en-us', 'English'),
 ('zh-hant','繁體中文'),
]

LANGUAGE_CODE = 'zh-hant'

And the locale folder should use underscore instead of dash, and use
uppercase 'H', like this:
- locale
 - zh_Hant

Regards,

Aldian Fazrihady
https://www.aldianfazrihady.com/

On Fri, Mar 22, 2019 at 11:12 AM ANi  wrote:

> Hello.
> The only word that has been translated is "name", but it seems that it is
> the default one in Django.
> So basically my translation does not work at all..
> please help
>
> Here is what I've done so far...
>
> settings.py
> MIDDLEWARE = [
>  ...
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.middleware.locale.LocaleMiddleware',
>  ...
> ]
>
>
> LANGUAGE = [
>  ('en-us', 'English'),
>  ('zh-Hant','繁體中文'),
> ]
>
>
> LANGUAGE_CODE = 'zh-Hant'
>
>
> USE_I18N = True
>
> USE_L10N = True
>
> ...
>
>
> LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")
>
>
> part of django.po
>
> #: .\main\models\center.py:43 .\main\models\company.py:18
> #: .\main\models\company.py:33 .\main\models\log.py:70
> #: .\main\models\select.py:17 .\main\models\select.py:33
> #: .\main\models\item.py:95 .\templates\main\main.html:11
> msgid "name"
> msgstr "名稱"
>
>
> #: .\main\models\item.py:98 .\templates\main\main.html:13
> msgid "value"
> msgstr "價值"
>
>
> #: .\main\models\item.py:102 .\main\models\log.py:98
> msgid "currency"
> msgstr "幣別"
>
>
>
> part of main.html
> {% load static %}
> {% load filters %}
> {% load i18n %}
> {% block container %}
>  
>  
>  
>  {% trans 'name' %}
>  {% tans 'value' %}
>  ...
>
>
> part of item.py
> from django.utils.translation import gettext_lazy as _
> ...
>
> class Asset(models.Model):
>  name = models.CharField(_('name'), max_length=255)
>  value = models.IntegerField(_('value'))
>  currency = models.ForeignKey(Currency,
>   null=True,
>   on_delete=models.SET_NULL,
>verbose_name=_('currency'))
>  ...
>
> filte structure
> myproject
>  - main_app
>  - common-statics
>  - templates
>  - myproject
>  - locale
>  - zh-hant
>-LC_MESSAGES
>  - django.mo
>  - django.po
>
>
> thanks!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7EoAa01KFiOh5wV2xyDFKSSFV%2BYD7maxmwhbA5VdJGW6p0sw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Translation doesn't work?

2019-03-21 Thread ANi
Hello.
The only word that has been translated is "name", but it seems that it is 
the default one in Django.
So basically my translation does not work at all..
please help 

Here is what I've done so far...

settings.py
MIDDLEWARE = [
 ...
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 ...
]


LANGUAGE = [
 ('en-us', 'English'), 
 ('zh-Hant','繁體中文'), 
]


LANGUAGE_CODE = 'zh-Hant'


USE_I18N = True

USE_L10N = True

...


LANGUAGE_PATHS = os.path.join(BASE_DIR, "locale")


part of django.po

#: .\main\models\center.py:43 .\main\models\company.py:18
#: .\main\models\company.py:33 .\main\models\log.py:70
#: .\main\models\select.py:17 .\main\models\select.py:33
#: .\main\models\item.py:95 .\templates\main\main.html:11
msgid "name"
msgstr "名稱"


#: .\main\models\item.py:98 .\templates\main\main.html:13
msgid "value"
msgstr "價值"


#: .\main\models\item.py:102 .\main\models\log.py:98
msgid "currency"
msgstr "幣別"



part of main.html
{% load static %}
{% load filters %}
{% load i18n %}
{% block container %}
 
 
 
 {% trans 'name' %}
 {% tans 'value' %}
 ...


part of item.py
from django.utils.translation import gettext_lazy as _
...

class Asset(models.Model):
 name = models.CharField(_('name'), max_length=255)
 value = models.IntegerField(_('value'))
 currency = models.ForeignKey(Currency,
  null=True,
  on_delete=models.SET_NULL,
   verbose_name=_('currency'))
 ...

filte structure
myproject
 - main_app
 - common-statics
 - templates
 - myproject
 - locale
 - zh-hant
   -LC_MESSAGES
 - django.mo
 - django.po


thanks!


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d981053e-29d9-4d6b-943f-04d04b735cf9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problema con dos formularios en una plantilla. Error " Generic detail view addAutorXlibro must be called with either an object pk or a slug in the URLconf."

2019-03-21 Thread Diego Puerta
Para comentarles mi problema los contextualizo:
Es un ejercicio de prática.
Django 2.1.5; PyCharms

Tengo dos modelos relacionados, la idea es poder ingresar datos desde un 
mismo formulario a los dos modelos, para eso tengo lo siquiente:

*Modelos:*

class Autor(models.Model):

nombre = models.CharField('Nombres', max_length=80)
nacionalidad = models.CharField('Nacionalidad', max_length=80)
edad = models.IntegerField('Edad')

def __str__(self):

return self.nombre


class Libros(models.Model):

title = models.CharField('Título', blank=False, max_length=150)
resume = models.TextField('Resumen', blank=True)
autor = models.ForeignKey(Autor, on_delete=models.CASCADE)
idioma = models.ForeignKey(Idioma, on_delete=models.CASCADE)

def __str__(self):
return self.title


*Formularios*

class forLibros(forms.ModelForm):

class Meta:

model = Libros
#falta poner el campo autor para que funcione bien el formulario
fields = [
'title', 'resume', 'idioma',
]

labels = {
'title': 'Título', 'resume': 'Resumen', 'idioma': 'Idioma',
}

widgets = {
'title': forms.TextInput(attrs={'class': 'form-control'}),
'resume': forms.TextInput(attrs={'class': 'form-control'}),
'idioma': forms.Select(attrs={'class': 'form-control'}),
}


class forAutor(forms.ModelForm):

class Meta:
model = Autor
fields = ['nombre', 'nacionalidad', 'edad']
labels = {'Nombre': 'nombre', 'Nacionalidad': 'nacionalidad', 'Edad': 
'edad'}
widgets = {
'nombre': forms.TextInput(attrs={'class': 'form-control'}),
'nacionalidad': forms.TextInput(attrs={'class': 'form-control'}),
'edad': forms.NumberInput(attrs={'class': 'form-control'}),
}


*Vista*

class addAutorXlibro(CreateView):


model = Libros
template_name = 'biblioteca/add-libros-autor.html'
form_class = forLibros
second_for_class = forAutor
success_url = reverse_lazy('inicio_app:index')

def get_context_data(self, **kwargs):
context = super(addAutorXlibro, self).get_context_data(**kwargs)
if 'form' not in context:
context['form'] = self.form_class(self.request.GET)
if 'form2' not in context:
context['form2'] = self.second_for_class(self.request.GET)
return context

def post(self, request, *args, **kwargs):
self.object = self.get_object()
form = self.form_class(request.POST)
form2 = self.second_for_class(request.POST)
if form.is_valid() and form2.is_valid():
libro = form.save(commit=False)
libro.autor = form2.save()
libro.save()
return HttpResponseRedirect(self.get_success_url())
else:
return self.render_to_response(self.get_context_data(form=form, 
form2=form))



*Plantilla*

{% block contenido %}
 {% csrf_token %}
{{ form2.as_p }}
---
{{ form.as_p }}
Guardar

{% endblock %}


*url*

path('add-libros-autor', views.addAutorXlibro.as_view(), 
name="add-libros-autor"),


El formulario se pinta bien, pero cuando ingreso los datos y doy clic en 
guardar me sale este error:

AttributeError at /add-libros-autor

Generic detail view addAutorXlibro must be called with either an object pk or a 
slug in the URLconf.


Me está pidiendo un parámetro en la url. Si por ejemplo le paso un /1 , 
todo me funciona bien. Lo que quiero saber, es porqué siempre me pide ese 
parámetro o si hay una forma de que el formulario funcione sin tener que 
poder ese /1.

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


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
Thanks Simon. That's exactly what I'm looking for. Wish they had piggy
backed in the established F pattern though.  It's quite verbose just to
access the field on either model.

r_id would just be a pk, usually from a fk on another model that I do need
to fetch.


Best,

Casey




Le jeu. 21 mars 2019 5:07 p.m., Simon Charette  a
écrit :

> I'm not sure where r_id comes from but Model.save usually deals with any
> expression correctly
> so you could try using a subquery assignment and see if it works.
>
> e.g.
>
> entry = Entry.objects.create(
> start=Subquery(
> Recurrence.objects.filter(pk=r_id).values('start_time')[:1]
> )
> )
>
> Note that accessing entry.start right after creation might still return
> the Subquery instance
> instead of the created value. This is caused by some backends not
> supporting the
> RETURNING clause. There's an open ticket about making such attributes
> available
> immediately on backend supporting RETURNING but it was still missing
> consensus about
> what to do on other backends. If I remember correctly the two alternatives
> were to defer the
> field or perform an immediate SELECT.
>
> Cheers,
> Simon
>
> Le jeudi 21 mars 2019 13:06:04 UTC-4, Dylan Young a écrit :
>>
>> For example using made-up syntax:
>>
>> Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id),
>> 'start_time'))
>>
>> Note that we can't use `get` since the whole point is to avoid all the
>> useless round-trips to the DB.
>>
>> Best,
>>
>> Casey
>>
>> On Thu, 21 Mar 2019 at 13:18, Dylan Young  wrote:
>>
>>> It's not a recalculation. It's instantiation.
>>>
>>> Instance data diverges from the factory data and needs to be
>>> independently editable.
>>>
>>> Best,
>>>
>>> Casey
>>>
>>> Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :
>>>
 Permanently storing data that can be recalculated from existing data is
 a practice specific to the needs of particular applications.

 Have you perhaps considered making use of the "view" table
 functionality available in most databases?

 For example, in PostgreSQL you can create a materialized view which
 "caches the result of a complex expensive query and then allow you to
 refresh this result periodically." - see
 http://www.postgresqltutorial.com/postgresql-materialized-views/


 On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:
>
> Hey all:
>
> I often find myself fetching data from models in the database only to
> run a few trivial calculations and store the info in a different model.
>
> Is there an established ORM pattern for directly creating objects in
> the DB based on the fields of other models?
>
> Sorry if this is obvious, but I couldn't find much on this in my web
> searching.
>
>
> Best,
>
> Casey
>
 --
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7b954a7d-e893-4459-8d75-e7cc1a411e1f%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPGJNu5OE2LddpZ7fnp6mg8vUT-8s%2BwYWMVUKQUFMyNmxQb82g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
It's perfectly clear and precisely what an ORM is for.

If you don't have an answer, just say so, though I suspect the answer is
use SubQuery.

It is not "useless" in general (obviously if you want to display/ deliver
to an end user,  you need to pluck from the database).  It is useless in
the case I am asking about.



Le jeu. 21 mars 2019 3:22 p.m., Derek  a écrit :

> Your use case is not very clear.
>
> If you are simply "running a few trivial calculations and storing the
> info" then you could use a function in the database to do this for you -
> pulling data directly from Table A and storing the result in Table B. Data
> in Table B could then be later edited using the usual Django functionality.
>
> As a  side note: a trip to the database to get data is not "useless" if
> you need that data for some reason and it is not already present in your
> app.
>
> On Thu, 21 Mar 2019 at 19:06, Dylan Young 
> wrote:
>
>> For example using made-up syntax:
>>
>> Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id),
>> 'start_time'))
>>
>> Note that we can't use `get` since the whole point is to avoid all the
>> useless round-trips to the DB.
>>
>> Best,
>>
>> Casey
>>
>> On Thu, 21 Mar 2019 at 13:18, Dylan Young 
>> wrote:
>>
>>> It's not a recalculation. It's instantiation.
>>>
>>> Instance data diverges from the factory data and needs to be
>>> independently editable.
>>>
>>> Best,
>>>
>>> Casey
>>>
>>> Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :
>>>
 Permanently storing data that can be recalculated from existing data is
 a practice specific to the needs of particular applications.

 Have you perhaps considered making use of the "view" table
 functionality available in most databases?

 For example, in PostgreSQL you can create a materialized view which
 "caches the result of a complex expensive query and then allow you to
 refresh this result periodically." - see
 http://www.postgresqltutorial.com/postgresql-materialized-views/


 On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:
>
> Hey all:
>
> I often find myself fetching data from models in the database only to
> run a few trivial calculations and store the info in a different model.
>
> Is there an established ORM pattern for directly creating objects in
> the DB based on the fields of other models?
>
> Sorry if this is obvious, but I couldn't find much on this in my web
> searching.
>
>
> Best,
>
> Casey
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/RDU_KsRqd90/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPGJNu40H%3Du5bLLUYYosHpKNDsH7xMFPg-7GU%2B_fHCV59SknyA%40mail.gmail.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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF1Wu3NkZCsU8oxLnuGPBtkWpPnq_L_H-o2dVb1rMUjm0pdW3A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you 

Re: 404 error while loading uploaded image when debug is False

2019-03-21 Thread Mohammad Etemaddar
In production , we serve static files (like images) stright from httpd like
apache, and we do not call django to serve them.
But in testing while run django test server, we use static paths in urls.py
to serve them,

Maybe you have added mediaurls to your urlpatterns in urls.py conditionally
(when settings.debug == True) so they are not added when debug is False.

On Thu, 21 Mar 2019 21:35 mayank dubey,  wrote:

> Hii there,
>
> I am not able to load images which have been uploaded through the admin
> portal on my Django site if I set debug = false. While when debug = true,
> images are easily loaded. I am not able to understand what is the problem,
> please help me out.
>
> Thank you,
> M
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMJ6Xs6qROL597vvX53%3DSpLqagovcMcz_wROFp828zm%3DrYE8DA%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALJt1nsRuK1yeyxsdoB6p50eOjz6-JCLkzY%3D%3Dz5Cy8eudiwzrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Simon Charette
I'm not sure where r_id comes from but Model.save usually deals with any 
expression correctly
so you could try using a subquery assignment and see if it works.

e.g.

entry = Entry.objects.create(
start=Subquery(
Recurrence.objects.filter(pk=r_id).values('start_time')[:1]
)
)

Note that accessing entry.start right after creation might still return the 
Subquery instance
instead of the created value. This is caused by some backends not 
supporting the
RETURNING clause. There's an open ticket about making such attributes 
available
immediately on backend supporting RETURNING but it was still missing 
consensus about
what to do on other backends. If I remember correctly the two alternatives 
were to defer the
field or perform an immediate SELECT.

Cheers,
Simon

Le jeudi 21 mars 2019 13:06:04 UTC-4, Dylan Young a écrit :
>
> For example using made-up syntax:
>
> Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id), 
> 'start_time'))
>
> Note that we can't use `get` since the whole point is to avoid all the 
> useless round-trips to the DB.
>
> Best,
>
> Casey
>
> On Thu, 21 Mar 2019 at 13:18, Dylan Young  > wrote:
>
>> It's not a recalculation. It's instantiation.
>>
>> Instance data diverges from the factory data and needs to be 
>> independently editable. 
>>
>> Best, 
>>
>> Casey
>>
>> Le jeu. 21 mars 2019 2:52 a.m., Derek > 
>> a écrit :
>>
>>> Permanently storing data that can be recalculated from existing data is 
>>> a practice specific to the needs of particular applications.  
>>>
>>> Have you perhaps considered making use of the "view" table functionality 
>>> available in most databases?
>>>
>>> For example, in PostgreSQL you can create a materialized view which 
>>> "caches the result of a complex expensive query and then allow you to 
>>> refresh this result periodically." - see 
>>> http://www.postgresqltutorial.com/postgresql-materialized-views/
>>>
>>>
>>> On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:

 Hey all:

 I often find myself fetching data from models in the database only to 
 run a few trivial calculations and store the info in a different model.

 Is there an established ORM pattern for directly creating objects in 
 the DB based on the fields of other models?

 Sorry if this is obvious, but I couldn't find much on this in my web 
 searching. 


 Best,

 Casey 

>>> -- 
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7b954a7d-e893-4459-8d75-e7cc1a411e1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Chasan KIOUTSOUK MOUSTAFA
You can override the save method or simply use Django signals
 to modify fields of
Model automatically.

On Thu, Mar 21, 2019 at 8:21 PM Derek  wrote:

> Your use case is not very clear.
>
> If you are simply "running a few trivial calculations and storing the
> info" then you could use a function in the database to do this for you -
> pulling data directly from Table A and storing the result in Table B. Data
> in Table B could then be later edited using the usual Django functionality.
>
> As a  side note: a trip to the database to get data is not "useless" if
> you need that data for some reason and it is not already present in your
> app.
>
> On Thu, 21 Mar 2019 at 19:06, Dylan Young 
> wrote:
>
>> For example using made-up syntax:
>>
>> Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id),
>> 'start_time'))
>>
>> Note that we can't use `get` since the whole point is to avoid all the
>> useless round-trips to the DB.
>>
>> Best,
>>
>> Casey
>>
>> On Thu, 21 Mar 2019 at 13:18, Dylan Young 
>> wrote:
>>
>>> It's not a recalculation. It's instantiation.
>>>
>>> Instance data diverges from the factory data and needs to be
>>> independently editable.
>>>
>>> Best,
>>>
>>> Casey
>>>
>>> Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :
>>>
 Permanently storing data that can be recalculated from existing data is
 a practice specific to the needs of particular applications.

 Have you perhaps considered making use of the "view" table
 functionality available in most databases?

 For example, in PostgreSQL you can create a materialized view which
 "caches the result of a complex expensive query and then allow you to
 refresh this result periodically." - see
 http://www.postgresqltutorial.com/postgresql-materialized-views/


 On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:
>
> Hey all:
>
> I often find myself fetching data from models in the database only to
> run a few trivial calculations and store the info in a different model.
>
> Is there an established ORM pattern for directly creating objects in
> the DB based on the fields of other models?
>
> Sorry if this is obvious, but I couldn't find much on this in my web
> searching.
>
>
> Best,
>
> Casey
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To post to this group, send email to django-users@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%40googlegroups.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/RDU_KsRqd90/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPGJNu40H%3Du5bLLUYYosHpKNDsH7xMFPg-7GU%2B_fHCV59SknyA%40mail.gmail.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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAF1Wu3NkZCsU8oxLnuGPBtkWpPnq_L_H-o2dVb1rMUjm0pdW3A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Kind Regards.
--
Chasan KIOUTSOUK MOUSTAFA,
Freelance Software Engineer
www.chasank.com
--

-- 
You 

Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Derek
Your use case is not very clear.

If you are simply "running a few trivial calculations and storing the
info" then
you could use a function in the database to do this for you - pulling data
directly from Table A and storing the result in Table B. Data in Table B
could then be later edited using the usual Django functionality.

As a  side note: a trip to the database to get data is not "useless" if you
need that data for some reason and it is not already present in your app.

On Thu, 21 Mar 2019 at 19:06, Dylan Young 
wrote:

> For example using made-up syntax:
>
> Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id),
> 'start_time'))
>
> Note that we can't use `get` since the whole point is to avoid all the
> useless round-trips to the DB.
>
> Best,
>
> Casey
>
> On Thu, 21 Mar 2019 at 13:18, Dylan Young 
> wrote:
>
>> It's not a recalculation. It's instantiation.
>>
>> Instance data diverges from the factory data and needs to be
>> independently editable.
>>
>> Best,
>>
>> Casey
>>
>> Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :
>>
>>> Permanently storing data that can be recalculated from existing data is
>>> a practice specific to the needs of particular applications.
>>>
>>> Have you perhaps considered making use of the "view" table functionality
>>> available in most databases?
>>>
>>> For example, in PostgreSQL you can create a materialized view which
>>> "caches the result of a complex expensive query and then allow you to
>>> refresh this result periodically." - see
>>> http://www.postgresqltutorial.com/postgresql-materialized-views/
>>>
>>>
>>> On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:

 Hey all:

 I often find myself fetching data from models in the database only to
 run a few trivial calculations and store the info in a different model.

 Is there an established ORM pattern for directly creating objects in
 the DB based on the fields of other models?

 Sorry if this is obvious, but I couldn't find much on this in my web
 searching.


 Best,

 Casey

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/RDU_KsRqd90/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPGJNu40H%3Du5bLLUYYosHpKNDsH7xMFPg-7GU%2B_fHCV59SknyA%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAF1Wu3NkZCsU8oxLnuGPBtkWpPnq_L_H-o2dVb1rMUjm0pdW3A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


404 error while loading uploaded image when debug is False

2019-03-21 Thread mayank dubey
Hii there,

I am not able to load images which have been uploaded through the admin
portal on my Django site if I set debug = false. While when debug = true,
images are easily loaded. I am not able to understand what is the problem,
please help me out.

Thank you,
M

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


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
For example using made-up syntax:

Entry.objects.create(start=F(Recurrence.objects.filter(pk=r_id),
'start_time'))

Note that we can't use `get` since the whole point is to avoid all the
useless round-trips to the DB.

Best,

Casey

On Thu, 21 Mar 2019 at 13:18, Dylan Young 
wrote:

> It's not a recalculation. It's instantiation.
>
> Instance data diverges from the factory data and needs to be independently
> editable.
>
> Best,
>
> Casey
>
> Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :
>
>> Permanently storing data that can be recalculated from existing data is a
>> practice specific to the needs of particular applications.
>>
>> Have you perhaps considered making use of the "view" table functionality
>> available in most databases?
>>
>> For example, in PostgreSQL you can create a materialized view which
>> "caches the result of a complex expensive query and then allow you to
>> refresh this result periodically." - see
>> http://www.postgresqltutorial.com/postgresql-materialized-views/
>>
>>
>> On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:
>>>
>>> Hey all:
>>>
>>> I often find myself fetching data from models in the database only to
>>> run a few trivial calculations and store the info in a different model.
>>>
>>> Is there an established ORM pattern for directly creating objects in the
>>> DB based on the fields of other models?
>>>
>>> Sorry if this is obvious, but I couldn't find much on this in my web
>>> searching.
>>>
>>>
>>> Best,
>>>
>>> Casey
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPGJNu40H%3Du5bLLUYYosHpKNDsH7xMFPg-7GU%2B_fHCV59SknyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Creating Objects from Annotations and Other Models

2019-03-21 Thread Dylan Young
It's not a recalculation. It's instantiation.

Instance data diverges from the factory data and needs to be independently
editable.

Best,

Casey

Le jeu. 21 mars 2019 2:52 a.m., Derek  a écrit :

> Permanently storing data that can be recalculated from existing data is a
> practice specific to the needs of particular applications.
>
> Have you perhaps considered making use of the "view" table functionality
> available in most databases?
>
> For example, in PostgreSQL you can create a materialized view which
> "caches the result of a complex expensive query and then allow you to
> refresh this result periodically." - see
> http://www.postgresqltutorial.com/postgresql-materialized-views/
>
>
> On Tuesday, 19 March 2019 17:34:11 UTC+2, Dylan Young wrote:
>>
>> Hey all:
>>
>> I often find myself fetching data from models in the database only to run
>> a few trivial calculations and store the info in a different model.
>>
>> Is there an established ORM pattern for directly creating objects in the
>> DB based on the fields of other models?
>>
>> Sorry if this is obvious, but I couldn't find much on this in my web
>> searching.
>>
>>
>> Best,
>>
>> Casey
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/a1c55adc-c5fa-465c-8740-3a741bc22686%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPGJNu7ASaV803%2B%3DLZdK4K_xw_XfyP4bATrGqhgArmH5-T%2Bg%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello From Nigeria

2019-03-21 Thread chaitanya goud
Hi i am an django developer I can join

On Mon, 11 Mar 2019, 18:46 Joshua Kayode,  wrote:

> Greetings, if you are a django developer in Nigeria, would you consider
> joining a WhatsApp group?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BkSnu5dNhWHAV8GAujgH-PWc7FxCfy7WGMtweO-T2qVRHq-BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: log out a user when user closes tab or browser

2019-03-21 Thread Marconi Moreto Jr.
How about on `window.onbeforeunload` you delete the session id from the cookie, 
on next visit no session id to send so should be considered logged-out.

On Thu, Mar 21, 2019, at 10:17 PM, KadirCEBEL wrote:
> You can use jquery. you can write a function like logout (in the view)
> after that when browser tab is closed (you have to check with jquery
> code) you can kill user session. 
> 
> Prş, 2019-03-21 tarihinde 17:15 +0330 saatinde, Mohammad Etemaddar
> yazdı:
> > I have a suggest for you. Its non standard.
> > 
> > First create a javascript infinite loop to make a get call every 1
> > minute.
> > Also make session expiration time at 2 minutes. So if tabs closed the
> > session will expire at 1 minute.
> > 
> > On Thu, 21 Mar 2019 15:17 Christian Ledermann, <
> > christian.lederm...@gmail.com> wrote:
> > > SESSION_EXPIRE_AT_BROWSER_CLOSE works for me 
> > > but only when you close the browswer, closing a tab will not log
> > > you out
> > > also it depends on the browser (firefox seemed in the past to
> > > ignore this)
> > > 
> > > On Thu, 21 Mar 2019 at 05:34, Sam W  wrote:
> > > > Is there a way in Django to  log out a user when user closes tab
> > > > or browser?
> > > > 
> > > > This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the
> > > > Google Groups "Django users" group.
> > > > To unsubscribe from this group and stop receiving emails from it,
> > > > send an email to django-users+unsubscr...@googlegroups.com.
> > > > To post to this group, send email to 
> > > > django-users@googlegroups.com.
> > > > Visit this group at https://groups.google.com/group/django-users.
> > > > To view this discussion on the web visit 
> > > > https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
> > > > .
> > > > For more options, visit https://groups.google.com/d/optout.
> > > 
> > > 
> > > -- 
> > > Best Regards,
> > > 
> > > Christian Ledermann
> > > 
> > > Newark-on-Trent - UK
> > > Mobile : +44 7474997517
> > > 
> > > https://uk.linkedin.com/in/christianledermann
> > > https://github.com/cleder/
> > > 
> > > 
> > > <*)))>{
> > > 
> > > If you save the living environment, the biodiversity that we have
> > > left,
> > > you will also automatically save the physical environment, too. But
> > > If
> > > you only save the physical environment, you will ultimately lose
> > > both.
> > > 
> > > 1) Don’t drive species to extinction
> > > 
> > > 2) Don’t destroy a habitat that species rely on.
> > > 
> > > 3) Don’t change the climate in ways that will result in the above.
> > > 
> > > }<(((*>
> -- 
> 
> Teşekkürler,
> http://www.kadircebel.com 
> 
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/07d89baa005bb001a3c2b034b073264edd05c40c.camel%40gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bbe838b9-56cd-4411-bd46-1e1f1001c5e1%40www.fastmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: log out a user when user closes tab or browser

2019-03-21 Thread KadirCEBEL
You can use jquery. you can write a function like logout (in the view)
after that when browser tab is closed (you have to check with jquery
code) you can kill user session. 

Prş, 2019-03-21 tarihinde 17:15 +0330 saatinde, Mohammad Etemaddar
yazdı:
> I have a suggest for you. Its non standard.
> 
> First create a javascript infinite loop to make a get call every 1
> minute.
> Also make session expiration time at 2 minutes. So if tabs closed the
> session will expire at 1 minute.
> 
> On Thu, 21 Mar 2019 15:17 Christian Ledermann, <
> christian.lederm...@gmail.com> wrote:
> > SESSION_EXPIRE_AT_BROWSER_CLOSE works for me 
> > but only when you close the browswer, closing a tab will not log
> > you out
> > also it depends on the browser (firefox seemed in the past to
> > ignore this)
> > 
> > On Thu, 21 Mar 2019 at 05:34, Sam W  wrote:
> > > Is there a way in Django to  log out a user when user closes tab
> > > or browser?
> > > 
> > > This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work
> > > 
> > > -- 
> > > You received this message because you are subscribed to the
> > > Google Groups "Django users" group.
> > > To unsubscribe from this group and stop receiving emails from it,
> > > send an email to django-users+unsubscr...@googlegroups.com.
> > > To post to this group, send email to 
> > > django-users@googlegroups.com.
> > > Visit this group at https://groups.google.com/group/django-users.
> > > To view this discussion on the web visit 
> > > https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
> > > .
> > > For more options, visit https://groups.google.com/d/optout.
> > 
> > 
> > -- 
> > Best Regards,
> > 
> > Christian Ledermann
> > 
> > Newark-on-Trent - UK
> > Mobile : +44 7474997517
> > 
> > https://uk.linkedin.com/in/christianledermann
> > https://github.com/cleder/
> > 
> > 
> > <*)))>{
> > 
> > If you save the living environment, the biodiversity that we have
> > left,
> > you will also automatically save the physical environment, too. But
> > If
> > you only save the physical environment, you will ultimately lose
> > both.
> > 
> > 1) Don’t drive species to extinction
> > 
> > 2) Don’t destroy a habitat that species rely on.
> > 
> > 3) Don’t change the climate in ways that will result in the above.
> > 
> > }<(((*>
-- 

Teşekkürler,
http://www.kadircebel.com 

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


Re: log out a user when user closes tab or browser

2019-03-21 Thread Sam W
Thank you for your response. 
JavaScript infinite loop behavior gets blocked by Antivirus.

On Thursday, March 21, 2019 at 8:46:22 AM UTC-5, Mohammad Etemaddar wrote:
>
> I have a suggest for you. Its non standard.
>
> First create a javascript infinite loop to make a get call every 1 minute.
> Also make session expiration time at 2 minutes. So if tabs closed the 
> session will expire at 1 minute.
>
> On Thu, 21 Mar 2019 15:17 Christian Ledermann,  > wrote:
>
>> SESSION_EXPIRE_AT_BROWSER_CLOSE works for me 
>> but only when you close the browswer, closing a tab will not log you out
>> also it depends on the browser (firefox seemed in the past to ignore this)
>>
>> On Thu, 21 Mar 2019 at 05:34, Sam W > 
>> wrote:
>>
>>> Is there a way in Django to log out a user when user closes tab or 
>>> browser? This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work 
>>>
>>> -- 
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> -- 
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Newark-on-Trent - UK
>> Mobile : +44 7474997517
>>
>> https://uk.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CABCjzWq_uy06FeNF%2Bs5f5r9NOT14bcENz52HvKdTrRxKqTiHQA%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d16460b6-7074-4ee6-8081-093505c28631%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: log out a user when user closes tab or browser

2019-03-21 Thread Sam W
Thank you for your response. 
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
Doesn't work well in Chrome browser. Plus I want the client's session
to be expired/logged out when tab closed.

On Thursday, March 21, 2019 at 6:48:20 AM UTC-5, Christian Ledermann wrote:
>
> SESSION_EXPIRE_AT_BROWSER_CLOSE works for me 
> but only when you close the browswer, closing a tab will not log you out
> also it depends on the browser (firefox seemed in the past to ignore this)
>
> On Thu, 21 Mar 2019 at 05:34, Sam W > 
> wrote:
>
>> Is there a way in Django to log out a user when user closes tab or 
>> browser? This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work 
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> -- 
> Best Regards,
>
> Christian Ledermann
>
> Newark-on-Trent - UK
> Mobile : +44 7474997517
>
> https://uk.linkedin.com/in/christianledermann
> https://github.com/cleder/
>
>
> <*)))>{
>
> If you save the living environment, the biodiversity that we have left,
> you will also automatically save the physical environment, too. But If
> you only save the physical environment, you will ultimately lose both.
>
> 1) Don’t drive species to extinction
>
> 2) Don’t destroy a habitat that species rely on.
>
> 3) Don’t change the climate in ways that will result in the above.
>
> }<(((*>
>

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


Re: log out a user when user closes tab or browser

2019-03-21 Thread Mohammad Etemaddar
I have a suggest for you. Its non standard.

First create a javascript infinite loop to make a get call every 1 minute.
Also make session expiration time at 2 minutes. So if tabs closed the
session will expire at 1 minute.

On Thu, 21 Mar 2019 15:17 Christian Ledermann, <
christian.lederm...@gmail.com> wrote:

> SESSION_EXPIRE_AT_BROWSER_CLOSE works for me
> but only when you close the browswer, closing a tab will not log you out
> also it depends on the browser (firefox seemed in the past to ignore this)
>
> On Thu, 21 Mar 2019 at 05:34, Sam W  wrote:
>
>> Is there a way in Django to log out a user when user closes tab or
>> browser? This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Best Regards,
>
> Christian Ledermann
>
> Newark-on-Trent - UK
> Mobile : +44 7474997517
>
> https://uk.linkedin.com/in/christianledermann
> https://github.com/cleder/
>
>
> <*)))>{
>
> If you save the living environment, the biodiversity that we have left,
> you will also automatically save the physical environment, too. But If
> you only save the physical environment, you will ultimately lose both.
>
> 1) Don’t drive species to extinction
>
> 2) Don’t destroy a habitat that species rely on.
>
> 3) Don’t change the climate in ways that will result in the above.
>
> }<(((*>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABCjzWq_uy06FeNF%2Bs5f5r9NOT14bcENz52HvKdTrRxKqTiHQA%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALJt1ntZabSenvJg%2BjbKoR4irn6Te3Eg2Ykzq-NBx1s4cx%3Du6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: 404 error when posting a multipart/form-data form

2019-03-21 Thread Manlio Perillo
On Thursday, March 21, 2019 at 10:56:43 AM UTC+1, Mohammad Etemaddar wrote:
>
> Can you send your view here?
>
>
Here is the URL that reproduce the problem:
https://fast-page.it/mp/bug/

and here is the URL that prints the Django environment:
https://fast-page.it/mp/debug/

The view code is here:
https://gist.github.com/perillo/2f828209cea84ff8c753f6f2524119f1


What I find strange is that if I remove the {{ form }} and uncomment the 
manual input element, there is no error.

> [...]


Thanks
Manlio Perillo

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


Re: Hello From Nigeria

2019-03-21 Thread Nasim TKP
Anyone please share django whatsapp group or telegram group joining link
pleasee

On Thu, 21 Mar 2019, 3:11 pm Gabriel Stone, 
wrote:

> hello i am from Ghana am i qualified to join?
>
> On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun <
> bosun...@gmail.com> wrote:
>
>> Yes 08024273381
>>
>> On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote:
>>>
>>> Yes please.  0814390
>>>
>>> On Monday, March 11, 2019, Joshua Kayode  wrote:
>>>
 Greetings, if you are a django developer in Nigeria, would you consider
 joining a WhatsApp group?

 --
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b36b25cf-7e71-4e39-b2f7-700b76d1bd82%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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL-5MpU8FfK_V-K2_D9%2ByhKB%2Bynq-DqjiyLfKCSVV%3D212kRpmg%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAVzVZX1PLSf0hKcsgk5EydWST4TKZGdZDgZDHravMXABM0xtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello From Nigeria

2019-03-21 Thread carl collins
Pls add me +237677104421

On Thu, Mar 21, 2019, 13:11 Gabriel Stone 
wrote:

> hello i am from Ghana am i qualified to join?
>
> On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun <
> bosun...@gmail.com> wrote:
>
>> Yes 08024273381
>>
>> On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote:
>>>
>>> Yes please.  0814390
>>>
>>> On Monday, March 11, 2019, Joshua Kayode  wrote:
>>>
 Greetings, if you are a django developer in Nigeria, would you consider
 joining a WhatsApp group?

 --
 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 https://groups.google.com/group/django-users.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.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+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/b36b25cf-7e71-4e39-b2f7-700b76d1bd82%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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAL-5MpU8FfK_V-K2_D9%2ByhKB%2Bynq-DqjiyLfKCSVV%3D212kRpmg%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEPm0byZFbF7w3dBFpQK2GLvUazz-A-ppWFfY6VH7yreymXt8Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello From Nigeria

2019-03-21 Thread Gabriel Stone
hello i am from Ghana am i qualified to join?

On Thu, Mar 21, 2019 at 1:54 PM Asiwaju Lasisi Prodigy Olatunbosun <
bosun...@gmail.com> wrote:

> Yes 08024273381
>
> On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote:
>>
>> Yes please.  0814390
>>
>> On Monday, March 11, 2019, Joshua Kayode  wrote:
>>
>>> Greetings, if you are a django developer in Nigeria, would you consider
>>> joining a WhatsApp group?
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b36b25cf-7e71-4e39-b2f7-700b76d1bd82%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAL-5MpU8FfK_V-K2_D9%2ByhKB%2Bynq-DqjiyLfKCSVV%3D212kRpmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Hello From Nigeria

2019-03-21 Thread Asiwaju Lasisi Prodigy Olatunbosun
Yes 08024273381

On Wednesday, 13 March 2019 12:44:16 UTC+1, Thaddeaus Iorbee wrote:
>
> Yes please.  0814390
>
> On Monday, March 11, 2019, Joshua Kayode  > wrote:
>
>> Greetings, if you are a django developer in Nigeria, would you consider 
>> joining a WhatsApp group?
>>
>> -- 
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAEL9fCFn_XXW26_wXAz0K%3DaHTA31mhWMhhCQcxvpMSn1ZMSuEg%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b36b25cf-7e71-4e39-b2f7-700b76d1bd82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: log out a user when user closes tab or browser

2019-03-21 Thread Christian Ledermann
SESSION_EXPIRE_AT_BROWSER_CLOSE works for me
but only when you close the browswer, closing a tab will not log you out
also it depends on the browser (firefox seemed in the past to ignore this)

On Thu, 21 Mar 2019 at 05:34, Sam W  wrote:

> Is there a way in Django to log out a user when user closes tab or
> browser? This one "SESSION_EXPIRE_AT_BROWSER_CLOSE =True" Doesn't work
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/644cca74-0443-4c71-8d8e-7326a252eb2e%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

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


Virtual Host vs. MAMP

2019-03-21 Thread Daniel Leavey
I recently purchased and installed VirtualHostX 8.7
https://clickontyler.com/virtualhostx/
I wondered if I could use this local server setup on my Mac instead of 
installing MAMP or IMAMP. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6114ef24-6d09-47d5-9eac-84466d6345e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 404 error when posting a multipart/form-data form

2019-03-21 Thread Mohammad Etemaddar
Can you send your view here?

On Thu, 21 Mar 2019 12:58 Manlio Perillo,  wrote:

> I have a Django application that works perfectly fine both on my PC and on
> a hosting system with CloudLinux and Passenger.
> However when I added a form with a file field, I started to get 404 errors
> on POST.
>
> I tried to remove all the middleware, but the problem is still here.
> The error message says that the 404 error was raised by my view, but
> that's not true; my view is not called at all during a POST request.
>
> What's strange is that I have another Django application on a different
> hosting account with the same environment and it works fine.
> The problem is probably in my application, but I'm unable to find it.
>
> Where should I search to find the cause of the problem?
>
>
> Thanks
> Manlio Perillo
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/313db9e4-340c-475a-abe6-f12f96213b05%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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALJt1nvkXie8yTG%2BG9c7C8C%3D3modPsubLK%2B2R-RHgGBXiSizxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


404 error when posting a multipart/form-data form

2019-03-21 Thread Manlio Perillo
I have a Django application that works perfectly fine both on my PC and on 
a hosting system with CloudLinux and Passenger.
However when I added a form with a file field, I started to get 404 errors 
on POST.

I tried to remove all the middleware, but the problem is still here.
The error message says that the 404 error was raised by my view, but that's 
not true; my view is not called at all during a POST request.

What's strange is that I have another Django application on a different 
hosting account with the same environment and it works fine.
The problem is probably in my application, but I'm unable to find it.

Where should I search to find the cause of the problem?


Thanks
Manlio Perillo

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