Merge branch 'develop' of https://github.com/digitalocean/netbox into develop

This commit is contained in:
D01\StephenM 2017-04-04 10:24:30 +01:00
commit 0f83a06234
3 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,3 @@
**The [2017 NetBox User Survey](https://goo.gl/forms/75HnNS2iE0Y1hVFH3) is open!** Please consider taking a moment to respond. Your feedback helps shape the pace and focus of NetBox development. The survey will remain open until 2017-03-31. Results will be published on the mailing list.
---
![NetBox](docs/netbox_logo.png "NetBox logo") ![NetBox](docs/netbox_logo.png "NetBox logo")
NetBox is an IP address management (IPAM) and data center infrastructure management (DCIM) tool. Initially conceived by the network engineering team at [DigitalOcean](https://www.digitalocean.com/), NetBox was developed specifically to address the needs of network and infrastructure engineers. NetBox is an IP address management (IPAM) and data center infrastructure management (DCIM) tool. Initially conceived by the network engineering team at [DigitalOcean](https://www.digitalocean.com/), NetBox was developed specifically to address the needs of network and infrastructure engineers.

View File

@ -56,13 +56,15 @@ ACTION_EDIT = 3
ACTION_BULK_EDIT = 4 ACTION_BULK_EDIT = 4
ACTION_DELETE = 5 ACTION_DELETE = 5
ACTION_BULK_DELETE = 6 ACTION_BULK_DELETE = 6
ACTION_BULK_CREATE = 7
ACTION_CHOICES = ( ACTION_CHOICES = (
(ACTION_CREATE, 'created'), (ACTION_CREATE, 'created'),
(ACTION_BULK_CREATE, 'bulk created'),
(ACTION_IMPORT, 'imported'), (ACTION_IMPORT, 'imported'),
(ACTION_EDIT, 'modified'), (ACTION_EDIT, 'modified'),
(ACTION_BULK_EDIT, 'bulk edited'), (ACTION_BULK_EDIT, 'bulk edited'),
(ACTION_DELETE, 'deleted'), (ACTION_DELETE, 'deleted'),
(ACTION_BULK_DELETE, 'bulk deleted') (ACTION_BULK_DELETE, 'bulk deleted'),
) )
@ -328,6 +330,9 @@ class UserActionManager(models.Manager):
def log_import(self, user, content_type, message=''): def log_import(self, user, content_type, message=''):
self.log_bulk_action(user, content_type, ACTION_IMPORT, message) self.log_bulk_action(user, content_type, ACTION_IMPORT, message)
def log_bulk_create(self, user, content_type, message=''):
self.log_bulk_action(user, content_type, ACTION_BULK_CREATE, message)
def log_bulk_edit(self, user, content_type, message=''): def log_bulk_edit(self, user, content_type, message=''):
self.log_bulk_action(user, content_type, ACTION_BULK_EDIT, message) self.log_bulk_action(user, content_type, ACTION_BULK_EDIT, message)
@ -358,7 +363,7 @@ class UserAction(models.Model):
return u'{} {} {}'.format(self.user, self.get_action_display(), self.content_type) return u'{} {} {}'.format(self.user, self.get_action_display(), self.content_type)
def icon(self): def icon(self):
if self.action in [ACTION_CREATE, ACTION_IMPORT]: if self.action in [ACTION_CREATE, ACTION_BULK_CREATE, ACTION_IMPORT]:
return mark_safe('<i class="glyphicon glyphicon-plus text-success"></i>') return mark_safe('<i class="glyphicon glyphicon-plus text-success"></i>')
elif self.action in [ACTION_EDIT, ACTION_BULK_EDIT]: elif self.action in [ACTION_EDIT, ACTION_BULK_EDIT]:
return mark_safe('<i class="glyphicon glyphicon-pencil text-warning"></i>') return mark_safe('<i class="glyphicon glyphicon-pencil text-warning"></i>')

View File

@ -334,7 +334,9 @@ class BulkAddView(View):
form.add_error(None, e) form.add_error(None, e)
if not form.errors: if not form.errors:
messages.success(request, u"Added {} {}.".format(len(new_objs), self.model._meta.verbose_name_plural)) msg = u"Added {} {}".format(len(new_objs), self.model._meta.verbose_name_plural)
messages.success(request, msg)
UserAction.objects.log_bulk_create(request.user, ContentType.objects.get_for_model(self.model), msg)
if '_addanother' in request.POST: if '_addanother' in request.POST:
return redirect(request.path) return redirect(request.path)
return redirect(self.default_return_url) return redirect(self.default_return_url)