rangingbeaconbssidsquest
This commit is contained in:
parent
bd33b9adbc
commit
148517cc5f
1 changed files with 42 additions and 0 deletions
|
@ -52,3 +52,45 @@ class RangingBeaconAltitudeQuest(Quest):
|
|||
def _qs_for_request(cls, request):
|
||||
return RangingBeacon.qs_for_request(request).select_related('space',
|
||||
'space__level').filter(altitude_quest=True)
|
||||
|
||||
|
||||
class RangingBeaconBSSIDsQuestForm(ChangeSetModelForm):
|
||||
def clean_bssids(self):
|
||||
data = self.cleaned_data["bssids"]
|
||||
if not data:
|
||||
raise ValidationError(_("Need at least one bssid."))
|
||||
return data
|
||||
|
||||
class Meta:
|
||||
model = RangingBeacon
|
||||
fields = ("bssids", )
|
||||
|
||||
@property
|
||||
def changeset_title(self):
|
||||
return f'Ranging Beacon BSSID Quest: {self.instance.title}'
|
||||
|
||||
|
||||
@register_quest
|
||||
@dataclass
|
||||
class RangingBeaconBSSIDsQuest(Quest):
|
||||
quest_type = "ranging_beacon_bssids"
|
||||
quest_type_label = _('Ranging Beacon Identifier')
|
||||
quest_type_icon = "wifi_find"
|
||||
form_class = RangingBeaconBSSIDsQuestForm
|
||||
obj: RangingBeacon
|
||||
|
||||
@property
|
||||
def quest_description(self) -> list[str]:
|
||||
return [
|
||||
_("This quest is only available in the app. It works fully automatically."),
|
||||
_("Please stand near this access point and wait for the submit button to appear."),
|
||||
_("This should happen within less than a minute."),
|
||||
]
|
||||
|
||||
@property
|
||||
def point(self) -> Point:
|
||||
return mapping(self.obj.geometry)
|
||||
|
||||
@classmethod
|
||||
def _qs_for_request(cls, request):
|
||||
return RangingBeacon.qs_for_request(request).filter(import_tag__startswith="noc:", bssids=[])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue