Matching query does not exist

2019-01-18 Thread Ivan Martić
Hi all,
 i am having trouble to get this query on db table right. 
I am always getting error.

Please check shell erorr attached.

I appreciate your help!




-- 
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/ca5a10a1-b8ea-4950-89b7-6806a4682ef8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#models

from __future__ import unicode_literals
from django.db import models, connection
from django.utils import timezone
from datetime import date



class Material(models.Model):
id = models.IntegerField(db_column='ID', primary_key=True, blank=False, 
unique=True)
bukrs = models.CharField(db_column='Bukrs', max_length=4)
materialid = models.CharField(db_column='MaterialID', max_length=10)
material_name = models.CharField(db_column='Material_name', max_length=7)

class Meta:
managed = False
db_table = 'Material'

def __str__(self):
return '%s %s %s' % (self.bukrs, self.materialid, self.material_name)


class MaterialGroup(models.Model):
id = models.CharField(db_column='ID', max_length=255, blank=False, 
primary_key=True)
material_group = models.CharField(db_column='Material Group', 
max_length=255, blank=True, null=True)

class Meta:
managed = False
db_table = 'Material Group'

def __str__(self):
return '%s' % (self.material_group)


class Productgroupinput(models.Model):
id = models.IntegerField(db_column='ID', primary_key=True, blank=False, 
unique=True)
bukrs = models.CharField(db_column='Bukrs', max_length=4)
materialid = models.ForeignKey(Material, on_delete=models.CASCADE, 
db_column='Materialid', max_length=10)
material_group = models.ForeignKey(MaterialGroup, on_delete=models.CASCADE, 
db_column='Material_group', max_length=2)

class Meta:
managed = False
db_table = 'ProductGroupInput'

def __str__(self):
return '%s %s %s' % (self.bukrs, self.materialid, self.material_group)>>> from productsgrouping.models import Material, MaterialGroup, 
>>> Productgroupinput
>>> test = Productgroupinput.objects.all()
>>> test
Traceback (most recent call last):
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\fields\related_des
criptors.py", line 163, in __get__
rel_obj = self.field.get_cached_value(instance)
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\fields\mixins.py",
 line 13, in get_cached_value
return instance._state.fields_cache[cache_name]
KeyError: 'materialid'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\query.py",
 line 24
7, in __repr__
return '<%s %r>' % (self.__class__.__name__, data)
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\base.py",
 line 503
, in __repr__
return '<%s: %s>' % (self.__class__.__name__, self)
  File "C:\Users\martici\QIF\qif\productsgrouping\models.py", line 45, in 
__str__
return '%s %s %s' % (self.bukrs, self.materialid, self.material_group)
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\fields\related_des
criptors.py", line 177, in __get__
rel_obj = self.get_object(instance)
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\fields\related_des
criptors.py", line 144, in get_object
return qs.get(self.field.get_reverse_related_filter(instance))
  File 
"C:\Users\martici\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\models\query.py",
 line 39
9, in get
self.model._meta.object_name
productsgrouping.models.Material.DoesNotExist: Material matching query does not 
exist.>>> query = Material.objects.all()
>>> query
, , , , ]>
>>>

Re: What do you think about unify templates feature?

2019-01-18 Thread J . Pablo Martín Cobos
I answer between lines

El jue., 17 ene. 2019 a las 18:42, Maciek Olko ()
escribió:

> Did you try to measure the difference in time of rendering standard and
> your way?
>
>
Yes. I have several examples:

App Template Num templates rendered before unify Num templates rendered
after unify Time render template before unify (ms) Time render template
after unify (ms) Improve
Django admin admin/index.html 3 1 75 - 110 71 - 79 22%
Django admin admin/change_list.html 26 Command error 180-300 Command error
Django admin admin/change_form.html 16 Command error 350-400 Command error
Django constance admin/constance/change_list.html 7 1 350-400 150-250 75%
Django su su/login.html 5 3 15- 20 10 - 12 54%

My command currently does not work with several complex templates like
admin/change_list.html or admin/change_form.html But we can improve it,
currently it works with almost all.

If there is a nice improve with views that render few templates... imagine
with views with a lot of templates.

I have measure these times with django-debug-toolbar-template-timings

With this email only I want to know if you see it can be a important
feature to add to Django framework... or it is a silly thing.

Best,



> Regards,
> Maciej
>
> czw., 17.01.2019, 10:02 użytkownik J. Pablo Martín Cobos 
> napisał:
>
>> Hi,
>>
>> From one year ago, I am using an own command for Django templates that
>> unify them. With an example it is easy to see. If I am to render for
>> example a template call news.html like it:
>>
>> 1. news.html
>>
>> {% extends "base.html" %}
>>
>> {% block title %}
>> {% include "inc.news.title.html" %}
>> {% endblock %}
>>
>> {% block content %}
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> {% endblock %}
>>
>> 2. base.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> {% block title %}{% endblock %}
>> 
>> 
>> {% block content %}{% endblock %}
>> 
>> 
>>
>> 3. inc.news.title.html
>> News
>>
>> With this command I preproces every template of a settings variable and I
>> get something like this:
>>
>> news.unify.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> News
>> 
>> 
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> 
>> 
>>
>> So I have a two improves:
>>
>>1. It is more fast. And in a real project a view can render easyly 50
>>templates
>>2. I use news.html to develop and news.unify.html to production. So I
>>don't lose legilibility.
>>
>>
>> What do you think about "unify templates feature"? Do you know if exists
>> a similar public project in github/gitlab/bitbucket etc?
>>
>>
>> Best,
>>
>> --
>> Pablo Martín Cobos
>> Computer engineer
>> Python/Django developer
>> 652 53 37 36
>> goi...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-develop...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%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 developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-develop...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CALYYG805GZFJL5b_9nortw8Sj%2Bkrx1p4xqki7C96Zd8vHeYsmw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Pablo Mart

Re: What do you think about unify templates feature?

2019-01-18 Thread J . Pablo Martín Cobos
I answer between lines


El vie., 18 ene. 2019 a las 5:03, shiva kumar (<
kannamshivakumar...@gmail.com>) escribió:

> Could you please explain about it. I hadn't understood ur idea.
>


   1. Currently: with you render a view, this render a template. But
   usually, this template extends of another and include others. So Django has
   to get these templates to create an HTML. This process get time.
   2. My proposal: Preprocess templates for some (or all) them. Creating a
   template without extends or includes. So, in my previous email you can see,
   Django render less templates, so Django win time.

We can get a backend a  little faster with very little effort.

Best!



> On Thu 17 Jan, 2019 2:32 pm J. Pablo Martín Cobos 
>> Hi,
>>
>> From one year ago, I am using an own command for Django templates that
>> unify them. With an example it is easy to see. If I am to render for
>> example a template call news.html like it:
>>
>> 1. news.html
>>
>> {% extends "base.html" %}
>>
>> {% block title %}
>> {% include "inc.news.title.html" %}
>> {% endblock %}
>>
>> {% block content %}
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> {% endblock %}
>>
>> 2. base.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> {% block title %}{% endblock %}
>> 
>> 
>> {% block content %}{% endblock %}
>> 
>> 
>>
>> 3. inc.news.title.html
>> News
>>
>> With this command I preproces every template of a settings variable and I
>> get something like this:
>>
>> news.unify.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> News
>> 
>> 
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> 
>> 
>>
>> So I have a two improves:
>>
>>1. It is more fast. And in a real project a view can render easyly 50
>>templates
>>2. I use news.html to develop and news.unify.html to production. So I
>>don't lose legilibility.
>>
>>
>> What do you think about "unify templates feature"? Do you know if exists
>> a similar public project in github/gitlab/bitbucket etc?
>>
>>
>> Best,
>>
>> --
>> Pablo Martín Cobos
>> Computer engineer
>> Python/Django developer
>> 652 53 37 36
>> goi...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-develop...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%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 developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to django-develop...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMsYeuFV3EV_3H%2BR0q9xi5Q6EQq6L2cLkatcvrTtSYW%3D2zRk7A%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Juan Pablo Martín Cobos
Ingeniero informático
Desarrollador Python/Django
652 53 37 36all  <652%2053%2037%2036>
goi...@gmail.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/dj

Re: Matching query does not exist

2019-01-18 Thread Kasper Laudrup

Hi Ivan,

On 1/18/19 10:25 AM, Ivan Martić wrote:

Hi all,
  i am having trouble to get this query on db table right.
I am always getting error.



In your definition of the Material model, the materialid field is 
defined like this:


materialid = models.CharField(db_column='MaterialID', max_length=10)

Whereas you refer to it in Productgroupinput like this:

materialid = models.ForeignKey(Material, on_delete=models.CASCADE, 
db_column='Materialid', max_length=10)


Notice the difference in the db_column parameter?

I guess that could be the cause of your error.

Kind regards,

Kasper Laudrup


--
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/8daaaf0f-17c3-69c5-8b86-915df7ba348e%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Matching query does not exist

2019-01-18 Thread Aditya Singh
😃

On Jan 18, 2019 3:19 PM, "Kasper Laudrup"  wrote:

Hi Ivan,


On 1/18/19 10:25 AM, Ivan Martić wrote:
> Hi all,
>   i am having trouble to get this query on db table right.
> I am always getting error.
>

In your definition of the Material model, the materialid field is
defined like this:

materialid = models.CharField(db_column='MaterialID', max_length=10)

Whereas you refer to it in Productgroupinput like this:

materialid = models.ForeignKey(Material, on_delete=models.CASCADE,
db_column='Materialid', max_length=10)

Notice the difference in the db_column parameter?

I guess that could be the cause of your error.

Kind regards,

Kasper Laudrup



-- 
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/8daaaf0f-17c3-69c5-8b86-915df7ba348e%40stacktrace.dk
.

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/CAEPfumjfe6bdiiOa%2BVg-TixRoFNgd1CEiyVwMCET-McDD7FTCQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Matching query does not exist

2019-01-18 Thread Ivan Martić
Thank you Kasper, 

i have copied that model after doing inspectdb. So it should be set by 
default from django that way. Usually all was ok..
Also, i have tried that  change now and got the same result.

Any other idea where i gone wrong?

-- 
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/836e1018-233d-4eb4-9f24-39dd321ce253%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Matching query does not exist

2019-01-18 Thread Kasper Laudrup

Hi Ivan,

On 1/18/19 10:59 AM, Ivan Martić wrote:

Thank you Kasper,



You're welcome.

i have copied that model after doing inspectdb. So it should be set by 
default from django that way. Usually all was ok..

Also, i have tried that  change now and got the same result.

Any other idea where i gone wrong?



Sorry, not really. I'm wondering why you are specifying your database 
columns explicitly though? I've never had a need for that, but I'm far 
from being very experienced with Django.


Hopefully someone else can help you.

Kind regards,

Kasper Laudrup

--
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/54b11d43-d6c5-dcff-6d3d-29cbeca2ef43%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Matching query does not exist

2019-01-18 Thread Ivan Martić
Hi,

im not sure that i understand "specifying your database columns explicitly".
I have connected to existing MSSQL database so i had to adapt my model due
to that. Just copied model from inspectdb and added:
- def __str__
-ForeignKey(class name, on delete=models.CASCADE)xtimes for materialid
and group.

I am not so experience  as you :) but i think you are on the good lead.
I am watching this case :
https://stackoverflow.com/questions/44107021/django-admin-doesnt-display-value
Seems like same issue, same error occured.
What do you think?

pet, 18. sij 2019. u 11:16 Kasper Laudrup  napisao
je:

> Hi Ivan,
>
> On 1/18/19 10:59 AM, Ivan Martić wrote:
> > Thank you Kasper,
> >
>
> You're welcome.
>
> > i have copied that model after doing inspectdb. So it should be set by
> > default from django that way. Usually all was ok..
> > Also, i have tried that  change now and got the same result.
> >
> > Any other idea where i gone wrong?
> >
>
> Sorry, not really. I'm wondering why you are specifying your database
> columns explicitly though? I've never had a need for that, but I'm far
> from being very experienced with Django.
>
> Hopefully someone else can help you.
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/54b11d43-d6c5-dcff-6d3d-29cbeca2ef43%40stacktrace.dk
> .
> 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/CAFab_C-2tbFNeo_JJV7tt8LYPP%3DP%3DKJXbEXjfQuLFEQgMP86-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Matching query does not exist

2019-01-18 Thread Kasper Laudrup

Hi again Ivan,

On 1/18/19 11:22 AM, Ivan Martić wrote:

im not sure that i understand "specifying your database columns explicitly".
I have connected to existing MSSQL database so i had to adapt my model 
due to that.


That's exactly what I mean :-)

I don't have any experience with using existing database models with 
Django (I just let Django take care of handling database entries).


Hopefully someone else can help you.

Best of luck.

Kasper Laudrup

--
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/8186a71d-5d63-4923-b0b1-039ff3254a2c%40stacktrace.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Error while running a project

2019-01-18 Thread Andréas Kühne
When running postgres, the postgres user is normally not a user that you
can login via the psycopg2 connector with. You should use a specific user
for the database that you want to connect to. The postgres user is a
superuser and is normally connected to a local user that you need to login
via.

Regards,

Andréas


Den tors 17 jan. 2019 kl 22:56 skrev Nadhem Zmandar <
zmandar.nad...@gmail.com>:

> I've installed psycopg2 before running he server. So I think it's an other
> problem
>
> Le jeu. 17 janv. 2019 à 16:50, Harryxon Ndegwa <
> ndegwaharryxon1...@gmail.com> a écrit :
>
>> did u install psycopg2 using pip,
>> that is, pip install psycopg2
>> i see its a connection error make sure u have psycopg2 connector
>> installed in your environment
>>
>> #%£&
>>
>> On Thu, 17 Jan 2019 6:22 pm Nadhem Zmandar > wrote:
>>
>>> I am beginner with Django. I've downloaded an open source Django project
>>> to start learning and I've installed PostGres and PgAdmin and tested
>>> them.and I have checked all details in the settings.py (especially the
>>> password) to link the project to the database created on PgAdmin.
>>> However when I run the project I have this error
>>>
>>> PS D:\django\btre_project-master> python manage.py runserver
>>> Performing system checks...
>>>
>>> System check identified no issues (0 silenced).
>>> Unhandled exception in thread started by >> check_errors..wrapper at 0x04394300>
>>> Traceback (most recent call last):
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\base\base.py",
>>> line 216, in ensure_connection
>>> self.connect()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\base\base.py",
>>> line 194, in connect
>>> self.connection = self.get_new_connection(conn_params)
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\postgresql\base.py",
>>> line 178, in get_new_connection
>>> connection = Database.connect(**conn_params)
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psycopg2\__init__.py",
>>> line 130, in connect
>>> conn = _connect(dsn, connection_factory=connection_factory,
>>> **kwasync)
>>> psycopg2.OperationalError: FATAL:  password authentication failed for
>>> user "postgres"
>>>
>>>
>>> The above exception was the direct cause of the following exception:
>>>
>>>
>>> Traceback (most recent call last):
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py",
>>> line 225, in wrapper
>>> fn(*args, **kwargs)
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py",
>>> line 120, in inner_run
>>> self.check_migrations()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py",
>>> line 442, in check_migrations
>>> executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\migrations\executor.py",
>>> line 18, in __init__
>>> self.loader = MigrationLoader(self.connection)
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\migrations\loader.py",
>>> line 49, in __init__
>>> self.build_graph()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\migrations\loader.py",
>>> line 212, in build_graph
>>> self.applied_migrations = recorder.applied_migrations()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\migrations\recorder.py",
>>> line 61, in applied_migrations
>>> if self.has_table():
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\migrations\recorder.py",
>>> line 44, in has_table
>>> return self.Migration._meta.db_table in
>>> self.connection.introspection.table_names(self.connection.cursor())
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\base\base.py",
>>> line 255, in cursor
>>> return self._cursor()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\base\base.py",
>>> line 232, in _cursor
>>> self.ensure_connection()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\backends\base\base.py",
>>> line 216, in ensure_connection
>>> self.connect()
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\db\utils.py",
>>> line 89, in __exit__
>>> raise dj_exc_value.with_traceback(traceback) from exc_value
>>>   File
>>> "C:\Users\nadhem\AppData\Local\Programs\Python

Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Django Geek Aditya

>
> .\scripts\activate.bat is also not working
>
> THE SHELL OUTPUT IS -> 
PS E:\todo> .\Scripts\activate.bat
.\Scripts\activate.bat : The term '.\Scripts\activate.bat' is not 
recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct
and try again.
At line:1 char:1
+ .\Scripts\activate.bat
+ ~~
+ CategoryInfo  : ObjectNotFound: 
(.\Scripts\activate.bat:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS E:\todo> 

-- 
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/5788d175-95df-4f4b-8e7d-f5bb8c0226cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Django Geek Aditya
I'm using Windows 10

On Friday, January 18, 2019 at 8:39:08 AM UTC+5:30, kannamshivakumar417 
wrote:
>
> Can you tell which os ur using.
>
> On Fri 18 Jan, 2019 12:48 am Django Geek Aditya   wrote:
>
>> Shell Output after entering command is
>> PS E:\todo> . \Scripts\activate
>> . : The term '\Scripts\activate' is not recognized as the name of a 
>> cmdlet, function, script file, or operable
>> program. Check the spelling of the name, or if a path was included, 
>> verify that the path is correct and try again.
>> At line:1 char:3
>> + . \Scripts\activate
>> +   ~
>> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String) 
>> [], CommandNotFoundException
>> + FullyQualifiedErrorId : CommandNotFoundException
>>
>> PS E:\todo>
>>
>> -- 
>> 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/00a2f79a-0d62-4fd8-8cd4-cd5b9e8d1f2b%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/1ae6d1eb-ad6d-4458-913a-3ef1ab52e3bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Michal Petrucha
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Thu, Jan 17, 2019 at 11:14:48AM -0800, Django Geek Aditya wrote:
> Shell Output after entering command is
> PS E:\todo> . \Scripts\activate
> . : The term '\Scripts\activate' is not recognized as the name of a cmdlet, 
> function, script file, or operable
> program. Check the spelling of the name, or if a path was included, verify 
> that the path is correct and try again.
> At line:1 char:3
> + . \Scripts\activate
> +   ~
> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String) 
> [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
> 
> PS E:\todo>

Hi Aditya,

The correct incantation for Powershell is

.\Scripts\activate.ps1

The version without any extension, or with .bat, would be correct if
you were running standard Windows cmd instead.

Good luck,

Michal
-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQIcBAEBCgAGBQJcQc8bAAoJEHA7T/IPM/kl/UwQAOW6VmD4ziMlE0iCWI6cebb5
omFIvG7cR5vT68RyONUiIJVhxOlGhEdkNTvrKsok7Kztp7ncOyK+b5WQgcDe32DS
bl6kJxXSNNSQOfE3KdprOn/5wOYtwdSHH8JNe4R6n/um7kVetjUbnkfraHoFBS5R
J0gKdpBkWEOEjoV/jJThzytvPjE0TgatcYthGLd8lrmAA9QQgIRguYNo+aRvFXv6
2n9uufi3wWLkA8Bv96qADa6vBgSBP6dtBKY3u73M/3U44q/OJO4LAbwYqqsVy032
Y2IGlTozqpFrSuu7yXH4DpCxy3o/WS20NFpmFYyQ9zlQbtldxfbLLQi/PWhi/xfm
bpwvG+InT0LvbYZsroaWBb9BX44ZkaDZMf4b6dVF7r1Unf/Win8YImK+mWxWu+iT
qMpIGAFGeawGuYYACkdw1DdgF7yqyiGYuDcCHCO6TyYVki5jW1nNHQV9Qyp8rcv9
SzH49ftAqn7PX+lXqrOke8G7+/2DMRSexVZoK3cTNMpeCkqwBrkghaBfr5vMGasI
4qNdWuzLiGkFv1lQWmb5Sm9e9eNAy0uFnTSzhsePT1J4Vs9tcr5y0A3/VY2dD8uv
gTZPj/lXcVTj4OetRRzjClhNiEqBAG3ji6wCIZ3yYlss+kHRX9q7Hm8dw7nROP6y
mnJHMuNJZVgxoiywqOX7
=pAUo
-END PGP SIGNATURE-

-- 
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/20190118130531.GB8269%40konk.org.
For more options, visit https://groups.google.com/d/optout.


Re: working fine with sqllite but not showing result in mysql

2019-01-18 Thread tribhuvan kishor
its the shortcut i did that it is working. but the issue is still the same.
it just a bypass :P


On Tue, Jan 15, 2019 at 2:31 AM Danylo K.  wrote:

> if you change the code to this, it will work:
>
>post = get_object_or_404(Post, slug=post,
>  status='published',
>  publish__year=year)
>  # publish__month=month,
>  # publish__day=day)
>
>
> On Mon, Jan 14, 2019 at 2:22 PM tribhuvan kishor <
> tribhuvankishor...@gmail.com> wrote:
>
>> yes all things are working fine like post list are working fine
>>
>> from django.shortcuts import render, get_object_or_404
>> from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
>> from django.views.generic import ListView
>> from .models import Post
>>
>> def post_list(request):
>> object_list = Post.published.all()
>> paginator = Paginator(object_list, 3) # 3 posts in each page
>> page = request.GET.get('page')
>> try:
>> posts = paginator.page(page)
>> except PageNotAnInteger:
>> # If page is not an integer deliver the first page
>> posts = paginator.page(1)
>> except EmptyPage:
>> # If page is out of range deliver last page of results
>> posts = paginator.page(paginator.num_pages)
>> return render(request,
>>   'blog/post/list.html',
>>   {'page': page,
>>'posts': posts})
>>
>> # Create your views here.
>> def post_detail(request, year, month, day, post):
>> post = get_object_or_404(Post, slug=post,
>>  status='published',
>>  publish__year=year,
>>  publish__month=month,
>>  publish__day=day)
>>
>> return render(request,
>>   'blog/post/details.html',
>>   {'post': post})
>>
>> class PostListView(ListView):
>> queryset = Post.published.all()
>> context_object_name = 'posts'
>> paginate_by = 3
>> template_name = 'blog/post/list.html'
>>
>> def test_test(request):
>> return render(request,'blog/post/test.html')
>>
>>
>> On Tue, Jan 15, 2019 at 12:24 AM Alex Kimeu 
>> wrote:
>>
>>> Have you configured MySQL correctly?
>>>
>>> On Mon, Jan 14, 2019 at 9:07 PM tribhuvan kishor <
>>> tribhuvankishor...@gmail.com> wrote:
>>>
 this view is retrieving data with SQlite but not fetching data in
 MySQL saying no data found.


 def post_detail(request, year, month, day, post):
 post = get_object_or_404(Post, slug=post,
  status='published',
  publish__year=year,
  publish__month=month,
  publish__day=day)

 return render(request,
   'blog/post/details.html',
   {'post': post})

 --
 regards
 Tribhuvan Kishor Bhaskar

 --
 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/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>
>>> --
>>>
>>>
>>> *"It's when nothing happens that anything can happen."*
>>> *https://kodenaut.github.io/ **+
>>> 254 723494571*
>>>
>>> --
>>> 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/CACYP3VGYe96j6vYWYC8-7GCzODUfu8b5xc1qo2Lh6KhHevKgYQ%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> regards
>> Tribhuvan Kishor Bhaskar
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe

Re: working fine with sqllite but not showing result in mysql

2019-01-18 Thread tribhuvan kishor
from django.urls import path
from . import views


app_name = 'blog'
urlpatterns = [
# post views
# path('', views.post_list, name='post_list'),
path('', views.PostListView.as_view(), name='post_list'),
path('',
 views.post_detail,
 name='post_detail'),
]


On Fri, Jan 18, 2019 at 7:28 PM tribhuvan kishor <
tribhuvankishor...@gmail.com> wrote:

> its the shortcut i did that it is working. but the issue is still the
> same. it just a bypass :P
>
>
> On Tue, Jan 15, 2019 at 2:31 AM Danylo K.  wrote:
>
>> if you change the code to this, it will work:
>>
>>post = get_object_or_404(Post, slug=post,
>>  status='published',
>>  publish__year=year)
>>  # publish__month=month,
>>  # publish__day=day)
>>
>>
>> On Mon, Jan 14, 2019 at 2:22 PM tribhuvan kishor <
>> tribhuvankishor...@gmail.com> wrote:
>>
>>> yes all things are working fine like post list are working fine
>>>
>>> from django.shortcuts import render, get_object_or_404
>>> from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
>>> from django.views.generic import ListView
>>> from .models import Post
>>>
>>> def post_list(request):
>>> object_list = Post.published.all()
>>> paginator = Paginator(object_list, 3) # 3 posts in each page
>>> page = request.GET.get('page')
>>> try:
>>> posts = paginator.page(page)
>>> except PageNotAnInteger:
>>> # If page is not an integer deliver the first page
>>> posts = paginator.page(1)
>>> except EmptyPage:
>>> # If page is out of range deliver last page of results
>>> posts = paginator.page(paginator.num_pages)
>>> return render(request,
>>>   'blog/post/list.html',
>>>   {'page': page,
>>>'posts': posts})
>>>
>>> # Create your views here.
>>> def post_detail(request, year, month, day, post):
>>> post = get_object_or_404(Post, slug=post,
>>>  status='published',
>>>  publish__year=year,
>>>  publish__month=month,
>>>  publish__day=day)
>>>
>>> return render(request,
>>>   'blog/post/details.html',
>>>   {'post': post})
>>>
>>> class PostListView(ListView):
>>> queryset = Post.published.all()
>>> context_object_name = 'posts'
>>> paginate_by = 3
>>> template_name = 'blog/post/list.html'
>>>
>>> def test_test(request):
>>> return render(request,'blog/post/test.html')
>>>
>>>
>>> On Tue, Jan 15, 2019 at 12:24 AM Alex Kimeu 
>>> wrote:
>>>
 Have you configured MySQL correctly?

 On Mon, Jan 14, 2019 at 9:07 PM tribhuvan kishor <
 tribhuvankishor...@gmail.com> wrote:

> this view is retrieving data with SQlite but not fetching data in
> MySQL saying no data found.
>
>
> def post_detail(request, year, month, day, post):
> post = get_object_or_404(Post, slug=post,
>  status='published',
>  publish__year=year,
>  publish__month=month,
>  publish__day=day)
>
> return render(request,
>   'blog/post/details.html',
>   {'post': post})
>
> --
> regards
> Tribhuvan Kishor Bhaskar
>
> --
> 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/CACiphSVVyMgpNmgFj16ROZGqpohaq0fYJKV2bES4D1aVeg1LbA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>


 --


 *"It's when nothing happens that anything can happen."*
 *https://kodenaut.github.io/ **+
 254 723494571*

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

Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread officialjoemayami
I had the same issue today, but i was able to fix it. I use windows 10 too. 
Kindly follow this guide to setup your virtualenv:

Step One: This is really important to do because i really don't know what 
is the major cause of this errors but what i discovered in my time is the 
installation right from the start of python itself needs to be properly 
done. So do this uninstall everything that has to do with python, anaconda, 
any python version you have, pycharm and all the likes, also go to your 
path variable and remove any path that show python.

Step Two: Goto https://www.python.org/downloads/ and download V3.7.2 the 
latest version currently on python official website

Step 3: After download, launch the installer ensure you select Add Python 
3.6 to PATH, secondly choose customize ensure all is selected hit next

Step 4: Ensure you select the following 
   
   - Install for all users
   - Add Python to environment variables
   - Create shortcuts for installed applications
   - Recompile standard library or whatever this one is

Then hit install
Step 5: once installation is completed, launch your powershell or cmd as 
admin and type python -V and hit enter. It should output Python 3.7.2

Step 6: Ensure your powershell is run as admin then run this command 
Set-ExecutionPolicy Unrestricted, follow the instructions and select choose 
Y to update your powershell
Step 7: Follow this code:
cd ~/
mkdir Env
pip install virtualenv
pip freeze (to verify -- output will be virtualenv==version number)
cd ~/Env
mkdir environment
cd environment
virtualenv .
cd ~\Env\environment
.\Scripts\activate

Gotten here nice work! just try pip freeze (would not returning anything at 
this point, this confirm your virtualevn is working fine.)
Having Challenge installing django, hola me

On Thursday, January 17, 2019 at 8:18:35 PM UTC+1, Django Geek Aditya wrote:
>
> Shell Output after entering command is
> PS E:\todo> . \Scripts\activate
> . : The term '\Scripts\activate' is not recognized as the name of a 
> cmdlet, function, script file, or operable
> program. Check the spelling of the name, or if a path was included, verify 
> that the path is correct and try again.
> At line:1 char:3
> + . \Scripts\activate
> +   ~
> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String) 
> [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> PS E:\todo>
>
>

-- 
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/32c3f877-be36-4fc4-8915-18a727803326%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread J . Pablo Martín Cobos
Hi another time,

I am tring to reply every people in this email:

Josh

I was not using django.template.loaders.cached.Loader, but the result are
very similar i.e:

App Template Num templates rendered before unify Num templates rendered
after unify AVG Time render template before unify (ms) AVG Time render
template after unify (ms)
Django admin admin/index.html 3 1 80 70
Django constance admin/constance/change_list.html 7 1 330 180
Django su su/login.html 5 3 10 5

Pavlos:

   1. Yes, I wrote this email to contribute another time. Actually I am
   already Django contributor[1][2]
   2. I didn't share my code, because it is not a nice code. *For me it is
   a teoric question. I don't want anybody have a bad opinion of this proposal
   for the implementation*. But I am sharing [3] it without problems, but
   please I know this solution is incomplete for many reason.
   3. About your question: "I am not sure I understood anything so far. Are
   you just pre-rendering {% include %} tags, so the template engine doesn't
   have to do that in runtime?" Yes :-)
   4. About it: "I think what you did is addressed more neatly with the
   django.template.loaders.cached.Loader, as Josh Smeaton mentioned." and
   "Experimenting like this, even if you end up rediscovering something that
   exists" It is something different than django cache loader, of course I
   know django cache loader, I fixed a problem with django cached loader [4]
   five years ago :-). With django cache loader, we get django get a template
   quickly. But If your view finally render 3 templates, django cached loader
   will have to get 3 templates (from cache). With my proposal your view
   render only 1 template (This is not 100% true, 1 + templates about
   templatetags except extends and include)

