Re: Django3 runserver error

2020-07-31 Thread Kyasanku Charles Nyombi
First of all what you did was wrong. You would have kept a Django 2.2
project in its own environment and installed the new Django version in a
new environment. Another thing I would advice you is to use the latest
version of python which is 3.8.4 I think with the latest version of Django.
It works best there. To be on the safe side I would Advise you to rebuild
your django 2.2 project with Django 3.8.4 or 3.1 because a lot has changed
in these versions just fixing a single bug won’t help you will run into
another one thereafter. So just do it again.

On Thu, 30 Jul 2020 at 12:24 Mira  wrote:

> Hi All,
> I recently upgraded Django from 2.2 to 3 on my MacOS10.13.
> I am using Python 3.6 and My Application was working fine with Django 2.2
> but now i am getting below error.
>
> Any help related with this topic would be greatly appreciated.
>
> $>python3 manage.py runserver
>
> Watching for file changes with StatReloader
>
> Performing system checks...
>
>
> Traceback (most recent call last):
>
>   File "manage.py", line 22, in 
>
> execute_from_command_line(sys.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 401, in execute_from_command_line
>
> utility.execute()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
> line 395, in execute
>
> self.fetch_command(subcommand).run_from_argv(self.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 328, in run_from_argv
>
> self.execute(*args, **cmd_options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 60, in execute
>
> super().execute(*args, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
> line 369, in execute
>
> output = self.handle(*args, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 95, in handle
>
> self.run(**options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
> line 102, in run
>
> autoreload.run_with_reloader(self.inner_run, **options)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 599, in run_with_reloader
>
> start_django(reloader, main_func, *args, **kwargs)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 584, in start_django
>
> reloader.run(django_main_thread)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 299, in run
>
> self.run_loop()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 305, in run_loop
>
> next(ticker)
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 345, in tick
>
> for filepath, mtime in self.snapshot_files():
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 361, in snapshot_files
>
> for file in self.watched_files():
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 260, in watched_files
>
> yield from iter_all_python_module_files()
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 105, in iter_all_python_module_files
>
> return iter_modules_and_files(modules, frozenset(_error_files))
>
>   File
> "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
> line 141, in iter_modules_and_files
>
> resolved_path = path.resolve(strict=True).absolute()
>
> TypeError: resolve() got an unexpected keyword argument 'strict'
>
> udaysingh@udays-MacBook-Pro:~/Django/dreamProj>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAANDXNtvg9sP5OqLktcECco1MhpV0%3DcMgYCKvAF0TLXAH9bpog%40mail.gmail.com
> 
> .
>
-- 
null

-- 
You received this me

Re: Django3 runserver error

2020-07-31 Thread RANGA BHARATH JINKA
from django.db import models
from django.contrib.auth.models import User

class Customer(models.Model):
user=models.OneToOneField(User,null=True,on_delete= models.CASCADE)
name=models.CharField(max_length=200,null=True)
phone=models.CharField(max_length=200,null=True)
email=models.CharField(max_length=200,null=True)
profile_pic = models.ImageField(default="radha3.png", null=True, blank=True)
date_created=models.DateTimeField(auto_now_add=True,null=True)
def __str__(self):
return str(self.name)

class Tag(models.Model):
name=models.CharField(max_length=200,null=True)
def __str__(self):
return str(self.name)


class Product(models.Model):
CATEGORY=(
('In door','In door'),
('Out door','Out door'),
)
name=models.CharField(max_length=100,null=True)
price=models.FloatField(null=True)
category = models.CharField(max_length=200, null=True,choices=CATEGORY)
description = models.CharField(max_length=200,null=True,blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
tags=models.ManyToManyField(Tag)

def __str__(self):
return str(self.name)



class Order(models.Model):
STATUS = (
('Pending', 'Pending'),
('Out for delivery', 'Out for delivery'),
('Delivered', 'Delivered'),
)
customer = models.ForeignKey(Customer, null=True, on_delete=models.SET_NULL)
product = models.ForeignKey(Product, null=True, on_delete=models.SET_NULL)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True, choices=STATUS)
note = models.CharField(max_length=1000, null=True)

def __str__(self):
return str(self.product.name)


Try this and let me know whether it is working or not. I added str()
to the __str__. All the best


On Fri, Jul 31, 2020 at 7:17 PM ROHINI PUNDE  wrote:

> from django.db import models
> from django.contrib.auth.models import User
>
> class Customer(models.Model):
> user=models.OneToOneField(User,null=True,on_delete= models.CASCADE)
> name=models.CharField(max_length=200,null=True)
> phone=models.CharField(max_length=200,null=True)
> email=models.CharField(max_length=200,null=True)
> profile_pic = models.ImageField(default="radha3.png", null=True, 
> blank=True)
> date_created=models.DateTimeField(auto_now_add=True,null=True)
> def __str__(self):
> return self.name
>
> class Tag(models.Model):
> name=models.CharField(max_length=200,null=True)
> def __str__(self):
> return self.name
>
> class Product(models.Model):
> CATEGORY=(
> ('In door','In door'),
> ('Out door','Out door'),
> )
> name=models.CharField(max_length=100,null=True)
> price=models.FloatField(null=True)
> category = models.CharField(max_length=200, null=True,choices=CATEGORY)
> description = models.CharField(max_length=200,null=True,blank=True)
> date_created = models.DateTimeField(auto_now_add=True, null=True)
> tags=models.ManyToManyField(Tag)
>
> def __str__(self):
> return self.name
>
>
> class Order(models.Model):
> STATUS = (
> ('Pending', 'Pending'),
> ('Out for delivery', 'Out for delivery'),
> ('Delivered', 'Delivered'),
> )
> customer = models.ForeignKey(Customer, null=True, 
> on_delete=models.SET_NULL)
> product = models.ForeignKey(Product, null=True, on_delete=models.SET_NULL)
> date_created = models.DateTimeField(auto_now_add=True, null=True)
> status = models.CharField(max_length=200, null=True, choices=STATUS)
> note = models.CharField(max_length=1000, null=True)
>
> def __str__(self):
> return self.product.name
>
>
>
> On Thu, Jul 30, 2020 at 7:41 PM RANGA BHARATH JINKA <
> bharathjink...@gmail.com> wrote:
>
>> Send your models.py file
>>
>> On Fri, 31 Jul 2020, 8:09 am RANGA BHARATH JINKA, <
>> bharathjink...@gmail.com> wrote:
>>
>>> Hi convert it into string while displaying it in models __str__.
>>> Or use f-strings. It is easy. All the best 👍
>>>
>>> On Thu, 30 Jul 2020, 8:29 pm ROHINI PUNDE, 
>>> wrote:
>>>
 I have error while updating the information,so many trials I cant solve
 this problem,so please help me for this


 On Thu, Jul 30, 2020 at 2:25 AM Mira  wrote:

> Hi All,
> I recently upgraded Django from 2.2 to 3 on my MacOS10.13.
> I am using Python 3.6 and My Application was working fine with Django
> 2.2 but now i am getting below error.
>
> Any help related with this topic would be greatly appreciated.
>
> $>python3 manage.py runserver
>
> Watching for file changes with StatReloader
>
> Performing system checks...
>
>
> Traceback (most recent call last):
>
>   File "manage.py", line 22, in 
>
> execute_from_command_line(sys.argv)
>
>   File
> "/Library/Frameworks/Python.framework/Versi

Re: "pytest --doctests-modules" AlreadyRegistered error

2020-07-31 Thread Dave R
I figured this out.  I'm using Cookiecutter-Django, which puts a 
__init__.py for whatever reason in the root directory and this confuses 
pytest.  If you delete this __init__.py, everything works fine.


On Friday, July 31, 2020 at 8:53:39 PM UTC-4 Dave R wrote:

> I am using doctests via pytest with the command "pytest 
> --doctest-modules".  Unfortunately, I keep getting the following error.  
> I've already attached a screenshot.  Does anyone understand what's causing 
> and how to address it?  Thanks!
>
>
> == ERRORS 
> ===
> __ ERROR collecting main/admin.py 
> ___
> main\admin.py:25: in 
> admin.site.register(PoolType, PoolTypeAdmin)
> ..\..\..\.virtualenvs\mysite\lib\site-packages\django\contrib\admin\sites.py:109:
>  
> in register
> raise AlreadyRegistered('The model %s is already registered' % 
> model.__name__)
> E   django.contrib.admin.sites.AlreadyRegistered: The model PoolType is 
> already registered
> __ ERROR collecting main/models.py 
> __
> main\models.py:36: in 
> class PoolType(models.Model):
> ..\..\..\.virtualenvs\mysite\lib\site-packages\django\db\models\base.py:111: 
> in __new__
> "INSTALLED_APPS." % (module, name)
> E   RuntimeError: Model class mysite.main.models.PoolType doesn't declare 
> an explicit app_label and isn't in an application in INSTALLED_APPS.
> == short test summary info 
> ==
> ERROR main/admin.py - django.contrib.admin.sites.AlreadyRegistered: The 
> model PoolType is already r...
> ERROR main/models.py - RuntimeError: Model class 
> mysite.main.models.PoolType doesn't declare an ...
> !! Interrupted: 2 errors during collection 
> !!
> = 2 errors in 0.62s 
> =
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20130c53-87af-4561-8309-1f4b2bef7853n%40googlegroups.com.


"pytest --doctests-modules" AlreadyRegistered error

2020-07-31 Thread Dave R
I am using doctests via pytest with the command "pytest 
--doctest-modules".  Unfortunately, I keep getting the following error.  
I've already attached a screenshot.  Does anyone understand what's causing 
and how to address it?  Thanks!


== ERRORS 
===
__ ERROR collecting main/admin.py 
___
main\admin.py:25: in 
admin.site.register(PoolType, PoolTypeAdmin)
..\..\..\.virtualenvs\mysite\lib\site-packages\django\contrib\admin\sites.py:109:
 
in register
raise AlreadyRegistered('The model %s is already registered' % 
model.__name__)
E   django.contrib.admin.sites.AlreadyRegistered: The model PoolType is 
already registered
__ ERROR collecting main/models.py 
__
main\models.py:36: in 
class PoolType(models.Model):
..\..\..\.virtualenvs\mysite\lib\site-packages\django\db\models\base.py:111: 
in __new__
"INSTALLED_APPS." % (module, name)
E   RuntimeError: Model class mysite.main.models.PoolType doesn't declare 
an explicit app_label and isn't in an application in INSTALLED_APPS.
== short test summary info 
==
ERROR main/admin.py - django.contrib.admin.sites.AlreadyRegistered: The 
model PoolType is already r...
ERROR main/models.py - RuntimeError: Model class 
mysite.main.models.PoolType doesn't declare an ...
!! Interrupted: 2 errors during collection 
!!
= 2 errors in 0.62s 
=

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3acb7334-e158-4c83-af7c-35a55a2d9afan%40googlegroups.com.


Re: IntegrityError: null value in column "user_id" violates not-null constraint

2020-07-31 Thread Sunday Iyanu Ajayi
You will need to login into the database admin page ( maybe pgadmin ) to
update the user_id . From your model, user_id  can't be null
*AJAYI Sunday *
(+234) 806 771 5394
*sunnexaj...@gmail.com *



On Thu, Jul 30, 2020 at 11:58 AM Dinolin yp job 
wrote:

>
>
> It worked but the user_id in uploads_upload is empty. How can I can make
> that work?
> On Thursday, July 30, 2020 at 3:31:21 PM UTC+5:30 obast...@gmail.com
> wrote:
>
>> From the error, it states that you are trying to add an upload object to
>> the database without a user. And from your model.py, the User foreign key
>> does not have a null=True, and blank=True. So you can't save a null value
>> for that user field.
>>
>> On Thu, Jul 30, 2020 at 10:52 AM Dinolin yp job 
>> wrote:
>>
>>> I'm trying to save image in postgres database. I have upload model which
>>> has a foreign key reference to the extended custom user model. But it shows
>>> the following error
>>>
>>>
>>> uploads/model.py
>>> from django.db import models
>>> from django.contrib.auth import get_user_model
>>>
>>> User = get_user_model()
>>>
>>> class Upload(models.Model):
>>> upload_file = models.ImageField(upload_to='uploads/')
>>> upload_date = models.DateTimeField(auto_now_add =True)
>>> user = models.ForeignKey(User, on_delete=models.CASCADE)
>>>
>>>
>>> What am I missing? Thanks in advance
>>>
>>> --
>>> 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 view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/bddd1f92-895c-4e23-8f08-976c0f178f17o%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/57100db3-81b7-49ca-86e6-096c121c94c8n%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKYSAw0noinV2U%2BBCYCEc_dSbYxY7RFLwyrKKpxQWqy%2BfuW%2BNA%40mail.gmail.com.


Re: Streaming Data

2020-07-31 Thread Dylan Reinhold
You can use the StreamingHttpResponse:
https://docs.djangoproject.com/en/3.0/ref/request-response/#streaminghttpresponse-objects


Dylan

On Fri, Jul 31, 2020 at 6:46 AM Venu Gopal  wrote:

> Hi, I have an urgent requirement where I need to stream data from Motion
> JPG to Django template. This solution is already there in Flask Reference:
> https://blog.miguelgrinberg.com/post/video-streaming-with-flask. Is there
> any way to do it in Django.
>
> Thanks in advance.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4f598b93-0e64-4162-b620-b9b4eb569870o%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHtg44ATLpyfknk%2BNMKO2eMa6hiaypOKmQ%2BLgoDkQwUQETcm%3DQ%40mail.gmail.com.


Celery and gevent limits?

2020-07-31 Thread Mitch Raful
I have a django app that uses celery to do lots of polling and celery beat 
to schedule those.  I use gevent instead of worker processes.  It polls 
network devices using various things such as a vendor api, snmp, and, if 
needed, ssh to the command line.  

What I think I am seeing is as follows.  It looks like a long running task 
kicks off, apparently running quickly.  However, when another tasks kicks 
off the original is interrupted.  Once the interrupting task has finished 
or momentarily stops, the original task picks back up.  Tasks that I have 
timed to take thirty to forty minutes stand alone can take up to two hours 
under celery with gevent.

This leads me to wonder if I have reached a limit with using Celery/Gevent 
or am I doing something wrong with the way I have set up the tasks with 
app.task?

Thanks,

Mitch

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b76f190a-9599-4c60-b862-20b92a4f75e8n%40googlegroups.com.


Pytest, django, and logging formatters

2020-07-31 Thread 'Stephan Stachurski' via Django users

I am trying to test a django application that depends on a custom log 
formatter.

App log lines look like this:

`logger.info("Message with formatting {} {}", "foo", "boo")`

Obviously these log lines depend on a formatter that does something like 
this:

`msg = msg.format(*self.args)`

The app uses a LOGGING config like this:

LOGGING = {
'formatters': {
'standard': {
'()': 'common.utils.logging_utils.TimeZoneFormatter',

How can I get pytest to set up the same logging configuration while the app 
is under test?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b41e813-b475-4418-bd90-ea6569ab5523n%40googlegroups.com.


Udemy Clone

2020-07-31 Thread vedant mehta
I m creating a udemy clone can anyone 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e3d33d60-67ef-4356-a1ab-b8fa6e7db462o%40googlegroups.com.


Streaming Data

2020-07-31 Thread Venu Gopal
Hi, I have an urgent requirement where I need to stream data from Motion 
JPG to Django template. This solution is already there in Flask Reference: 
https://blog.miguelgrinberg.com/post/video-streaming-with-flask. Is there 
any way to do it in Django.

Thanks in advance.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4f598b93-0e64-4162-b620-b9b4eb569870o%40googlegroups.com.


Re: Django3 runserver error

2020-07-31 Thread ROHINI PUNDE
from django.db import models
from django.contrib.auth.models import User

class Customer(models.Model):
user=models.OneToOneField(User,null=True,on_delete= models.CASCADE)
name=models.CharField(max_length=200,null=True)
phone=models.CharField(max_length=200,null=True)
email=models.CharField(max_length=200,null=True)
profile_pic = models.ImageField(default="radha3.png", null=True, blank=True)
date_created=models.DateTimeField(auto_now_add=True,null=True)
def __str__(self):
return self.name

class Tag(models.Model):
name=models.CharField(max_length=200,null=True)
def __str__(self):
return self.name

class Product(models.Model):
CATEGORY=(
('In door','In door'),
('Out door','Out door'),
)
name=models.CharField(max_length=100,null=True)
price=models.FloatField(null=True)
category = models.CharField(max_length=200, null=True,choices=CATEGORY)
description = models.CharField(max_length=200,null=True,blank=True)
date_created = models.DateTimeField(auto_now_add=True, null=True)
tags=models.ManyToManyField(Tag)

def __str__(self):
return self.name


class Order(models.Model):
STATUS = (
('Pending', 'Pending'),
('Out for delivery', 'Out for delivery'),
('Delivered', 'Delivered'),
)
customer = models.ForeignKey(Customer, null=True, on_delete=models.SET_NULL)
product = models.ForeignKey(Product, null=True, on_delete=models.SET_NULL)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True, choices=STATUS)
note = models.CharField(max_length=1000, null=True)

def __str__(self):
return self.product.name



On Thu, Jul 30, 2020 at 7:41 PM RANGA BHARATH JINKA <
bharathjink...@gmail.com> wrote:

> Send your models.py file
>
> On Fri, 31 Jul 2020, 8:09 am RANGA BHARATH JINKA, <
> bharathjink...@gmail.com> wrote:
>
>> Hi convert it into string while displaying it in models __str__.
>> Or use f-strings. It is easy. All the best 👍
>>
>> On Thu, 30 Jul 2020, 8:29 pm ROHINI PUNDE,  wrote:
>>
>>> I have error while updating the information,so many trials I cant solve
>>> this problem,so please help me for this
>>>
>>>
>>> On Thu, Jul 30, 2020 at 2:25 AM Mira  wrote:
>>>
 Hi All,
 I recently upgraded Django from 2.2 to 3 on my MacOS10.13.
 I am using Python 3.6 and My Application was working fine with Django
 2.2 but now i am getting below error.

 Any help related with this topic would be greatly appreciated.

 $>python3 manage.py runserver

 Watching for file changes with StatReloader

 Performing system checks...


 Traceback (most recent call last):

   File "manage.py", line 22, in 

 execute_from_command_line(sys.argv)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 401, in execute_from_command_line

 utility.execute()

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/__init__.py",
 line 395, in execute

 self.fetch_command(subcommand).run_from_argv(self.argv)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
 line 328, in run_from_argv

 self.execute(*args, **cmd_options)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 line 60, in execute

 super().execute(*args, **options)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/base.py",
 line 369, in execute

 output = self.handle(*args, **options)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 line 95, in handle

 self.run(**options)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/management/commands/runserver.py",
 line 102, in run

 autoreload.run_with_reloader(self.inner_run, **options)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
 line 599, in run_with_reloader

 start_django(reloader, main_func, *args, **kwargs)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
 line 584, in start_django

 reloader.run(django_main_thread)

   File
 "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/autoreload.py",
 line 299, in run

Re: project ideas

2020-07-31 Thread Carles Pina i Estany


Hi,

On Jul/31/2020, Spring-dot wrote:
> I want to do some handsome projects using  django. Can anyone suggest some? 
> Thanks in advance! :)

I usually like doing projects for learning for things that can be useful
for me. Do you like cooking? perhaps a cooking/ingredients application.

Do you have lots of books? A book locator...

etc. :-)

-- 
Carles Pina i Estany
https://carles.pina.cat

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20200731120531.GA3302%40pina.cat.


Re: load static in css file

2020-07-31 Thread chander shekhar
tried this buddy yet it is not working

Regards
Chander Shekhar
(bestcsp)


On Thu, Jul 30, 2020 at 6:11 PM Irfan Khan  wrote:

> {% static 'imag.jpg' %}   instead of this try
>
> {% static “images/imag.png” %}
>
> On Thu, 30 Jul 2020 at 6:07 PM, Chander shekhar 
> wrote:
>
>> I am unable to fetch images from css file .
>> I have used {% load static %}
>> {% static 'imag.jpg' %}
>> buti can't fetch.console is saying image not found.
>>
>> --
>> 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 view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/554cbaf1-3b94-40b4-a0f1-efe0bd3f24ceo%40googlegroups.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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALKGVio%3DAsCafgcd-zfjBb2of-RWbPaTwwGjf7sXbjstgFdM6Q%40mail.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAmOWVzFDcPk9xtEnETSHoHiRWECy5YDxeWfd_ciZ16jW6Xs-A%40mail.gmail.com.


project ideas

2020-07-31 Thread Spring-dot
I want to do some handsome projects using  django. Can anyone suggest some? 
Thanks in advance! :)

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1837a098-811c-4f11-b4b8-b59530ecfbe5n%40googlegroups.com.


Re: Admin list sorting problem

2020-07-31 Thread Mike Dewhirst
On 31/07/2020 4:24 pm, Derek wrote:
> Apologies for lack of proof reading; the example code should be:
>
>
>     def _name(self, obj):
>         return '%s' % obj.name
>     _name.admin_order_field = 'sort_name'
>
>
> On Friday, 31 July 2020 08:21:45 UTC+2, Derek wrote:
>
> I've had to do something similar to handle species.
>

Brilliant!

Thanks Derek



>
> I'd suggest breaking "pure" database design and creating a new
> field - say, "sort_name".  This is created "on save" (obviously
> you can run a script to quickly generate this field's values for
> all existing records).  You don't show "sort_name" on the admin
> interface; what you then do is create a new attribute on the
> chemical model - call it "_name"; this displays the actual
> chemical name, but the sort is set to your new field.  Something
> like:
>
>     def _name(self):
>         return '%s' % self.name 
>     _name.admin_order_field = 'display_name'
>
> In the Admin, only show "_name" and not "sort_name" or "name".
>
> HTH
> Derek
>
> On Thursday, 30 July 2020 08:51:01 UTC+2, Mike Dewhirst wrote:
>
> I have looked closely at the Admin docs and the page source
> and I think
> I'm at the blank wall.
>
> I have a collection of 14,000+ chemical names which just
> naturally sort
> weirdly. This is because scientists insist on incuding
> "locants" in
> chemical names. Locants indicate where sub-molecules sit in
> the actual
> whole molecule. That isn't a sufficiently scientific
> description but
> with the following example should suffice to decribe my problem.
>
> 2,4-Toluene diisocyanate
> 2,4,6-tris(dimethylaminomethyl)phenol
> 2,6-Toluene diisocyanate
>
> Django wants to sort this alphanumerically but scientists
> don't want to
> see it that way.
>
> I wrote a chemsort algorithm and added a sort field (slug) to
> the model
> and used the model's Meta class ordering to sort the chemical
> according
> to slug.
>
> 2,4,6-tris(dimethylaminomethyl)phenol->>
> dimethylaminomethylphenol246tris
> ... (many thousands more chemicals) ...
> 2,4-Toluene diisocyanate->> toluenediisocyanate24
> 2,6-Toluene diisocyanate ->> toluenediisocyanate26
>
> This works fine until in the Admin, on clicking the substance
> name in
> the heading everything reverts to sorting on the name instead
> of the slug.
>
> This is understandable because, sensibly, the Admin appears to
> use
> javascript to handle such resorting in the browser instead of
> making a
> round trip to the database via the server. Therefore, I think
> I need
> slug in the list for an in-browser solution.
>
> I would like to include the slug in the Admin but severely
> reduce the
> allocated real-estate to just one or two characters.
>
> How can I do that? Maybe there is another solution?
>
> Thanks
>
> Mike
>
>
> -- 
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4fc11cfc-4dec-45e7-aa19-768e7c5b2a9fo%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/906b8923-facb-7f3c-d72a-24db7fd2c1d3%40dewhirst.com.au.


signature.asc
Description: OpenPGP digital signature