Re: DoesNotExist at /admin/blog/blog/add/: blog matching query does not exist

2022-09-12 Thread Enerel Amgalan via Python-list
unsubscribe 

-Bat

> On Sep 12, 2022, at 14:32, mailingli...@vanwingerde.nl wrote:
> 
> Suddenly I can no longer add blogs to Django. Django says 'blog
> matching query does not exist'. That seems strange to me because I want
> to add something to the database and not request a blog. What could be
> going on here?
> 
> admin.py:
> class blogadmin(admin.ModelAdmin):
>def save_model(self, request, obj, form, change):
>if not change:
>obj.added_by_user = request.user.username
>obj.ip_added = request.META['REMOTE_ADDR']
>if obj.ip_added == '127.0.0.1':
>obj.ip_added = request.META['HTTP_X_FORWARDED_FOR']
>obj.publish = False
>del obj.publish_date
>else:
>obj.changed_by_user = request.user.username
>obj.ip_changed = request.META['REMOTE_ADDR']
>if obj.ip_changed == '127.0.0.1':
>obj.ip_changed = request.META['HTTP_X_FORWARDED_FOR']
>if obj.publish == True:
>if not obj.publish_date:
>obj.publish_date = obj.datetime_changed
>super(blogadmin,self).save_model(request, obj, form, change)
> 
> I can add text, photographs etc., but no blogs.
> 
> Notifications:
> DoesNotExist at /admin/blog/blog/add/
> 
> blog matching query does not exist.
> 
> Request Method:POST
> Request URL:http://127.0.0.1:8001/admin/blog/blog/add/
> Django Version:4.1.1
> Exception Type:DoesNotExist
> Exception Value:
> 
> blog matching query does not exist.
> 
> Traceback
> Environment:
> Request Method: POST
> Request URL: http://127.0.0.1:8001/admin/blog/blog/add/
> 
> Django Version: 4.1.1
> Python Version: 3.10.5
> Installed Applications:
> ['grappelli',
> 'django.contrib.admin',
> 'django.contrib.admindocs',
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'blog.apps.BlogConfig']
> Installed Middleware:
> ['django.middleware.security.SecurityMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware',
> 'django.contrib.admindocs.middleware.XViewMiddleware']
> 
> Traceback (most recent call last):
>  File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/core/handlers/exception.py",
> line 55, in inner response = get_response(request) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/core/handlers/base.py",
> line 197, in _get_response response = wrapped_callback(request,
> *callback_args, **callback_kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
> line 686, in wrapper return self.admin_site.admin_view(view)(*args,
> **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
> line 133, in _wrapped_view response = view_func(request, *args,
> **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/views/decorators/cache.py",
> line 62, in _wrapped_view_func response = view_func(request, *args,
> **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/sites.py",
> line 242, in inner return view(request, *args, **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
> line 1890, in add_view return self.changeform_view(request, None,
> form_url, extra_context) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
> line 46, in _wrapper return bound_method(*args, **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
> line 133, in _wrapped_view response = view_func(request, *args,
> **kwargs) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
> line 1750, in changeform_view return self._changeform_view(request,
> object_id, form_url, extra_context) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
> line 1802, in _changeform_view self.save_model(request, new_object,
> form, not add) File "/var/django/liakoster.nl/blog-1/blog/admin.py",
> line 26, in save_model super(blogadmin,self).save_model(request, obj,
> form, change) File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
> line 1225, in save_model obj.save() File
> "/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/base.py",
> line 831, in save self.save_base( File
> 

Re: Obtain the query interface url of BCS server.

2022-09-12 Thread DFS

On 9/12/2022 5:00 AM, hongy...@gmail.com wrote:

I want to do the query from with in script based on the interface here [1]. For this 
purpose, the underlying posting URL must be obtained, say, the URL corresponding to 
"ITA Settings" button, so that I can make the corresponding query URL and issue 
the query from the script.

However, I did not find the conversion rules from these buttons to the 
corresponding URL. Any hints for achieving this aim?

[1] 
https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-getgen?list=new=gen=10

Regards,
Zhao



You didn't say what you want to query.  Are you trying to download 
entire sections of the Bilbao Crystallographic Server?  Maybe the admins 
will give you access to the data.



* this link: https://www.cryst.ehu.es/cgi-bin/cryst/programs/nph-getgen
  brings up the table of space group symbols.

* choose say #7: Pc

* now click ITA Settings, then choose the last entry "P c 1 1" and it
  loads:

https://www.cryst.ehu.es/cgi-bin/cryst/programs//nph-trgen?gnum=007=gp=b,-a-c,c=P%20c%201%201=ita

You might be able to fool around with that URL and substitute values and 
get back the data you want (in HTML) via Python.  Do you really want 
HTML results?



Hit Ctrl+U to see the source HTML of a webpage

Right-click or hit Ctrl + Shift + C to inspect the individual elements 
of the page



--
https://mail.python.org/mailman/listinfo/python-list


DoesNotExist at /admin/blog/blog/add/: blog matching query does not exist

2022-09-12 Thread mailinglists
Suddenly I can no longer add blogs to Django. Django says 'blog
matching query does not exist'. That seems strange to me because I want
to add something to the database and not request a blog. What could be
going on here?

admin.py:
class blogadmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
if not change:
obj.added_by_user = request.user.username
obj.ip_added = request.META['REMOTE_ADDR']
if obj.ip_added == '127.0.0.1':
obj.ip_added = request.META['HTTP_X_FORWARDED_FOR']
obj.publish = False
del obj.publish_date
else:
obj.changed_by_user = request.user.username
obj.ip_changed = request.META['REMOTE_ADDR']
if obj.ip_changed == '127.0.0.1':
obj.ip_changed = request.META['HTTP_X_FORWARDED_FOR']
if obj.publish == True:
if not obj.publish_date:
obj.publish_date = obj.datetime_changed
super(blogadmin,self).save_model(request, obj, form, change)

I can add text, photographs etc., but no blogs.

Notifications:
DoesNotExist at /admin/blog/blog/add/

blog matching query does not exist.

Request Method: POST
Request URL:http://127.0.0.1:8001/admin/blog/blog/add/
Django Version: 4.1.1
Exception Type: DoesNotExist
Exception Value:

blog matching query does not exist.

Traceback
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8001/admin/blog/blog/add/

Django Version: 4.1.1
Python Version: 3.10.5
Installed Applications:
['grappelli',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'blog.apps.BlogConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.contrib.admindocs.middleware.XViewMiddleware']

Traceback (most recent call last):
  File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/core/handlers/exception.py",
line 55, in inner response = get_response(request) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/core/handlers/base.py",
line 197, in _get_response response = wrapped_callback(request,
*callback_args, **callback_kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
line 686, in wrapper return self.admin_site.admin_view(view)(*args,
**kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
line 133, in _wrapped_view response = view_func(request, *args,
**kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/views/decorators/cache.py",
line 62, in _wrapped_view_func response = view_func(request, *args,
**kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/sites.py",
line 242, in inner return view(request, *args, **kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
line 1890, in add_view return self.changeform_view(request, None,
form_url, extra_context) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
line 46, in _wrapper return bound_method(*args, **kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/utils/decorators.py",
line 133, in _wrapped_view response = view_func(request, *args,
**kwargs) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
line 1750, in changeform_view return self._changeform_view(request,
object_id, form_url, extra_context) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
line 1802, in _changeform_view self.save_model(request, new_object,
form, not add) File "/var/django/liakoster.nl/blog-1/blog/admin.py",
line 26, in save_model super(blogadmin,self).save_model(request, obj,
form, change) File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/contrib/admin/options.py",
line 1225, in save_model obj.save() File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/base.py",
line 831, in save self.save_base( File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/base.py",
line 882, in save_base updated = self._save_table( File
"/var/django/liakoster.nl/blog-1/lib/python3.10/site-packages/django/db/models/base.py",
line 1025, in _save_table results = self._do_insert( File

[Python-announce] objerve 0.2.0

2022-09-12 Thread furkanonder via Python-announce-list
Announcing objerve 0.2.0
=

PyPI: https://pypi.org/project/objerve/0.2.0/
Pip: ``pip install objerve==0.2.0``
Source: https://github.com/furkanonder/objerve/

What is objerve?
-
Objerve is a tiny observer for Python object attributes that only use one 
decorator.

Example
-
from objerve import watch

@watch(set={"foo", "qux"}, get={"bar", "foo"})
class M:
qux = "blue"

def __init__(self):
self.bar = 55
self.foo = 89
self.baz = 121

m = M()

def abc():
m.foo += 10

m.qux = "red"
abc()
m.foo

Output:

Set | foo = 89
File "/home/blue/example.py", line 9, in __init__
self.foo = 89

Set | qux = red
File "/home/blue/example.py", line 18, in 
m.qux = "red"

Get | foo = 89
File "/home/blue/example.py", line 16, in abc
m.foo += 10

Set | foo = 99
File "/home/blue/example.py", line 16, in abc
m.foo += 10

Get | foo = 99
File "/home/blue/example.py, line 20, in 
m.foo

Enjoy,
Furkan Onderhttps://github.com/furkanonder/
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[Python-announce] [RELEASE] Python 3.11 release candidate 2 (3.11.0rc2) is available

2022-09-12 Thread Pablo Galindo Salgado
Python 3.11 is one month away, can you believe it? This snake is still
trying to bite as it has been an interesting day of fighting fires, release
blockers, and a bunch of late bugs but your friendly release team always
delivers :)

You can get this new release while is still fresh here:

https://www.python.org/downloads/release/python-3110rc2/

## This is the second release candidate of Python 3.11

This release, **3.11.0rc2**, is the last preview before the final release
of Python 3.11.0 on  2022-10-24.

Entering the release candidate phase, only reviewed code changes which are
clear bug fixes are allowed between this release candidate and the final
release. The second candidate and the last planned release preview is
currently planned for Monday, 2022-09-05 while the official release is
planned for Monday, 2022-10-24.

There will be no ABI changes from this point forward in the 3.11 series and
the goal is that there will be as few code changes as possible.

## Modification of the final release

Due to the fact that we needed to delay the last release candidate by a
week and because of personal scheduling problems I am delaying the final
release to 2022-10-24 (three weeks from the original date).

## Call to action

⚠️⚠️⚠️⚠️⚠️⚠️⚠️
The 3.11 branch is now accepting changes for 3.11.**1**. To maximize
stability, the final release will be cut from the v3.11.0rc2 tag. If you
need the release manager (me) to cherry-pick any critical fixes, mark
issues as release blockers, and/or add me as a reviewer on a critical
backport PR on GitHub. To see which changes are currently cherry-picked for
inclusion in 3.11.0, look at the short-lived branch-v3.11.0
https://github.com/python/cpython/tree/branch-v3.11.0 on GitHub.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️

---

 Core developers: all eyes on the docs now

* Are all your changes properly documented?
* Did you notice other changes you know of to have insufficient
documentation?

 Community members

We strongly encourage maintainers of third-party Python projects to prepare
their projects for 3.11 compatibilities during this phase. As always,
report any issues to [the Python bug tracker ](https://github.com/issues).

Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.

# Major new features of the 3.11 series, compared to 3.10

Some of the new major new features and changes in Python 3.11 are:

## General changes

* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and `except*`
* [PEP 680](https://www.python.org/dev/peps/pep-0680/) -- tomllib: Support
for Parsing TOML in the Standard Library
* [gh-90908](https://github.com/python/cpython/issues/90908) -- Introduce
task groups to asyncio
* [gh-34627](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping (`(?>...)`) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster CPython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.

## Typing and typing language changes

* [PEP 673](https://www.python.org/dev/peps/pep-0673/) --  Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) -- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/) -- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) -- Marking
individual TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/) -- Data Class
Transforms

(Hey, **fellow core developer,** if a feature you find important is
missing from this list, [let Pablo know](mailto:pablog...@python.org
).)

The next release will be the final release of Python 3.11.0, which is
currently scheduled for Monday, 2022-10-24.

# More resources

* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different

In general relativity, a white hole is a theoretical region of spacetime
and singularity that cannot be entered from the outside, although
energy-matter, light and information can escape from it. In this sense, it
is the reverse of a black hole, which can be entered only from the outside
and from which energy-matter, light and information cannot escape. White
holes appear in the theory of eternal black holes. In addition to a black
hole region in the future, such a solution of the Einstein field equations
has a white hole 

[RELEASE] Python 3.11 release candidate 2 (3.11.0rc2) is available

2022-09-12 Thread Pablo Galindo Salgado
Python 3.11 is one month away, can you believe it? This snake is still
trying to bite as it has been an interesting day of fighting fires, release
blockers, and a bunch of late bugs but your friendly release team always
delivers :)

You can get this new release while is still fresh here:

https://www.python.org/downloads/release/python-3110rc2/

## This is the second release candidate of Python 3.11

This release, **3.11.0rc2**, is the last preview before the final release
of Python 3.11.0 on  2022-10-24.

Entering the release candidate phase, only reviewed code changes which are
clear bug fixes are allowed between this release candidate and the final
release. The second candidate and the last planned release preview is
currently planned for Monday, 2022-09-05 while the official release is
planned for Monday, 2022-10-24.

There will be no ABI changes from this point forward in the 3.11 series and
the goal is that there will be as few code changes as possible.

## Modification of the final release

Due to the fact that we needed to delay the last release candidate by a
week and because of personal scheduling problems I am delaying the final
release to 2022-10-24 (three weeks from the original date).

## Call to action

⚠️⚠️⚠️⚠️⚠️⚠️⚠️
The 3.11 branch is now accepting changes for 3.11.**1**. To maximize
stability, the final release will be cut from the v3.11.0rc2 tag. If you
need the release manager (me) to cherry-pick any critical fixes, mark
issues as release blockers, and/or add me as a reviewer on a critical
backport PR on GitHub. To see which changes are currently cherry-picked for
inclusion in 3.11.0, look at the short-lived branch-v3.11.0
https://github.com/python/cpython/tree/branch-v3.11.0 on GitHub.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️

---

 Core developers: all eyes on the docs now

* Are all your changes properly documented?
* Did you notice other changes you know of to have insufficient
documentation?

 Community members

We strongly encourage maintainers of third-party Python projects to prepare
their projects for 3.11 compatibilities during this phase. As always,
report any issues to [the Python bug tracker ](https://github.com/issues).

Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.

# Major new features of the 3.11 series, compared to 3.10

Some of the new major new features and changes in Python 3.11 are:

## General changes

* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and `except*`
* [PEP 680](https://www.python.org/dev/peps/pep-0680/) -- tomllib: Support
for Parsing TOML in the Standard Library
* [gh-90908](https://github.com/python/cpython/issues/90908) -- Introduce
task groups to asyncio
* [gh-34627](https://github.com/python/cpython/issues/34627/) -- Atomic
grouping (`(?>...)`) and possessive quantifiers (`*+, ++, ?+, {m,n}+`) are
now supported in regular expressions.
* The [Faster CPython Project](https://github.com/faster-cpython/) is
already yielding some exciting results. Python 3.11 is up to 10-60% faster
than Python 3.10. On average, we measured a 1.22x speedup on the standard
benchmark suite. See [Faster CPython](
https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython) for details.

## Typing and typing language changes

* [PEP 673](https://www.python.org/dev/peps/pep-0673/) --  Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/) -- Variadic Generics
* [PEP 675](https://www.python.org/dev/peps/pep-0675/) -- Arbitrary Literal
String Type
* [PEP 655](https://www.python.org/dev/peps/pep-0655/) -- Marking
individual TypedDict items as required or potentially-missing
* [PEP 681](https://www.python.org/dev/peps/pep-0681/) -- Data Class
Transforms

(Hey, **fellow core developer,** if a feature you find important is
missing from this list, [let Pablo know](mailto:pablog...@python.org
).)

The next release will be the final release of Python 3.11.0, which is
currently scheduled for Monday, 2022-10-24.

# More resources

* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [
https://github.com/python/cpython/issues](https://github.com/python/cpython/issues)
.
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different

In general relativity, a white hole is a theoretical region of spacetime
and singularity that cannot be entered from the outside, although
energy-matter, light and information can escape from it. In this sense, it
is the reverse of a black hole, which can be entered only from the outside
and from which energy-matter, light and information cannot escape. White
holes appear in the theory of eternal black holes. In addition to a black
hole region in the future, such a solution of the Einstein field equations
has a white hole