Jani:

Currently you only need move the new template result to the old path of the
template. But it is only because I want. If you change this line [5] for
this other you don't need any change:

destination_name = template.origin.name


8 years ago I requested a feature related with templates, now I have a new
request :-) 8 years ago I tried resolved my proposal, now I only want
propose something :-D

I think in this change for Django :-)


REF's

1.
https://github.com/django/django/pulls?q=is%3Apr+author%3Agoinnn+is%3Aclosed
2.
https://code.djangoproject.com/query?status=assigned&status=closed&status=new&reporter=~pmartin&col=id&col=summary&col=status&col=owner&col=type&col=component&col=version&desc=1&order=id
3. https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6 (tested
in Django 1.8 - 1.11)
4.
https://github.com/django/django/pull/1936/commits/e669bca5c8fe6d13ea745d338203cd9e7470ae6b
5.
https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6#file-unify_templates-py-L58
6. https://code.djangoproject.com/ticket/15053


Best,


El vie., 18 ene. 2019 a las 14:11, Jani Tiainen ()
escribió:

> Hi.
>
> Does this require changes to django internals or can it work as an
> external package?
>
> Also you should release it as a package so people can start using it, also
> preferably releasing it with BSD license like Django itself is. Otherwise
> there are very little chances that your solution would make to django it
> self.
>
> Improvements to rendering are always welcome, but they must come without
> too much maintenance burden.
>
> On Thu, Jan 17, 2019 at 11:02 AM J. Pablo Martín Cobos 
> wrote:
>
>> Hi,
>>
>> From one year ago, I am using an own command for Django templates that
>> unify them. With an example it is easy to see. If I am to render for
>> example a template call news.html like it:
>>
>> 1. news.html
>>
>> {% extends "base.html" %}
>>
>> {% block title %}
>> {% include "inc.news.title.html" %}
>> {% endblock %}
>>
>> {% block content %}
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> {% endblock %}
>>
>> 2. base.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> {% block title %}{% endblock %}
>> 
>> 
>> {% block content %}{% endblock %}
>> 
>> 
>>
>> 3. inc.news.title.html
>> News
>>
>> With this command I preproces every template of a settings variable and I
>> get something like this:
>>
>> news.unify.html
>>
>> > http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>> http://www.w3.org/1999/xhtml"; lang="{{
>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>> %}>
>> 
>> News
>> 
>> 
>> {% for news_item in news %}
>> {{ news_item.title }}
>> {{ news_item.subtitle }}
>> {% endfor %}
>> 
>> 
>>
>> So I have a two improves:
>>
>>1. It is more 

RE: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Matthew Pava
I would switch over to pipenv and leave the details to that.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of officialjoemay...@gmail.com
Sent: Friday, January 18, 2019 8:04 AM
To: Django users
Subject: Re: problem in activating virtual environment in Django with ". 
\Scripts\activate" command

I had the same issue today, but i was able to fix it. I use windows 10 too. 
Kindly follow this guide to setup your virtualenv:

Step One: This is really important to do because i really don't know what is 
the major cause of this errors but what i discovered in my time is the 
installation right from the start of python itself needs to be properly done. 
So do this uninstall everything that has to do with python, anaconda, any 
python version you have, pycharm and all the likes, also go to your path 
variable and remove any path that show python.

Step Two: Goto https://www.python.org/downloads/ and download V3.7.2 the latest 
version currently on python official website

Step 3: After download, launch the installer ensure you select Add Python 3.6 
to PATH, secondly choose customize ensure all is selected hit next

Step 4: Ensure you select the following

  *   Install for all users
  *   Add Python to environment variables
  *   Create shortcuts for installed applications
  *   Recompile standard library or whatever this one is
Then hit install
Step 5: once installation is completed, launch your powershell or cmd as admin 
and type python -V and hit enter. It should output Python 3.7.2

Step 6: Ensure your powershell is run as admin then run this command 
Set-ExecutionPolicy Unrestricted, follow the instructions and select choose Y 
to update your powershell
Step 7: Follow this code:
cd ~/
mkdir Env
pip install virtualenv
pip freeze (to verify -- output will be virtualenv==version number)
cd ~/Env
mkdir environment
cd environment
virtualenv .
cd ~\Env\environment
.\Scripts\activate

Gotten here nice work! just try pip freeze (would not returning anything at 
this point, this confirm your virtualevn is working fine.)
Having Challenge installing django, hola me

On Thursday, January 17, 2019 at 8:18:35 PM UTC+1, Django Geek Aditya wrote:
Shell Output after entering command is
PS E:\todo> . \Scripts\activate
. : The term '\Scripts\activate' is not recognized as the name of a cmdlet, 
function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that 
the path is correct and try again.
At line:1 char:3
+ . \Scripts\activate
+   ~
+ CategoryInfo  : ObjectNotFound: (\Scripts\activate:String) [], 
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

PS E:\todo>

--
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/32c3f877-be36-4fc4-8915-18a727803326%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/d0fcde0c2b584c5190e30d00e15aa61d%40iss2.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread Kuber Sodari
Okay, I see your problem is that you are doing it the wrong way.
Go to the path where you have your virtual environment folder such as 
*cd C:\Python_project\project_name\*
if we suppose I have a virtual environment with a directory as '*venv*' 
created inside my project directory *'project_name'* and then to activate 
this virtual environment, I would do
*venv\Scripts\activate [ENTER]*
Doing this should resolve your problem

On Friday, 18 January 2019 01:03:35 UTC+5:45, Django Geek Aditya wrote:
>
> Shell Output after entering command is
> PS E:\todo> . \Scripts\activate
> . : The term '\Scripts\activate' is not recognized as the name of a 
> cmdlet, function, script file, or operable
> program. Check the spelling of the name, or if a path was included, verify 
> that the path is correct and try again.
> At line:1 char:3
> + . \Scripts\activate
> +   ~
> + CategoryInfo  : ObjectNotFound: (\Scripts\activate:String) 
> [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> PS E:\todo>
>
>

-- 
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/e824da71-0031-4935-81dd-51d79e8cea41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Python] How to get list of Classes and etc in a py file or Module ?

2019-01-18 Thread regtech
Hello, I wanna get the list of Classes and other definitions in a python file,
I tried :
dir( __package__ )
it returns some string,

but not get what i needing.
Some help me?

Thank u!

-- 
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/tencent_71C36A1B9ED665D1802FCC9F6951726CE209%40qq.com.
For more options, visit https://groups.google.com/d/optout.


Adding default rows to Django admin inlines

2019-01-18 Thread Kevin Olbrich
Hi!

I have a question regarding inlines in the Django admin interface.

