小编Pez*_*Pez的帖子

在Angularjs上从控制器启用/禁用按钮

我有一个HTML按钮选项,如下所示,

<button ng-class="{'primaryButton':true}" type="button" id="modalCreateBtn" "ng-hide="false" class="btn btn-group mm-btn-save primaryButton" ng-click="addSegments()">CREATE</button>
Run Code Online (Sandbox Code Playgroud)

ng-disable上面的按钮选项中没有选项.这可以通过控制器上的buttonId启用/禁用按钮吗?另外,我不想在HTML视图上添加禁用选项.相反,我想通过脚本来控制它.这可能吗?

javascript angularjs

14
推荐指数
2
解决办法
4万
查看次数

如何在gradle中打包没有依赖类的jar,类似于maven

如何编写一个gradle脚本,以便应用程序jar应该打包而没有类似于maven jar包的依赖类

dependencies package gradle maven

6
推荐指数
1
解决办法
2064
查看次数

如何使用aws-cli访问Google Cloud Storage存储桶

我可以访问aws和Google Cloud Platform.

这有可能做到以下几点,

  1. 使用aws-cli列出Google Cloud Storage存储桶
  2. 使用aws-cli将CSV文件输入Google Cloud Storage存储桶
  3. 使用aws-cli从Google Cloud Storage存储桶中获取对象

amazon-s3 amazon-web-services google-cloud-storage aws-cli google-cloud-platform

6
推荐指数
2
解决办法
1349
查看次数

Django-rest-framework filter_queryset() 需要 3 个位置参数,但给出了 4 个

我在我的应用程序中使用 django-rest-framework。我在使用此序列化程序时遇到以下错误。我在这里错过了什么?验证序列化程序时出错

serializer = self.get_serializer(data=request.data.get('data'))
serializer.is_valid(raise_exception=False)
print (serializer.initial_data)
Run Code Online (Sandbox Code Playgroud)

但是在打印 serializer.initial_data 时,它会打印我发送的请求,

{'step3': True, 'first_last_name': 'Testing FN1', 'email': 'test@gmail.com', 'gender': 0, 'state': 76, 'birthday': 766261, 'username': 'Testing 1', 'password': 'Test@dev123'}
Run Code Online (Sandbox Code Playgroud)

在 Views.py 中

def registration_flow(self, request):
        request.data.get('data', {})['email'] = request.data.get('data', {}).get('email', '').lower()
        serializer = self.get_serializer(data=request.data.get('data'))
        first_last_name = request.data.get('data', {}).get(
            'first_last_name')
        if first_last_name:
            first_last_name = first_last_name.strip()
            if " " not in first_last_name:
                serializer.initial_data['firstName'] = first_last_name
            else:
                names_list = first_last_name.split(" ")
                names_list = [x for x in names_list if x]
                firstName = names_list[0] …
Run Code Online (Sandbox Code Playgroud)

django-rest-framework python-3.6 django-3.0

6
推荐指数
1
解决办法
685
查看次数

bootstrap-modal不显示对话框

我在rails应用程序中使用bootstrap.我试图使用bootstrap-modal显示对话框,但对话框不适合我.这是我的观看代码.

<div id="creative_attachment_popup" class="modal hide fade" role="dialog">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>Modal header</h3>
  </div>
  <div class="modal-body">
    <p>Do you eant to continue../p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn">Close</a>
    <a href="#" class="btn btn-primary">Save changes</a>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

简而言之,我将js文件称为

 $('#creative_attachment_popup').modal('show');
Run Code Online (Sandbox Code Playgroud)

上面的代码只显示了一个淡入淡出的页面,并且不包含任何对话框.当我在控制台中键入上面的js行时,它显示以下内容:

<div id=?"creative_attachment_popup" class=?"modal hide fade in ui-dialog-content ui-widget-content" role=?"dialog"> <h1 style=?"display:? block;?" aria-hidden=?"false">?…?</div>?
Run Code Online (Sandbox Code Playgroud)

用我的html参考上面的代码.我为什么要这个?

javascript twitter-bootstrap

5
推荐指数
2
解决办法
1万
查看次数

如何获取Google Cloud Storage中存在的视频的视频时长

我已将视频上传到Google的Cloud Storage存储桶,并在Video Intelligence API中引用了它们的URL。当我尝试获取上载视频的视频时长时,Video Intelligence API不会返回任何内容。

这是我使用的代码:

require "google/cloud/video_intelligence"

video_intelligence_client = Google::Cloud::VideoIntelligence.new
features_element = :LABEL_DETECTION
features = [features_element]

operation = video_intelligence_client.annotate_video input_uri: input_uri, features: features
p "PROCESSING......"
p operation
raise operation.results.message? if operation.error?

operation.wait_until_done!
metadata = operation.metadata
puts metadata
Run Code Online (Sandbox Code Playgroud)

使用Video Intelligence API是否可以获取视频时长?另外,我应该如何从Google Cloud Storage API获取它?

google-cloud-storage google-cloud-platform video-intelligence-api

5
推荐指数
1
解决办法
88
查看次数

last_login 字段已从 django 用户模型中删除

我正在使用 django 管理应用程序。我刚刚将 jango 1.9 迁移到了 Django 3.1.1。并且使用 python 3.6 在 Django 迁移期间,它需要一个额外的参数作为“on_delete”。所以,我更新了我所有模型的参数。

修改模型后,我只执行“makemigrations”和“迁移”,这一切都应该没问题,没有任何问题。而且,我可以看到我的表中遗漏了“last_login”列。调试时我可以在迁移文件中看到这个

operations = [
          migrations.RemoveField(
              model_name='user',
              name='last_login',
          )]
Run Code Online (Sandbox Code Playgroud)

问题

  1. 为什么删除了此列?
  2. 如何再次将此字段添加到用户模型

database model python-3.x django-3.0

5
推荐指数
0
解决办法
48
查看次数