我正在寻找一种以图形方式表示我的Django项目模型的方法.
是否有一些应用程序可以执行此类ERD(图表)?
按照@Etienne说明进行更新
以下是我最终查看代表我的django项目的某些模型的PDF的示例
$ python manage.py graph_models app1 app2 ... | dot -Tpdf | evince
Run Code Online (Sandbox Code Playgroud)
dot给输出为PDF格式evince我正在使用Chart.js绘制一个简单的条形图,我需要格式化它的Y轴
123456.05至123 456,05 $
我不明白怎么用 scaleLabel : "<%=value%>"
我看到有人指着 " JS Micro-Templating ",
但不知道如何使用我们的scaleLabel选项.
有人知道如何格式化这个Y轴,也许给我一个例子?
我已经看过几个关于这个问题的帖子,但没有找到我的解决方案.
我正在尝试在Django 1.3开发环境中提供静态文件.
这是我的设置
...
STATIC_ROOT = '/home/glide/Documents/django/cbox/static/'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
'/static/',
)
...
Run Code Online (Sandbox Code Playgroud)
我的urls.py
urlpatterns = patterns('',
...
url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root', settings.STATIC_ROOT}
),
...
);
Run Code Online (Sandbox Code Playgroud)
我的/ home/glide/Documents/django/cbox/static /目录就像
css
main.css
javascript
image
Run Code Online (Sandbox Code Playgroud)
尝试访问http://127.0.0.1:8000/static/css/main.css时出现404错误.
我是否必须单独指定css,javascript和图像的模式?
我在xib中创建了一个视图(带有活动指示器,进度视图和标签).然后我创建了.h/.m文件:
#import <UIKit/UIKit.h>
@interface MyCustomView : UIView {
IBOutlet UIActivityIndicatorView *actIndicator;
IBOutlet UIProgressView *progressBar;
IBOutlet UILabel *statusMsg;
}
@end
#import "MyCustomView.h"
@implementation MyCustomView
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
// Initialization code
}
return self;
}
- (void)dealloc {
[super dealloc];
}
@end
Run Code Online (Sandbox Code Playgroud)
在IB中,我将文件的所有者和查看标识设置为MyCustomView并将IBOutlet连接到文件的所有者
在MyViewController.m中,我:
- (void)viewDidLoad {
[super viewDidLoad];
UIView *subView = [[MyCustomView alloc] initWithFrame:myTableView.frame];
[subView setBackgroundColor:[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5]];
[myTableView addSubview:subView];
[subView release];
}
Run Code Online (Sandbox Code Playgroud)
当我运行应用程序时,视图已添加,但我看不到标签,进度条和活动指示器.
我究竟做错了什么?
我有用户,视频,主题,标准和评级
你可以看到我的原始帖子Django - 评级模型示例DetailView模板,以获得所用模型的详细信息
我已经扩展了DetailView基于视频模型的模板,将给定用户的所选视频的评级列表作为额外的上下文.
class VideoFileDetailView(DetailView):
model = VideoFile
def get_context_data(self, **kwargs):
context = super(VideoFileDetailView, self).get_context_data(**kwargs)
context['rates'] = VideoRate.objects.filter(video=self.object, user=self.request.user)
return context
Run Code Online (Sandbox Code Playgroud)
在被指向的模板DetailView,我想列出指标分析中的视频,并为每个标准显示当前评级值形成用户. …
我有一个带有可选文件字段的模型
class MyModel(models.Model):
name = models.CharField(max_length=50)
sound = models.FileField(upload_to='audio/', blank=True)
Run Code Online (Sandbox Code Playgroud)
我们放一个值
>>> test = MyModel(name='machin')
>>> test.save()
Run Code Online (Sandbox Code Playgroud)
为什么我这样做?
>>> test.sound
<FieldFile: None>
>>> test.sound is None
False
Run Code Online (Sandbox Code Playgroud)
如何检查是否有文件集?
我正在使用通用的CreateView,如:
#urls.py
from django.conf.urls.defaults import *
from django.views.generic import CreateView
from content.models import myModel
urlpatterns = patterns('myApp.views',
(r'myCreate/$', CreateView.as_view(model=myModel)),
)
Run Code Online (Sandbox Code Playgroud)
使用mymodel_form.html模板,例如:
<form method="post" action="">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Submit" />
</form>
Run Code Online (Sandbox Code Playgroud)
当我提交表单时,会创建新对象但我收到错误
在...处配置不当
没有要重定向到的网址.在模型上提供url或定义get_absolute_url方法.
如何指定成功重定向的URL?
我正在使用Bootstrap 2.1.1和jQuery 1.8.1并尝试使用Typeahead的功能.
我尝试显示标签并使用像标准的ID<select />
这是我的预先初始化:
$(':input.autocomplete').typeahead({
source: function (query, process) {
$('#autocompleteForm .query').val(query);
return $.get(
$('#autocompleteForm').attr('action')
, $('#autocompleteForm').serialize()
, function (data) {
return process(data);
}
);
}
});
Run Code Online (Sandbox Code Playgroud)
这是我发送的那种JSON
[{"id":1,"label":"machin"},{"id":2,"label":"truc"}]
Run Code Online (Sandbox Code Playgroud)
如何process()显示我的标签并将所选ID存储在另一个隐藏字段中?
javascript jquery autocomplete twitter-bootstrap typeahead.js
我需要在python2.7上安装OpenSSL.
我试过了
$ sudo pip install pyopenssl
Run Code Online (Sandbox Code Playgroud)
我得到了以下内容
/usr/local/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'OpenSSL.crypto' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/crypto.o
In file included from OpenSSL/crypto/crypto.h:17,
from OpenSSL/crypto/crypto.c:15:
OpenSSL/crypto/x509.h:17:25: error: openssl/ssl.h: No such file or directory
In file included from OpenSSL/crypto/crypto.h:17,
from OpenSSL/crypto/crypto.c:15:
OpenSSL/crypto/x509.h:25: error: expected specifier-qualifier-list before ‘X509’
OpenSSL/crypto/x509.h:29: error: expected declaration specifiers or ‘...’ before ‘ASN1_TIME’
OpenSSL/crypto/x509.h:30: error: …Run Code Online (Sandbox Code Playgroud) 我已经开始使用Bootstrap 3迁移到网格系统,但文档中的示例都使用DIV:http: //getbootstrap.com/css/#grid
我做了一个有点多余的代码,将DIV类与TABLE标签/类混合:http: //getbootstrap.com/css/#tables
问题是布局使边界变得困难,我认为应该是更好的方法.对此有何建议?
小提琴中的示例代码:http://jsfiddle.net/7g8nV/1/
<div class="table-responsive">
<table class="table table-bordered">
<tr class="row">
<td class="field-label col-md-3 active">
<label>Field 1:</label>
</td>
<td class="col-md-9">
Value 1
</td>
</tr>
<tr class="row">
<td class="field-label col-md-3 active">
<label>Field 2:</label>
</td>
<td class="col-md-9">
Value 2
</td>
</tr>
<tr class="row">
<td class="field-label col-md-3 active">
<label>Field 3:</label>
</td>
<td class="col-md-9">
Value 3
</td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
grid-system responsive-design twitter-bootstrap twitter-bootstrap-3
django ×5
python ×2
addsubview ×1
autocomplete ×1
chart.js ×1
diagram ×1
erd ×1
grid-system ×1
ios ×1
javascript ×1
jquery ×1
model ×1
objective-c ×1
openssl ×1
pyopenssl ×1
python-2.7 ×1
redirect ×1
ssl ×1
static-files ×1
typeahead.js ×1
xib ×1