Currently there are following models:
Jobs - holds the Job-ID, an action (FK JobActions) and execution status
JobActions - holds a list of possible actions (like "create a new 
customer") [Also has a ManyToMany against JobAttributes - see below]
JobAttributes - A list of attributes that are possible
JobOptions - values for attributes (FK JobAttributes) for a job (FK Jobs)
JobLog - unlimited rows of text-logs (in this case, API dumps), FK Jobs 
(not of interest here)

An action can be "add new customer". This action needs an attribute 
"customer name".

This scenario works perfectly, I can create new Jobs that have attributes 
but I need to add new lines in the inline part of the admin form.
I have added a ManyToMany-field from JobActions to JobAttributes. This 
gives me a list which action needs which attribute in JobAttributes.

Is it possbile to pre-fill the inline-part of the form with the attributes? 
This would be much easier for input.
Currently there are no rows, I need to add a new line and choose the 
attribute for which I would like to add a value.

*Think of it like a dynamic (support) contact form where you get different 
inputs if you choose a different topic.*

Is this possible with the admin? The relation (which JobActions needs which 
JobAttributes) is available.

Thank you very much.

Kevin

-- 
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/228a7f0e-e492-41b1-bc44-04cdff63127b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread J . Pablo Martín Cobos
Sorry, I reply beetween lines

El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
escribió:

> Hi another time,
>
> I am tring to reply every people in this email:
>
> Josh
>
> I was not using django.template.loaders.cached.Loader, but the result are
> very similar i.e:
>
> App Template Num templates rendered before unify Num templates rendered
> after unify AVG Time render template before unify (ms) AVG Time render
> template after unify (ms)
> Django admin admin/index.html 3 1 80 70
> Django constance admin/constance/change_list.html 7 1 330 180
> Django su su/login.html 5 3 10 5
>
> Pavlos:
>
>1. Yes, I wrote this email to contribute another time. Actually I am
>already Django contributor[1][2]
>2. I didn't share my code, because it is not a nice code. *For me it
>is a teoric question. I don't want anybody have a bad opinion of this
>proposal for the implementation*. But I am sharing [3] it without
>problems, but please I know this solution is incomplete for many reason.
>3. About your question: "I am not sure I understood anything so far.
>Are you just pre-rendering {% include %} tags, so the template engine
>doesn't have to do that in runtime?" Yes :-)
>4. About it: "I think what you did is addressed more neatly with the
>django.template.loaders.cached.Loader, as Josh Smeaton mentioned." and
>"Experimenting like this, even if you end up rediscovering something that
>exists" It is something different than django cache loader, of course I
>know django cache loader, I fixed a problem with django cached loader [4]
>five years ago :-). With django cache loader, we get django get a template
>quickly. But If your view finally render 3 templates, django cached loader
>will have to get 3 templates (from cache). With my proposal your view
>render only 1 template (This is not 100% true, 1 + templates about
>templatetags except extends and include)
>
> Jani:
>
> Currently you only need move the new template result to the old path of
> the template. But it is only because I want. If you change this line [5]
> for this other you don't need any change:
>
> destination_name = template.origin.name
>
>
> 8 years ago I requested a feature related with templates
>

[6]


, now I have a new request :-) 8 years ago I tried resolved my proposal,
> now I only want propose something :-D
>
> I think in this change for Django :-)
>
>
> REF's
>
> 1.
> https://github.com/django/django/pulls?q=is%3Apr+author%3Agoinnn+is%3Aclosed
> 2.
> https://code.djangoproject.com/query?status=assigned&status=closed&status=new&reporter=~pmartin&col=id&col=summary&col=status&col=owner&col=type&col=component&col=version&desc=1&order=id
> 3. https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6
> (tested in Django 1.8 - 1.11)
> 4.
> https://github.com/django/django/pull/1936/commits/e669bca5c8fe6d13ea745d338203cd9e7470ae6b
> 5.
> https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6#file-unify_templates-py-L58
> 6. https://code.djangoproject.com/ticket/15053
>
>
> Best,
>
>
> El vie., 18 ene. 2019 a las 14:11, Jani Tiainen ()
> escribió:
>
>> Hi.
>>
>> Does this require changes to django internals or can it work as an
>> external package?
>>
>> Also you should release it as a package so people can start using it,
>> also preferably releasing it with BSD license like Django itself is.
>> Otherwise there are very little chances that your solution would make to
>> django it self.
>>
>> Improvements to rendering are always welcome, but they must come without
>> too much maintenance burden.
>>
>> On Thu, Jan 17, 2019 at 11:02 AM J. Pablo Martín Cobos 
>> wrote:
>>
>>> Hi,
>>>
>>> From one year ago, I am using an own command for Django templates that
>>> unify them. With an example it is easy to see. If I am to render for
>>> example a template call news.html like it:
>>>
>>> 1. news.html
>>>
>>> {% extends "base.html" %}
>>>
>>> {% block title %}
>>> {% include "inc.news.title.html" %}
>>> {% endblock %}
>>>
>>> {% block content %}
>>> {% for news_item in news %}
>>> {{ news_item.title }}
>>> {{ news_item.subtitle }}
>>> {% endfor %}
>>> {% endblock %}
>>>
>>> 2. base.html
>>>
>>> >> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>> http://www.w3.org/1999/xhtml"; lang="{{
>>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
>>> %}>
>>> 
>>> {% block title %}{% endblock %}
>>> 
>>> 
>>> {% block content %}{% endblock %}
>>> 
>>> 
>>>
>>> 3. inc.news.title.html
>>> News
>>>
>>> With this command I preproces every template of a settings variable and
>>> I get something like this:
>>>
>>> news.unify.html
>>>
>>> >> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>> http://www.w3.org/1999/xhtml"; lang="{{
>>> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endi

Re: problem in activating virtual environment in Django with ". \Scripts\activate" command

2019-01-18 Thread 'hadi tedi' via Django users
I had similar problem before.

try 
"cd " until you reach the directory of "scripts" then type "activate".
same thing to deactivate.

 Hadi



On Friday, 18 January 2019 12:46:03 UTC, Django Geek Aditya wrote:
>
> .\scripts\activate.bat is also not working
>>
>> THE SHELL OUTPUT IS -> 
> PS E:\todo> .\Scripts\activate.bat
> .\Scripts\activate.bat : The term '.\Scripts\activate.bat' is not 
> recognized as the name of a cmdlet, function, script
> file, or operable program. Check the spelling of the name, or if a path 
> was included, verify that the path is correct
> and try again.
> At line:1 char:1
> + .\Scripts\activate.bat
> + ~~
> + CategoryInfo  : ObjectNotFound: 
> (.\Scripts\activate.bat:String) [], CommandNotFoundException
> + FullyQualifiedErrorId : CommandNotFoundException
>
> PS E:\todo> 
>

-- 
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/f2941ea9-942e-426a-9c10-cddf83ce0341%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How does the django sites work

2019-01-18 Thread abel otugeme
I am still learning django but I'd like to know how sites created are hosted 

-- 
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/f11c1c73-bfdb-46dd-b493-5125e6ecef91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How does the django sites work

2019-01-18 Thread Gear Crew

what's your specific problem you are talk about Deploy site ??? 
On Friday, 18 January 2019 22:10:42 UTC+2, abel otugeme wrote:
>
> I am still learning django but I'd like to know how sites created are 
> hosted 

-- 
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/021f9879-80e4-49fa-86d4-41a39ec40f38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How does the django sites work

2019-01-18 Thread Peter van der Does
On 1/18/19 3:10 PM, abel otugeme wrote:
> I am still learning django but I'd like to know how sites created are hosted 
>
Google is your friend:

https://www.google.com/search?q=how+to+host+django+website

-- 
*Peter van der Does
o: ***410-584-2500
m: 732-425-3102
*ONeil Interactive, Inc *
oneilinteractive.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/cc1fba86-e404-6842-b721-0336b88464b7%40oneilinteractive.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread Jani Tiainen
Hi,

Lets try this again.

Your system could be nice if it really helps rendering speed.

But does it require changes in Django core itself, or is it completely
standalone package that doesn't require changing Django itself to operate?
If it requires changes in Django itself, it would be useful to describe
what changes are needed and why.

Note that you can even no build custom rendering engines since Django
supports those now (with default implementations for Django Templating
Language and Jinja2) your system actually might fall in this category.

Even code is bad you really need to start get some momentum for your
system. Otherwise it's really hard to provide any feedback for example
there might be some edgecases you might not have thought of.


On Fri, Jan 18, 2019 at 7:23 PM J. Pablo Martín Cobos 
wrote:

