def get_context_data(self, **kwargs): create_action(self.request.user, 'USER_CREATED') context = DetailView.get_context_data(self, **kwargs) if self.object != self.request.user: context['chat'] = self.object.get_chat_with(self.request.user) context['deal'] = VirtualDeal.combinated(self.object, me_=self.request.user)[0] return context
def get_context_data(self, **kwargs): create_action(self.request.user, 'FIRST_CALC_DIRECT') context = TemplateView.get_context_data(self, **kwargs) context['is_virtual'] = True context['deals_2d'] = VirtualDeal.by_users( self.request.user, self.request.user.other_users ) return context
def create_chat(sender, instance, created, **kwargs): """ create market chat after creating market """ if created: instance.chat = Chat.objects.create(type=ChatType.MARKET, market=instance) instance.save() for user in instance.users.all(): if not create_action(user, 'FIRST_MARKET_CREATED'): create_action(user, 'MARKET_CREATED')
def save(self, *args, **kwargs): # pylint: disable=signature-differs log_string = 'Deal {}: user1={} user2={} market={} status={} location={}'.format( 'updated' if self.pk else 'created', str(self.user1), str(self.user2), str(self.market), str(self.status), str(self.location), ) LOGGER.info(log_string) create_action(self.user, 'DEAL_CREATED') super().save(*args, **kwargs)
def save(self, *args, **kwargs): # pylint: disable=signature-differs log_string = 'Location {}: title={} user={} lon={} lat={}'.format( 'updated' if self.pk else 'created', str(self.title), str(self.user), str(self.lon), str(self.lat), ) LOGGER.info(log_string) if not create_action(self.user, 'FIRST_LOCATION_CREATED'): create_action(self.user, 'LOCATION_CREATED') super().save(*args, **kwargs)
def save(self, *args, **kwargs): # pylint: disable=signature-differs log_string = 'Bid {}: deal={} creator={} status={}'.format( 'updated' if self.pk else 'created', str(self.deal), str(self.creator), str(self.status), ) LOGGER.info(log_string) super().save(*args, **kwargs) # TODO: Verbessern, DEAL_FINISHED BID_ANSWERED # if self.status == BidStatus: create_action(self.creator, 'BID_CREATED') self.deal.set_placed()
def get_context_data(self, **kwargs): if self.request.user.is_authenticated: create_action(self.request.user, 'DAILY_VISIT') context = TemplateView.get_context_data(self, **kwargs) user = self.request.user if user.is_authenticated: deals = [] for deal in user.deals: deals.append(deal.set_pov(self.request.user)) context['deals'] = deals context['user_feedback_open'] = user.userfeedback_set.filter( status=0) context['push_feedback_open'] = user.pushfeedback_set.filter( status=0) context['lobby'] = Chat.get_lobby() # context['chat'] = Chat.get_lobby() else: self.template_name = 'dashboard/dashboard_anonymous.html' return context
def save(self, *args, **kwargs): # pylint: disable=signature-differs log_string = 'Listing {}: type={} user={} category={} quantity={}{} status={}'.format( 'updated' if self.pk else 'created', str(self.type), str(self.user), str(self.category), str(self.quantity), str(self.unit.short), str(self.status), ) LOGGER.info(log_string) if self.type == 'push': if not create_action(self.user, 'FIRST_PUSH_CREATED'): create_action(self.user, 'PUSH_CREATED') elif self.type == 'pull': if not create_action(self.user, 'FIRST_PULL_CREATED'): create_action(self.user, 'PULL_CREATED') super().save(*args, **kwargs)
def save(self, *args, **kwargs): # pylint: disable=signature-differs super().save(*args, **kwargs) create_action(self.creator, 'FIRST_CHAT_MESSAGE')
def save(self, *args, **kwargs): super().save(*args, **kwargs) create_action(self.creator, 'PUSH_FEEDBACK_GIVEN') create_action(self.push.user, 'PUSH_FEEDBACK_TAKEN')