背景
我正在为度假租赁网站开发一款django应用程序.它将有两种类型的用户,租房者和物业经理.
我希望物业经理能够在django管理员中管理他们的出租物业.但是,他们应该只能管理自己的属性.
我意识到默认的django管理员不支持这个.我想知道添加这个功能会有多麻烦,如果可行的话,处理它的最佳方法是什么.
目标
理想情况下,我认为它的工作方式如下:
auth 已经允许这样的权限:
vacation | rental | Can add rental vacation | rental | Can change rental vacation | rental | Can delete rental
我想将其更改为:
vacation | rental | Can add any rental vacation | rental | Can change any rental vacation | rental | Can delete any rental vacation | rental | Can add own rental vacation | rental | Can change own rental vacation | rental | Can delete own rental
可能解决方案
框架如何决定租赁(或其他)是否属于用户?我想它会检查 …
func()
{
fun1();
fun2();
fun3();
fun4();
fun5();
fun6();
..
..
..
..
fun99();
fun100();
}
Run Code Online (Sandbox Code Playgroud)
通过在C程序中使用函数指针?我需要在程序中反复调用这个程序.
我如何创建自己的方法,将块作为参数,以后可以调用?
我试过以下事情.
#import <UIKit/UIKit.h>
typedef void (^viewCreator)(void);
@interface blocks2ViewController : UIViewController
{
}
-(void)createButtonUsingBlocks:(viewCreator *)block;
@end
- (void)viewDidLoad {
[super viewDidLoad];
[self createButtonUsingBlocks:^(NSString * name) {
UIButton *dummyButton = [[UIButton alloc]initWithFrame:CGRectMake(50, 50, 200, 100)];
dummyButton.backgroundColor = [UIColor greenColor];
[self.view addSubview:dummyButton];
}];
}
-(void)createButtonUsingBlocks:(viewCreator *)block
{
// Do something
NSLog(@"inside creator");
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将块变量传递给我的自定义方法,但没有任何成功.为什么会这样,做正确的方法是什么?
更新
这是文件is.h:
#import <UIKit/UIKit.h>
typedef void (^viewCreator)(void);
@interface blocks2ViewController : UIViewController
{
}
- (void)createButtonUsingBlocks:(viewCreator)block;
@end
Run Code Online (Sandbox Code Playgroud)
这是.m文件:
#import "blocks2ViewController.h"
@implementation blocks2ViewController
// Implement viewDidLoad …Run Code Online (Sandbox Code Playgroud) 如何在代码中以编程方式实现这一行XAML?(因为我需要动态创建单选按钮,但它们有什么绑定)
<RadioButton IsChecked="{Binding Path=Mode, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Proxy}">Proxy</RadioButton>
Run Code Online (Sandbox Code Playgroud)
到目前为止,我已经到了这里(见下文),但现在我正在努力解决如何将绑定连接起来.我做了一个猜测/假设我应该使用Binding类......
foreach (KeyValuePair<int, string> @interface in interfaces)
{
// RadioButton IsChecked="{Binding Path=Mode, Converter={StaticResource enumBooleanConverter}, ConverterParameter=Proxy, UpdateSourceTrigger=PropertyChanged , Mode=TwoWay}">Proxy</RadioButton>
// Create Radio Button
var newRb = new RadioButton();
newRb.Name = "I" + @interface.Key.ToString();
newRb.GroupName = "InterfaceGroup";
newRb.Content = @interface.Value;
// Binding
var binding = new Binding();
binding.Source = "Interface";
binding.Converter = new RadioBoolToIntConverter();
binding.ConverterParameter = @interface.Key;
// STUCK HERE - RE HOW TO GET THE BINDING TO BE APPLIED TO THE RADIO BUTTON
InterfacesRadioButtons.Children.Add(newRb); …Run Code Online (Sandbox Code Playgroud) 我需要在JavaScript中将日期值增加一天.
例如,我有一个日期值2010-09-11,我需要将第二天的日期存储在JavaScript变量中.
如何将日期增加一天?
Windows窗体Simart客户端现在是遗留物吗?它是否被Prism(和/或MVVM)取代?我应该费心去了解Smart Client吗?
可能与之相关的另一个问题是Winforms和WPF之间的性能差异除了wpf中的所有很酷的东西,比如数据绑定和3D?WPF难以在Windows 2000和Pre2000操作系统上运行吗?这个问题很重要,因为当您必须支持旧操作系统时(例如在NHS中),它可以决定您将使用winforms或WPF的哪个平台?
它似乎从谷歌的顶端消失了.我搜索过jQuery网站,没有结果,谷歌的最高结果要么是死链接.http://plugins.jquery.com/node/3656/release上的链接不会导致下载.
我不是一个菜鸟,但发生了一些混乱.
编辑:
根据回复:
"对于"jquery计时器下载"来说,大G的最高点是jquery.offput.ca/every - TJ Crowder"
这链接到一个页面,上面写着:"jQuery计时器已被移动到jQuery插件存储库,可以集中更新,错误跟踪和文档.请到那里确保您拥有最新版本的代码."
在该链接后面显示了一个不包含jQuery计时器的插件列表.
@TJ Crowder,也许你在谷歌搜索后可能会超过1个链接.
Darin Dimitrov的答复情况也是如此.
VirtualBlackFox的链接转到jQuery网站.我假设您点击"下载 - >查看所有版本",但也没有下载链接.
如何MONTH像使用sql查询一样使用函数编写JPA 查询?
@NamedQuery(name="querybymonth", query="select t from table1 t where MONTH(c_Date) = 5")
Run Code Online (Sandbox Code Playgroud)
当我使用上面的模式进行查询时,我收到一个错误:unexpected token - MONTH.
我正在写一个Selenium测试用例.这是我用来匹配数据表中所有"修改"按钮的xpath表达式.
//img[@title='Modify']
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何通过索引访问匹配的节点集?我试过了
//img[@title='Modify'][i]
Run Code Online (Sandbox Code Playgroud)
和
//img[@title='Modify' and position() = i]
Run Code Online (Sandbox Code Playgroud)
但是都不起作用..我也试过XPath checker(一个firefox扩展).发现总共有13个匹配,然后我完全不知道如何选择其中一个.. 或者XPath是否支持指定选择不在同一父节点下的节点?
wpf ×2
.net ×1
asp.net ×1
asp.net-mvc ×1
binding ×1
block ×1
c ×1
c# ×1
client ×1
cocoa-touch ×1
date ×1
datetime ×1
django ×1
django-admin ×1
java ×1
javascript ×1
jpa ×1
jpql ×1
jquery ×1
objective-c ×1
optimization ×1
orm ×1
plugins ×1
prism ×1
python ×1
selenium ×1
smartclient ×1
timer ×1
winforms ×1
xaml ×1
xpath ×1