> Sorry, I reply beetween lines
>
> El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
> escribió:
>
>> Hi another time,
>>
>> I am tring to reply every people in this email:
>>
>> Josh
>>
>> I was not using django.template.loaders.cached.Loader, but the result are
>> very similar i.e:
>>
>> App Template Num templates rendered before unify Num templates rendered
>> after unify AVG Time render template before unify (ms) AVG Time render
>> template after unify (ms)
>> Django admin admin/index.html 3 1 80 70
>> Django constance admin/constance/change_list.html 7 1 330 180
>> Django su su/login.html 5 3 10 5
>>
>> Pavlos:
>>
>>1. Yes, I wrote this email to contribute another time. Actually I am
>>already Django contributor[1][2]
>>2. I didn't share my code, because it is not a nice code. *For me it
>>is a teoric question. I don't want anybody have a bad opinion of this
>>proposal for the implementation*. But I am sharing [3] it without
>>problems, but please I know this solution is incomplete for many reason.
>>3. About your question: "I am not sure I understood anything so far.
>>Are you just pre-rendering {% include %} tags, so the template engine
>>doesn't have to do that in runtime?" Yes :-)
>>4. About it: "I think what you did is addressed more neatly with the
>>django.template.loaders.cached.Loader, as Josh Smeaton mentioned." and
>>"Experimenting like this, even if you end up rediscovering something that
>>exists" It is something different than django cache loader, of course I
>>know django cache loader, I fixed a problem with django cached loader [4]
>>five years ago :-). With django cache loader, we get django get a template
>>quickly. But If your view finally render 3 templates, django cached loader
>>will have to get 3 templates (from cache). With my proposal your view
>>render only 1 template (This is not 100% true, 1 + templates about
>>templatetags except extends and include)
>>
>> Jani:
>>
>> Currently you only need move the new template result to the old path of
>> the template. But it is only because I want. If you change this line [5]
>> for this other you don't need any change:
>>
>> destination_name = template.origin.name
>>
>>
>> 8 years ago I requested a feature related with templates
>>
>
> [6]
>
>
> , now I have a new request :-) 8 years ago I tried resolved my proposal,
>> now I only want propose something :-D
>>
>> I think in this change for Django :-)
>>
>>
>> REF's
>>
>> 1.
>> https://github.com/django/django/pulls?q=is%3Apr+author%3Agoinnn+is%3Aclosed
>> 2.
>> https://code.djangoproject.com/query?status=assigned&status=closed&status=new&reporter=~pmartin&col=id&col=summary&col=status&col=owner&col=type&col=component&col=version&desc=1&order=id
>> 3. https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6
>> (tested in Django 1.8 - 1.11)
>> 4.
>> https://github.com/django/django/pull/1936/commits/e669bca5c8fe6d13ea745d338203cd9e7470ae6b
>> 5.
>> https://gist.github.com/goinnn/8a42314fccdd13bcf4df256a277ec1f6#file-unify_templates-py-L58
>> 6. https://code.djangoproject.com/ticket/15053
>>
>>
>> Best,
>>
>>
>> El vie., 18 ene. 2019 a las 14:11, Jani Tiainen ()
>> escribió:
>>
>>> Hi.
>>>
>>> Does this require changes to django internals or can it work as an
>>> external package?
>>>
>>> Also you should release it as a package so people can start using it,
>>> also preferably releasing it with BSD license like Django itself is.
>>> Otherwise there are very little chances that your solution would make to
>>> django it self.
>>>
>>> Improvements to rendering are always welcome, but they must come without
>>> too much maintenance burden.
>>>
>>> On Thu, Jan 17, 2019 at 11:02 AM J. Pablo Martín Cobos 
>>> wrote:
>>>
 Hi,

 From one year ago, I am using an own command for Django templates that
 unify them. With an example it is easy to see. If I am to render for
 example a template call news.html like it:

 1. news.html

 {% extends "base.html" %}

 {% block title %}
 {% include "inc.news.title.html" %}
 {% endblock %}

   

Re: How does the django sites work

2019-01-18 Thread Gear Crew
when you learn automatic you know how does work and try read book is better 
than some videos because the it's not talk in details and so important 
learn form DOC Django  

On Friday, 18 January 2019 22:10:42 UTC+2, abel otugeme wrote:
>
> I am still learning django but I'd like to know how sites created are 
> hosted 

-- 
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/3b5bc960-7494-4fec-9721-1ddf387cabcf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread J . Pablo Martín Cobos
I reply beetween lines,

El vie., 18 ene. 2019 a las 21:25, Jani Tiainen ()
escribió:

> Hi,
>
> Lets try this again.
>
> Your system could be nice if it really helps rendering speed.
>

Yes we get several miliseconds per request.


>
> But does it require changes in Django core itself, or is it completely
> standalone package that doesn't require changing Django itself to operate?
> If it requires changes in Django itself, it would be useful to describe
> what changes are needed and why.
>
>
You don't need any change in Django. This command generates a new template.
I paste another time my first example:

1. news.html

{% extends "base.html" %}

{% block title %}
{% include "inc.news.title.html" %}
{% endblock %}

{% block content %}
{% for news_item in news %}
{{ news_item.title }}
{{ news_item.subtitle }}
{% endfor %}
{% endblock %}

2. base.html

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; lang="{{
LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
%}>

{% block title %}{% endblock %}


{% block content %}{% endblock %}



3. inc.news.title.html
News

With this command I preprocess every template of a settings variable and I
get something like this:

news.unify.html (or if you want the command can overwrite news.html)

http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; lang="{{
LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
%}>

News


{% for news_item in news %}
{{ news_item.title }}
{{ news_item.subtitle }}
{% endfor %}



It is only a preprocess to get time for each request.

Note that you can even no build custom rendering engines since Django
> supports those now (with default implementations for Django Templating
> Language and Jinja2) your system actually might fall in this category.
>
>
No, It is not a new render engine. It would be a pre render engine. It is a
new feature.


> Even code is bad you really need to start get some momentum for your
> system. Otherwise it's really hard to provide any feedback for example
> there might be some edgecases you might not have thought of.
>

I want to know if this is a nice feature for Django community, then I will
create a ticket... and if nobody resolve it I will propose a change, but I
know ifor experience it is very hard collaborate with code in Django, and
more difficult with a new feature.

To understand it, the best is to use the command with a simple template
such as admin/index.html.

Best,


>
> On Fri, Jan 18, 2019 at 7:23 PM J. Pablo Martín Cobos 
> wrote:
>
>> Sorry, I reply beetween lines
>>
>> El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
>> escribió:
>>
>>> Hi another time,
>>>
>>> I am tring to reply every people in this email:
>>>
>>> Josh
>>>
>>> I was not using django.template.loaders.cached.Loader, but the result
>>> are very similar i.e:
>>>
>>> App Template Num templates rendered before unify Num templates rendered
>>> after unify AVG Time render template before unify (ms) AVG Time render
>>> template after unify (ms)
>>> Django admin admin/index.html 3 1 80 70
>>> Django constance admin/constance/change_list.html 7 1 330 180
>>> Django su su/login.html 5 3 10 5
>>>
>>> Pavlos:
>>>
>>>1. Yes, I wrote this email to contribute another time. Actually I am
>>>already Django contributor[1][2]
>>>2. I didn't share my code, because it is not a nice code. *For me it
>>>is a teoric question. I don't want anybody have a bad opinion of this
>>>proposal for the implementation*. But I am sharing [3] it without
>>>problems, but please I know this solution is incomplete for many reason.
>>>3. About your question: "I am not sure I understood anything so far.
>>>Are you just pre-rendering {% include %} tags, so the template engine
>>>doesn't have to do that in runtime?" Yes :-)
>>>4. About it: "I think what you did is addressed more neatly with the
>>>django.template.loaders.cached.Loader, as Josh Smeaton mentioned." and
>>>"Experimenting like this, even if you end up rediscovering something that
>>>exists" It is something different than django cache loader, of course I
>>>know django cache loader, I fixed a problem with django cached loader [4]
>>>five years ago :-). With django cache loader, we get django get a 
>>> template
>>>quickly. But If your view finally render 3 templates, django cached 
>>> loader
>>>will have to get 3 templates (from cache). With my proposal your view
>>>render only 1 template (This is not 100% true, 1 + templates about
>>>templatetags except extends and include)
>>>
>>> Jani:
>>>
>>> Currently you only need move the new template result to the old path of
>>> the template

