问题标签 [neo4django]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
108 浏览

authentication - neo4django mixin 继承问题

考虑到我之前的问题,我尝试实现我所需要的。
下面是一个django app models.py的内容。

我有很多问题。首先是MyMixin的属性不继承:

而且创建也没有设置用户自己的属性!

User 中不存在任何 mixin 或 User 类自己的属性。如果我以相反的顺序得出:

他们在这里,但我认为这不是一个好的做法,核心模型不应该向右走吗?无论如何,正如我们在下面看到的,Activity 没有这个问题,
就像 AuthUser 删除了所有属性(预期行为?)一样。

虽然替代创建方法有效:

但是使用直接从 NodeModelManager 继承的另一个模型 Activity
(使用 User,我们有一个中间父级 AuthUser),情况会更好:

使用简单的 NodeModel 继承进行的几个测试都可以,但多重继承和 mixins 会出现问题。

我的 NodeModelManager 的另一个问题:

这超出了我的理解;) MyManager 在之前的测试中运行良好,我从 NodeModel 的子代而不是从 mixin 派生。

0 投票
1 回答
26 浏览

django - 在 neo4django 中使用 StringArrayProperty

编辑 我重写了这个问题,包括更一般的方面。

我在 neo4django 中使用 StringArrayProperty,use_string = True
因此它在 Neo4j 中保存了一个字符串。

当创建一个新模型时,该字段类型是一个元组,但我需要它作为一个列表。
所以这是我的方法,更新字段时:

现在的问题是:如何在类似的领域中进行搜索?
NodeModelManager.filter 似乎不适用于这种类型。

0 投票
1 回答
243 浏览

python-2.7 - 无法设置 neo4jDjango 图形数据库:对象没有属性“db_type”

我正在启动一个项目,并且在执行时不断收到此错误

回溯如下:

经过多次尝试解决问题后,该代码几乎是本教程的一个简单示例。

settings.py 也应该是正确的,因为它们是从 neo4Django 教程中复制的。

Neo4j 服务器正在运行,并且在 sqllite 和 mysql 数据库中一切正常,所以问题一定出在 neo4j 或 neo4django 方面。当不在域中使用 neo4Django 模型时,事情也会起作用。

该模型如下所示:

0 投票
1 回答
899 浏览

rest - AttributeError 'IdLookup' 对象没有属性 'rel'

我尝试使用 django REST-framework 的教程http://django-rest-framework.org/#django-rest-framework来管理用户。(我还使用 Neo4j 数据库和 neo4django 映射器https://github.com/scholrly/neo4django通过 python 访问数据。)
无论如何,当我调用 localhost:8000/users 时,会出现 AttributeError。

模型.py

序列化程序.py

视图.py

我明白了:

我对 Python/Django/REST 服务领域比较陌生。我希望有人能帮忙。提前致谢。

0 投票
0 回答
384 浏览

django - ModelForm 中的 Django 1.5.4 error_messages

我有一个非常简单的 ModelForm 子类:

当我尝试在我的视图中保存表单时(这里只有 post 功能):

我收到了这个错误:

我明白是失踪了error_messages......我是不是被迫定义它们?

0 投票
0 回答
685 浏览

python - Tastypie Neo4django 'unicode' 对象没有属性 'pk'

我将 Tastypie 与 neo4django 一起使用。我关注https://gist.github.com/mhluongo/5789513http://django-tastypie.readthedocs.org/en/latest/interacting.html。现在,在(新)提交的 POST 或 PUT 时,我坚持夸大某些关系的价值(通过 resource_uri?!)。“'unicode' 对象没有属性 'pk'”。

提交.py

api.py

网址.py

curl .../提交/模式/

错误:

设置非关系属性可以正常工作。创建一个新的提交返回相同的错误,但创建是在没有“崩溃”关系的情况下完成的。我想知道这是否不适用于 neo4django 的 ModelRessource。非常感谢。

0 投票
2 回答
1692 浏览

python - Authenticating via curl with Tasty Pie, using Session Authentication

So, it seems that I can perform this action just fine from the browser, but I can't seem to replicate it via CURL. Any pointers on how this is supposed to work are greatly, greatly appreciated.

I perform this request to log in a user:

And the response seems to indicate that the request was successful:

If I include only the CSRF token in my authenticated request, I get a 401. However, if I include both the CSRF token and the session ID, I get some kind of Python error. For example:

I get back from the server:

Looking at the lines of the errors is not particularly illuminating. Since this error doesn't occur unless --cookie is used, I'm presuming it's trying incorrectly to parse the cookie parameter.

It should also be noted that I am using Neo4django, which I believe precludes me from being able to use API Key Authentication. The code for my user is as such:

(You can view the entire contents of the file, if you need, at https://github.com/OpenPhilology/phaidra/blob/master/api/api.py)

So, in summary, the main questions/points of confusion for me:

  1. Which data must be sent via the curl request to send an authenticated GET/POST/etc.?
  2. Is the Authentication value correct for the User Resource?
  3. Am I supposed to be able to authenticate with only the CSRF token, or is the session ID also necessary?

Thanks in advance for any insight on this!

EDIT: Here is the custom user model we have.

0 投票
1 回答
531 浏览

django - 为 Neo4j 服务器构建 GremlinPlugin 时出错

我尝试探索如何将 neo4j 与 django 项目集成,并在我的 django 项目中启动管理页面,并依赖neo4django。但似乎它需要 Neo4j 服务器中的 GremlinPlugin 扩展。

使用此文档,我尝试为 GremlinPlugin 构建 jar 文件。

但是已经在第一步我遇到了缺少许可证标题的错误:

我使用 3.0.4 版的 Maven:

有没有人知道是什么导致了这个问题,我该如何解决?

0 投票
1 回答
202 浏览

django - 将 neo4django 与 graphenedb 一起使用

我试图让一个带有 neo4django 的 django 应用程序与托管在 graphenedb 上的 neo4j 数据库进行对话。

我的本地安装运行良好,但连接到我的本地 neo4j 实例不需要身份验证。要连接到 graphenedb,我需要传递我的凭据,但我不知道该怎么做。

我可以在 neo4django github repo ( https://github.com/scholrly/neo4django/issues/224 ) 上看到一个问题,这表明这应该是可能的,但我看不出如何。

我试过添加

到我的 NEO4J_DATABASES 字典中的默认条目,但我得到

有没有人有这个工作?

编辑

这是我的 NEO4J_DATABASES 的其余部分(这些设置都是从​​我创建的 NEO4J_URL 环境变量在其他地方解析的):

0 投票
1 回答
406 浏览

django - 在带有 neo4django 的 django 管理界面中使用抽象基类

我正在尝试在 django 的管理界面中使用一个简单的抽象基类和 neo4django。

示例模型.py

示例 admin.py:

“名称”字段不会出现在管理界面中。

如果我使用相同的基本结构,但使用 django.db 而不是 neo4django.db,则一切正常。有人发现我哪里出错了吗?

评论更新:

  • 这已经用 django 1.5.5 和 1.5.4 进行了尝试
  • neo4django 版本来自 github repo
  • 使用或不使用 ModelAdmin 注册模型都已尝试过并且没有任何区别