Re: Using JavaScript to enumerate a dataset returned to a page.

2023-06-19 Thread Robin Riis
With vanilla js for(let i = 1; i < myArray.length; i += 1) { document.log("index: " + i); document.log(myArray[i] + "\n"); } Wrote this on my phone so may contain some fault, but a for-loop is sufficent. On Mon, Jun 19, 2023, 16:29 Lee Stevens wrote: > Helo, > > I have a dataset return

Re: Question re: input

2023-04-01 Thread Robin Riis
You can check out rabbitMQ if it can fit your needs. Theres a plugin in django that simplifies integration. On Sat, Apr 1, 2023, 19:06 o1bigtenor wrote: > On Sat, Apr 1, 2023 at 9:51 AM Robin Riis wrote: > > > > What kind of environment are we talking about? > >

Re: Question re: input

2023-04-01 Thread Robin Riis
What kind of environment are we talking about? But i guess you mean that you have a server in one location and multiple clients from diffrent locations that should be able to upload some kind of data to the server. SSH is great to connect to a remote machine in a secure manner. And scp to send fi

Re: How to approach

2021-11-04 Thread Robin Riis
i agree with kasper, but one tip is to start with the user class. check out django.contrib.auth.base_user Den tors 4 nov. 2021 kl 18:36 skrev Kasper Laudrup : > On 04/11/2021 14.54, Trippy Samurai wrote: > > Hi there, > > I am new to django and have a problem statement am not quite sure how to >

models

2019-05-07 Thread Robin Riis
if i have a model like class ShelfManager(models.Manager): use_for_related_fields = True def create_cabinet(self, name, number_of_shelfs): cabinet = self.create(name=name, number_of_shelfs=number_of_shelfs) created_shelfs = 0 while created_shelfs < number_of_shelfs: cabinet.shelfs.create()

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
) cheers mate Den fre 26 apr. 2019 kl 14:05 skrev Soumen Khatua : > Okay,Could you tell me If any user want to update their comment it later > the process is same or different? > > Thank You > > > On Fri, Apr 26, 2019 at 5:31 PM Robin Riis wrote: > >> class

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
7;m new to django so let me check once. > Thank You for your response. > > On Fri, Apr 26, 2019 at 4:36 PM Robin Riis wrote: > >> class Comment(models.Model): >> >> message = models.TextField() >> >> video = models.ForeignKey(Video, related_nam

Re: Comment Form Related issue

2019-04-26 Thread Robin Riis
class Comment(models.Model): message = models.TextField() video = models.ForeignKey(Video, related_name='comments', on_delete=models.CASCADE) created_at = models.DateTimeField(auto_now_add=True) created_by = models.ForeignKey(get_user_model(), related_name='comments', on_delete=models.CASCADE)

m2m createview bootstrap modal

2019-04-25 Thread Robin Riis
Hello Django community :D i am currently learning django and am working on a vehicle app where i currently have this models.py class Engine(models.Model): objects = EngineManager() manufacture = models.CharField(max_length=80) name = models.CharField(max_length=80) filter_to_use =

Re: How to run ORM commands from DOM Javascript?

2019-04-09 Thread Robin Riis
in models.py you can define a 'as_json' function def as_json(self): return dict( identification_number = self.id awesome_picture = self.picture ) in views.py: class My_View(View): def get(self, request): if request.is_ajax(): q = request.GET.get('q

Re: UniqueConstraint raises uncaught IntegrityError in Admin

2019-04-09 Thread Robin Riis
The Integrity error means that there is a row in the database with role = 1 So another row with role=1 would break the unique constraint and is not allowed. So either remove the unique constraint or make sure it will be unique. Den tis 9 apr. 2019 13:29Ryan Jarvis skrev: > Hey there, > > I'm tr

Re: how do I create a slug in Django 2.2

2019-04-09 Thread Robin Riis
def save(self, *args, **kwargs): self.slug = slugify(self.title) super(name, self).save(*args, **kwargs) Den tis 9 apr. 2019 12:24AMI FIDELE skrev: > I have tried to create a slug watch here and please tell the problem > > this is model.py > > from django.db import models > > # this is m

Re: HTML form filled, proposes a download link for the data filled in a json file

2019-04-09 Thread Robin Riis
Hello! well in the form is there anything that will be saved in a database? if so you can start by looking at models.py in your application. if not you can jump directly to forms.py. an example of a model and form: *** in models.py from django.db import models class Company(models.Model):

[formset] ManyToMany

2019-04-09 Thread Robin Riis
if i have the following models: class Wiggs_Filter(models.Model): wiggs_nr = models.CharField(max_length=30, unique=True, blank=True, null=True) picture = models.ImageField(upload_to='filter/', default='filter/saknas.jpg') description = models.CharField(max_length=100, blank=True, null

Re: How to use updated model.py from the shell

2019-03-31 Thread Robin Riis
Just re import and redeclare the variable? from app import model x = thing.objects.all() Den sön 31 mars 2019 16:46Betty skrev: > Hi all, > > I am new to django and following tutorials. > > I realized that even if I modified models.py while I was using > shell(python manage.py shell) the modif

Re: ModuleNotFoundError: No module named 'sample,'

2019-03-07 Thread Robin Riis
from .models import Sample Den tors 7 mars 2019 10:44 skrev: > Hi Team > > My project name is Sample > While I am trying to connect database with models.py > I am finding these type of errors > ModuleNotFoundError: No module named 'sample,' > Can anybody help me. > > -- > You received this messa

Re: default groups and permissions

2019-01-08 Thread Robin Riis
x Nebojsa! but could you please show me a full example? Den måndag 7 januari 2019 kl. 13:18:37 UTC+1 skrev Nebojsa: > > you can do it from views.py inside signup function > if Försäljningschef > then if exist() sign there, if not create that group. > > I will be at home in few hours s

default groups and permissions

2019-01-06 Thread Robin Riis
i have a custom user model that i want to have 4 default groups depending on job title. this is my model.py 1 from django.contrib.auth.models import AbstractUser, UserManager, PermissionsMixin 2 from django.db import models 3 4 class WiggenUserManager(UserManager): 5 pass 6 7