Need tutorials

2019-01-18 Thread Madhav Rajmohan

Guys,
   I've Heard that django helps you create  something that is 
mesmerizing form your mind and I've heard that you guys can help me bring 
up my basics.I Am just a Beginner and I Need your help


 -Madhav Rajmohan

-- 
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/87f8f462-2fc6-4d68-8170-e8f98871a2e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Need tutorials

2019-01-18 Thread Ansh Srivastava
Yes, @Madhav Django is damn awesome! and you're at the legitimate place.
Since you're a beginner, I can guide you from the beginning and believe me,
it's super easy. I have a channel on youtube name "Gettin' basics done in
Django". You can roll up from there.
Youtube link:-
https://www.youtube.com/watch?v=65FgkqnCa_0&list=PLzsJLGgl2jTU88flX2lCrSyWQPCGLOxmM
Intimate me for any further query.



[image: Mailtrack]

Sender
notified by
Mailtrack

19/01/19,
10:15:51

On Sat, Jan 19, 2019 at 9:08 AM Madhav Rajmohan 
wrote:

>
> Guys,
>I've Heard that django helps you create  something that is
> mesmerizing form your mind and I've heard that you guys can help me bring
> up my basics.I Am just a Beginner and I Need your help
>
>
>  -Madhav Rajmohan
>
> --
> 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/87f8f462-2fc6-4d68-8170-e8f98871a2e3%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/CAHMQ532-RG-jHa%2BGLGnqM_a1La17WhyxCuNY24QBR3FVFVvWvA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pip installation

2019-01-18 Thread Ansh Srivastava
Check out this tutorial:-
https://www.youtube.com/watch?v=RDO8aXycs9w&index=2&list=PLzsJLGgl2jTU88flX2lCrSyWQPCGLOxmM



[image: Mailtrack]

Sender
notified by
Mailtrack

19/01/19,
10:49:44

On Sun, Jan 13, 2019 at 2:48 PM 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:

> Hello Kidwell,
>
> Did you receive any message by chance that says "
>
> "You are using pip version x.x.x, however version x.x.x is available.
> You should consider upgrading via the 'python -m pip install --upgrade pip' 
> command"
>
> "?
> where x = version of the existing pip version on your machine and the
> version on which the error is asking you to update to.
>
> Regards,
> Amitesh Sahay
> *91-750 797 8619*
>
>
> On Saturday, 12 January, 2019, 6:14:55 PM IST, Kidwell Nyatsambo <
> knyatsa...@gmail.com> wrote:
>
>
> Pip installation refusing to install on Windows 10.
> Coming with this message;
> [image: image.png]
>
> Please help.
> Thank you in advance
> Kidwell
>
> --
> 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/CAKdOBrj0YPCKaW7O26fBPTJwhBow5c0cF6M%2BeHwOzMHE-7bX%2BA%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/750765714.16495465.1547371117623%40mail.yahoo.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/CAHMQ530G9oasi_NzTC3fbouLdgbQ%3D9xPFfh40%3DKAVWT5a2t2Og%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What do you think about unify templates feature?

2019-01-18 Thread Jani Tiainen
Hi,

You said that this doesn't require any change in Django at all.

So this doesn't need to be in Django at all, it can survive as its own and
that way it should be.

So make your enhancement as reusable app and release it to public. Get
people to use it. Fix the bugs that appears. Write a good documentation.
Give the support.



On Sat, Jan 19, 2019 at 12:18 AM J. Pablo Martín Cobos 
wrote:

> I reply beetween lines,
>
> El vie., 18 ene. 2019 a las 21:25, Jani Tiainen ()
> escribió:
>
>> Hi,
>>
>> Lets try this again.
>>
>> Your system could be nice if it really helps rendering speed.
>>
>
> Yes we get several miliseconds per request.
>
>
>>
>> But does it require changes in Django core itself, or is it completely
>> standalone package that doesn't require changing Django itself to operate?
>> If it requires changes in Django itself, it would be useful to describe
>> what changes are needed and why.
>>
>>
> You don't need any change in Django. This command generates a new
> template. I paste another time my first example:
>
> 1. news.html
>
> {% extends "base.html" %}
>
> {% block title %}
> {% include "inc.news.title.html" %}
> {% endblock %}
>
> {% block content %}
> {% for news_item in news %}
> {{ news_item.title }}
> {{ news_item.subtitle }}
> {% endfor %}
> {% endblock %}
>
> 2. base.html
>
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml"; lang="{{
> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
> %}>
> 
> {% block title %}{% endblock %}
> 
> 
> {% block content %}{% endblock %}
> 
> 
>
> 3. inc.news.title.html
> News
>
> With this command I preprocess every template of a settings variable and I
> get something like this:
>
> news.unify.html (or if you want the command can overwrite news.html)
>
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> http://www.w3.org/1999/xhtml"; lang="{{
> LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif
> %}>
> 
> News
> 
> 
> {% for news_item in news %}
> {{ news_item.title }}
> {{ news_item.subtitle }}
> {% endfor %}
> 
> 
>
> It is only a preprocess to get time for each request.
>
> Note that you can even no build custom rendering engines since Django
>> supports those now (with default implementations for Django Templating
>> Language and Jinja2) your system actually might fall in this category.
>>
>>
> No, It is not a new render engine. It would be a pre render engine. It is
> a new feature.
>
>
>> Even code is bad you really need to start get some momentum for your
>> system. Otherwise it's really hard to provide any feedback for example
>> there might be some edgecases you might not have thought of.
>>
>
> I want to know if this is a nice feature for Django community, then I will
> create a ticket... and if nobody resolve it I will propose a change, but I
> know ifor experience it is very hard collaborate with code in Django, and
> more difficult with a new feature.
>
> To understand it, the best is to use the command with a simple template
> such as admin/index.html.
>
> Best,
>
>
>>
>> On Fri, Jan 18, 2019 at 7:23 PM J. Pablo Martín Cobos 
>> wrote:
>>
>>> Sorry, I reply beetween lines
>>>
>>> El vie., 18 ene. 2019 16:32, J. Pablo Martín Cobos 
>>> escribió:
>>>
 Hi another time,

 I am tring to reply every people in this email:

 Josh

 I was not using django.template.loaders.cached.Loader, but the result
 are very similar i.e:

 App Template Num templates rendered before unify Num templates
 rendered after unify AVG Time render template before unify (ms) AVG
 Time render template after unify (ms)
 Django admin admin/index.html 3 1 80 70
 Django constance admin/constance/change_list.html 7 1 330 180
 Django su su/login.html 5 3 10 5

 Pavlos:

1. Yes, I wrote this email to contribute another time. Actually I
am already Django contributor[1][2]
2. I didn't share my code, because it is not a nice code. *For me
it is a teoric question. I don't want anybody have a bad opinion of this
proposal for the implementation*. But I am sharing [3] it without
problems, but please I know this solution is incomplete for many reason.
3. About your question: "I am not sure I understood anything so
far. Are you just pre-rendering {% include %} tags, so the template 
 engine
doesn't have to do that in runtime?" Yes :-)
4. About it: "I think what you did is addressed more neatly with
the django.template.loaders.cached.Loader, as Josh Smeaton mentioned." 
 and
"Experimenting like this, even if you end up rediscovering something 
 that
exists" It is s