Friday, October 29, 2021

Hi, i had question in django rest framework

Hello I am a backend developer who is developing python django.
I sent you an e-mail because I had a question.
Currently, my company provides web services using pure django.
As the company grew bigger and bigger,
the direction of development was decided through api communication by separating the front and backend from one django project,
and we are trying to proceed with api communication using the django rest framework.
At this time, do I have to pay the usage fee when I want to develop it using the django rest framework for commercial purposes in the project currently being serviced by the company?
Or if you can use it without paying the usage fee, do you have to disclose the source or any restrictions under the license?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ffda96a9-7ef1-4318-b895-aa4d5e61d80dn%40googlegroups.com.

Thursday, October 28, 2021

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases


Annotation 2021-10-29 081743.png

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f7d8a010-0f68-437c-b3df-ec99a4460aafn%40googlegroups.com.

Recognize Tags in templates

Good morning,

Hello Everybody,

I use the tags to templates but it is being recognized for Server to show content



Please Help me.

Greetings,

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/427f3c64-923a-4d31-89ed-17a5d9536eb8n%40googlegroups.com.

Wednesday, October 27, 2021

Re: facing problems while deploying the project some error with static files

-----BEGIN PGP PUBLIC KEY BLOCK-----

xsDNBGBJfrABDACxIFOMQIsP94wTkgf76JEHyTITmYnprsTeRmDet01G5etZ9ZHmRmrqYVFzXu1a
SBbaejm/ppbRrBB7YmFETbpnZepWJnuhridvjV37duRH3g/9ppiytNkhOOIYA/l8ppvyaRlrp/jP
jAm27HVxi1Nu0syaWwTFKbUTtLKldIhuWvAXkgx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HZBHO6KilQ+QLzSektD8IpHM7tR6P+5PP6AQ==
=NePe
-----END PGP PUBLIC KEY BLOCK-----On 27/10/2021 12.51, 'Mr. Aryan Sharma 4-Year B.Tech. Computer Science
and Engineering' via Django users wrote:
> i am using heroku
>

You are probably doing something wrong. Try to do things correctly
instead and see if that doesn't solve your problems.

Kind regards,

Kasper Laudrup

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2731da45-a49a-409a-5b8f-e6f11dcd5cac%40stacktrace.dk.

Tuesday, October 26, 2021

Re: Modeform Foreign key column not working

Hi,

I am trying to save the model form and getting error that foreign key column is not there. 

Error:
column "connection_type_id" of relation "connection_details_test" does not exist ( There is no column connection_type_id, why its looking for this column, should I change my model?)

Models:
======

class ConnectionTypes(models.Model):
      connection_type_id models.IntegerField(primary_key=True,default=re_sequence('connection_type_seq'))
      connection_type_name = models.CharField(max_length=100)
      connection_type_desc = models.CharField(max_length=300)
      connection_type_category = models.CharField(max_length=100)
      last_update_date = models.DateTimeField(default=dbcurr_ts)

      class Meta: 
            managed = False
            db_table ='connection_types_test'
            verbose_name = 'connection_types_test'
            verbose_name_plural = 'connection_types_test'

      def __str__(self):
        return str(self.connection_type_id)
    


class ConnectionDetails(models.Model):
      connection_id = models.IntegerField(primary_key=True,default=re_sequence('connection_seq'))
      connection_name = models.CharField(max_length=200)
      connection_type = models.ForeignKey(ConnectionTypes, on_delete=models.CASCADE)
      endpoint = models.CharField(max_length=100)
      port = models.IntegerField()
      login_id = models.CharField(max_length=100)
      login_password = fields.CharPGPPublicKeyField(max_length=100)
      connection_string_1 = fields.CharPGPPublicKeyField(max_length=100)
      connection_string_2 = fields.CharPGPPublicKeyField(max_length=100)
      connection_string_3 = fields.CharPGPPublicKeyField(max_length=100)
      aws_region = models.CharField(max_length=20)
      owner_id = models.IntegerField()
      last_update_date = models.DateTimeField(default=dbcurr_ts)
      working_schema = models.CharField(max_length=100)
      service = models.CharField(max_length=100)

      def generate_enc(mystrenc):
          return 'pass'

      class Meta:
            managed = False
            db_table = 'connection_details_test'
            verbose_name = 'connection_details_test'
            verbose_name_plural = 'connection_details_test'

Model Form :
==========

class ConnectionForm(forms.ModelForm):

    login_password = forms.CharField(widget=forms.PasswordInput())
    owner_id = forms.IntegerField(widget=forms.HiddenInput(), required=False)
    
    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


View.py
======
def addconnection(request):
    connectionform = ConnectionForm(request.POST or None)
    if connectionform.is_valid():
        ownerqs = AuthUser.objects.values('id').get(username = request.user.username)
        connectionform.cleaned_data['owner_id'] = int(ownerqs['id'])
        connectionform.save()
        messages.success(request, f"sucess!")
    else:
        messages.success(request, f"Failure!")
    return render(request,'main/ssaddconnection.html',{"cform":
    connectionform,"CanUseMod":UserModules.objects.filter(user_id=request.user.id).filter(module_id=1).count(),"UserIsAuth":request.user.is_authenticated})
    
Anyone can help me on this??

Thanks,
Aruna 
On Saturday, 23 October 2021 at 18:53:38 UTC+1 sutharl...@gmail.com wrote:
cool! mention not :)

On Thu, 21 Oct 2021 at 19:57, Aruna Priya Nagarajan <arunapriya...@gmail.com> wrote:

yeah, it is a foreign key and I have put integer field instead of foreign key in the model. I changed it now and its working by itself without specifying ModelChoiceField. 

Thanks for your help!! 


On Wednesday, 20 October 2021 at 16:07:04 UTC+1 sutharl...@gmail.com wrote:
is `ConnectionTypes` a foreign key to `ConnectionDetails`?
in that case you don't need to put it as a field in form, it will be added automatically in the form. 
On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:
Hi,

I am trying to create a form from model and the model has a foreign key and am not able to populate the values from the column it refers to.

My form,

class ConnectionForm(forms.ModelForm):
 connection_type = forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), to_field_name='connection_type_id')

    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ddb8c862-57fc-4bb0-97a0-f5c235b00a1fn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3000878a-cc44-4fd9-9c2b-2f72ce85d664n%40googlegroups.com.

Saturday, October 23, 2021

Re: Modeform Foreign key column not working

cool! mention not :)

On Thu, 21 Oct 2021 at 19:57, Aruna Priya Nagarajan <arunapriya.nagarajan@gmail.com> wrote:

yeah, it is a foreign key and I have put integer field instead of foreign key in the model. I changed it now and its working by itself without specifying ModelChoiceField. 

Thanks for your help!! 


On Wednesday, 20 October 2021 at 16:07:04 UTC+1 sutharl...@gmail.com wrote:
is `ConnectionTypes` a foreign key to `ConnectionDetails`?
in that case you don't need to put it as a field in form, it will be added automatically in the form. 
On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:
Hi,

I am trying to create a form from model and the model has a foreign key and am not able to populate the values from the column it refers to.

My form,

class ConnectionForm(forms.ModelForm):
 connection_type = forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), to_field_name='connection_type_id')

    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ddb8c862-57fc-4bb0-97a0-f5c235b00a1fn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGp2JVFY3%2BjW1CPPMbsoGwbeVOb8kjUy8rRjTpapCQWoe3N4Gw%40mail.gmail.com.

Thursday, October 21, 2021

Re: Modeform Foreign key column not working


yeah, it is a foreign key and I have put integer field instead of foreign key in the model. I changed it now and its working by itself without specifying ModelChoiceField. 

Thanks for your help!! 


On Wednesday, 20 October 2021 at 16:07:04 UTC+1 sutharl...@gmail.com wrote:
is `ConnectionTypes` a foreign key to `ConnectionDetails`?
in that case you don't need to put it as a field in form, it will be added automatically in the form. 
On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:
Hi,

I am trying to create a form from model and the model has a foreign key and am not able to populate the values from the column it refers to.

My form,

class ConnectionForm(forms.ModelForm):
 connection_type = forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), to_field_name='connection_type_id')

    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ddb8c862-57fc-4bb0-97a0-f5c235b00a1fn%40googlegroups.com.

Wednesday, October 20, 2021

Re: django datatable


hey this is my code



On Wed, Oct 20, 2021 at 11:09 PM Lakshyaraj Dash X-D 25 <dashlakshyaraj2006@gmail.com> wrote:
You can use tailwind css, material ui, bootstrap or if you want to use custom css, just inspect the element and target the id of the element and add custom css.

On Wed, Oct 20, 2021, 11:26 Eugene TUYIZERE <eugenetuyizere@gmail.com> wrote:
Please suggest a good CSS  for the datatable below

Regards, 

--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF7qQgBySne3sGL6iqMn-424c2p-9uO8X80%3D2iPNJqY_gWgU5Q%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHJxyjbUA3dH2yJT%3DPS%2BKZuxLTKeXC6z_cUCJG0cBgpGTVqcig%40mail.gmail.com.

Re: django datatable

You can use tailwind css, material ui, bootstrap or if you want to use custom css, just inspect the element and target the id of the element and add custom css.

On Wed, Oct 20, 2021, 11:26 Eugene TUYIZERE <eugenetuyizere@gmail.com> wrote:
Please suggest a good CSS  for the datatable below

Regards, 

--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF7qQgBySne3sGL6iqMn-424c2p-9uO8X80%3D2iPNJqY_gWgU5Q%40mail.gmail.com.

Re: Modeform Foreign key column not working

is `ConnectionTypes` a foreign key to `ConnectionDetails`?
in that case you don't need to put it as a field in form, it will be added automatically in the form. 
On Wednesday, 20 October 2021 at 18:47:44 UTC+5:30 Aruna Priya wrote:
Hi,

I am trying to create a form from model and the model has a foreign key and am not able to populate the values from the column it refers to.

My form,

class ConnectionForm(forms.ModelForm):
 connection_type = forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), to_field_name='connection_type_id')

    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e4b14379-40de-4ea2-8e2c-960448bb8cdfn%40googlegroups.com.

Re: django datatable

you can try bootstrap also

On Wed, 20 Oct 2021 at 12:46, Abhishek Choudhury <choudhuryabhishek76@gmail.com> wrote:
Hi, 

You can use Tailwind CSS and it will significantly improve the UI. 


Thanks and regards, 
Abhishek Choudhury 


On Wed, 20 Oct 2021 at 11:26 AM, Eugene TUYIZERE <eugenetuyizere@gmail.com> wrote:
Please suggest a good CSS  for the datatable below

Regards, 


--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.
--
Thanks and regards,
Abhishek Choudhury
Mobile: +91 7903717967

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B3kJUbpfhoMvbQvO51NtUEKszJCzkfV%3DKSUQ2LhejLA0w6Zqw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAGp2JVHBzAyabU5pH7yvPfyrk9WpM5%2BT7NtJkdWubjn6WyUR%2Bw%40mail.gmail.com.

Modeform Foreign key column not working

Hi,

I am trying to create a form from model and the model has a foreign key and am not able to populate the values from the column it refers to.

My form,

class ConnectionForm(forms.ModelForm):
 connection_type = forms.ModelChoiceField(queryset=ConnectionTypes.objects.all(), to_field_name='connection_type_id')

    class Meta:
        model = ConnectionDetails
        exclude = ['connection_id','last_update_date']


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f5145780-1a87-451a-a0a3-8f100527499an%40googlegroups.com.

Re: django datatable

Hi, 

You can use Tailwind CSS and it will significantly improve the UI. 


Thanks and regards, 
Abhishek Choudhury 


On Wed, 20 Oct 2021 at 11:26 AM, Eugene TUYIZERE <eugenetuyizere@gmail.com> wrote:
Please suggest a good CSS  for the datatable below

Regards, 


--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.
--
Thanks and regards,
Abhishek Choudhury
Mobile: +91 7903717967

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B3kJUbpfhoMvbQvO51NtUEKszJCzkfV%3DKSUQ2LhejLA0w6Zqw%40mail.gmail.com.

Tuesday, October 19, 2021

django datatable

Please suggest a good CSS  for the datatable below

Regards, 

--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHvN2XvzwQ0V4swjK1JD8MwY6Rq9tN8uUuqOpZFaqdjHdQ%40mail.gmail.com.

Re: DJNAGO Many to Many field MultiSelect Into DropdownList

It is not working with SelectMultiple. I can select multiple values but it is not showing any drop down.

On Mon, 18 Oct 2021 at 16:07, Sebastian Jung <sebastian.jung2@gmail.com> wrote:
Hello,

then change in widgets Select() to SelectMultiple().


Regards

Am Mo., 18. Okt. 2021 um 15:51 Uhr schrieb 'Maryam Yousaf' via Django users <django-users@googlegroups.com>:
Hi,  

I have one manytomany field in one of my model which is currently coming as Multiselect but I need a dropdown where user can select multiple values as I have huge data to show.

I am trying this in forms.py but it is not showing dropdown field.

Kindly help me out.

Model.py:

class Chain(models.Model):
chain_id = models.AutoField(primary_key=True)
chain_name = models.CharField(max_length=255, unique=True)
chain_type = models.ForeignKey(ChainType, on_delete=models.CASCADE)
history = HistoricalRecords()

def __str__(self):
return self.chain_name

class Meta:
ordering = ('chain_name',)


class Brg(models.Model):
brg_campaign_id = models.AutoField(primary_key=True)
campaign_tracking = models.ForeignKey(CampaignTracking, on_delete=models.CASCADE)
brg_name = models.ForeignKey(Chain, on_delete=models.CASCADE, related_name="primary_brg",
help_text='Add Brgs/chain names for these above campaign has run')
brg_benchmark = models.ManyToManyField(Chain, related_name="competitor_brg", null=True,
blank=True, help_text='Add max.5 other benchmarks brgs to check overall impact')
history = HistoricalRecords()

def __str__(self):
return "Brg names list"

class Meta:
verbose_name = 'Brg Campaign Tracking'

forms.py:
class ChainForm(forms.ModelForm):
class Meta:
model: Chain
# fields = ('campaign_tracking', 'brg_name', 'brg_benchmark',)
widgets = {
'chain_name': Select(),
}

Regards,
maryam



This email and any files transmitted with it contain confidential information and/or privileged or personal advice. This email is intended for the addressee(s) stated above only. If you are not the addressee of the email please do not copy or forward it or otherwise use it or any part of it in any form whatsoever. If you have received this email in error please notify the sender and remove the e-mail from your system. Thank you.

This is an email from the company Just Eat Takeaway.com N.V., a public limited liability company with corporate seat in Amsterdam, the Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam, registered with the Dutch Chamber of Commerce with number 08142836 and where the context requires, includes its subsidiaries and associated undertakings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ac59ba2a-5baa-4302-88c9-0dd17606fdaen%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9mwXNTc2638qv-vScbHZW2uRq3utmu%2BbfM5Mz06WERmt2g%40mail.gmail.com.



This email and any files transmitted with it contain confidential information and/or privileged or personal advice. This email is intended for the addressee(s) stated above only. If you are not the addressee of the email please do not copy or forward it or otherwise use it or any part of it in any form whatsoever. If you have received this email in error please notify the sender and remove the e-mail from your system. Thank you.

This is an email from the company Just Eat Takeaway.com N.V., a public limited liability company with corporate seat in Amsterdam, the Netherlands, and address at Oosterdoksstraat 80, 1011 DK Amsterdam, registered with the Dutch Chamber of Commerce with number 08142836 and where the context requires, includes its subsidiaries and associated undertakings.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAACfofuYyZDnYYQQqCrNjjZwo0bGiuFQsqFt-PHO3bEtXDsPmA%40mail.gmail.com.

Monday, October 18, 2021

Custom User error

Saludos, me estoy iniciando en el mundo de django y tengo algunos problemas con un usuario personalizado, para el registro de usuarios a la base de datos, el ejemplo que tengo funciona al 100% con el usuario que viene por defecto me permite renderizar el formulario de registro de usuario sin ningún inconveniente, pero cuando creo un usuario personalizado la misma pantalla para el registro ya no funciona para mí, ya no funciona para mí, he leído mucho de la web pero nada funciona para mí. Debería ser algo muy simple, pero no puedo encontrar lo que debo hacer.

Para realizar el cambio a un usuario personalizado, borra la base de datos y la migración que tuve para crear una base de datos limpia con el nuevo modelo, pero no he podido hacerlo.

models.py
desde django.contrib.auth.models importar AbstractUser


clase UserProfile (AbstractBaseUser, PermissionsMixin):
# plantilla de tabla para usuarios de inicio de sesión del sistema con correo electrónico
correo electrónico = modelos. EmailField (max_length = 255, unique = True, verbose_name = 'E-mail')
nombre = modelos. CharField (max_length = 200)
is_active = modelos. BooleanField (predeterminado = Verdadero)
is_staff = modelos. BooleanField (predeterminado = False)


views.py

desde .forms importar UserProfile


def record (solicitud):
datos = {
'formulario': UserProfile ()
    }
form = UserProfile (datos = solicitud. POST)
si form.is_valid ():
        form.save ()
#authentic a la vez
usuario = autenticar (nombre de usuario = form.cleaned_data ["correo electrónico"], contraseña = form.cleaned_data ["contraseña1"])
# Inicio sesión aquí
login (solicitud, usuario)
#redirect inicio
messages.success (solicitud, "Registrado correctamente")
redirigir de retorno (a = "inicio")
data ["form"] = formulario
devolución (solicitud, 'registro / registro.html', datos)


setting.py
AUTH_USER_MODEL = 'perfiles. UserProfile'
Repito con el modelo de usuario que viene por defecto de django, funciona al 100%

Al ejecutar el servidor me arroja este error
TypeError at / record /
UserProfile () obtuvo un argumento de palabra clave inesperado 'data'

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/020aaad4-5595-4dfd-94d6-60d05d08d47an%40googlegroups.com.

Sunday, October 17, 2021

Edit data from django-ajax-datatable

Dear Team,

I am using django-ajax-datatable and I have this:


The Edit button is added from server side as follow: 
def customize_row(self, row, obj):
row['edit'] = """
<a href="#" class="btn btn-success btn-edit"
onclick="var id=this.closest('tr').id.substr(4); alert('Editing Input number: ' + id); return false;">
Edit
</a>
"""

the table itself is rendered to html from:

<script language="javascript">

$(document).ready(function() {
AjaxDatatableViewUtils.initialize_table(
$('#datatable_membership'),
"{% url 'ajax_datatable_membership' %}",
{
// extra_options (example)
processing: true,
autoWidth: false,
full_row_select: true,
scrollX: false
}, {
// extra_data

},
);

});

</script>

when you click the edit button there is an alert showing the ID of the record.

Then, from the code above, what can I do such that when I click on the Edit button the new window of the clicked ID is showing out so that I can edit the record? 


Thank you for the help

regards, 
--
Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHsm%3DBM%3DL%2B5fX1a09Ew8O0nqyYGBh%2BeAFQuALBpgtPMqfA%40mail.gmail.com.

Wednesday, October 13, 2021

Re: Child data table in Django

Dear Sebstian,

Thank you for your email. Frankly speaking I do not have the code for that kind of table. I used to use the usual datatable but now I want to implement the one with child row as the image I attached previously.

Regards, 

On Wed, 13 Oct 2021 at 15:30, Sebastian Jung <sebastian.jung2@gmail.com> wrote:
Hello eugene,

You have implement also jquery >= 3.5.1 and datatablea.min.js

Please show us your html code and javascript code that open row when you click on this item...

Regards

Eugene TUYIZERE <eugenetuyizere@gmail.com> schrieb am Mi., 13. Okt. 2021, 14:05:
Dear All,

Kindly assist me to have a tutorial or code to make this kind of table in django. I failed to do this from the datatable .net tutorial.


regards, 

--
 Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHuY_zoSvcwQL79UPts6g%3DmJRD%3DO_B%2Bc5%3DvinOtPKNLFLw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9mxwBrDNvAGSqXkoXhKkvaNowY45LiCWgLzWxgiytJPZbw%40mail.gmail.com.


--
TUYIZERE Eugene

Msc Degree in Mathematical Science

African Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, Cameroon


Bsc in Computer Science

UR-Nyagatare Campus

Email: eugene.tuyizere@aims-cameroon.org
           eugenetuyizere@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHupRhi6z8KH%2BrT5hapSfa3hRSV%2B7NsTf7cA9KAkb4TmiA%40mail.gmail.com.

Re: Child data table in Django

Hello eugene,

You have implement also jquery >= 3.5.1 and datatablea.min.js

Please show us your html code and javascript code that open row when you click on this item...

Regards

Eugene TUYIZERE <eugenetuyizere@gmail.com> schrieb am Mi., 13. Okt. 2021, 14:05:
Dear All,

Kindly assist me to have a tutorial or code to make this kind of table in django. I failed to do this from the datatable .net tutorial.


regards, 

--
 Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHuY_zoSvcwQL79UPts6g%3DmJRD%3DO_B%2Bc5%3DvinOtPKNLFLw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKGT9mxwBrDNvAGSqXkoXhKkvaNowY45LiCWgLzWxgiytJPZbw%40mail.gmail.com.

Re: Child data table in Django

I want to make the same as this below but using django. That is what I want. The data are in one table but display shows child table 


any one help please

On Wed, 13 Oct 2021 at 14:28, Ammar Mohammed <amarben1000@gmail.com> wrote:
Hello Dear

You can use djangos prefetch_related in the docs :

prefetch_related()

prefetch_related(*lookups)

Returns a QuerySet that will automatically retrieve, in a single batch, related objects for each of the specified lookups.

This has a similar purpose to select_related, in that both are designed to stop the deluge of database queries that is caused by accessing related objects, but the strategy is quite different.

select_related works by creating an SQL join and including the fields of the related object in the SELECT statement. For this reason, select_related gets the related objects in the same database query. However, to avoid the much larger result set that would result from joining across a 'many' relationship, select_related is limited to single-valued relationships - foreign key and one-to-one.

prefetch_related, on the other hand, does a separate lookup for each relationship, and does the 'joining' in Python. This allows it to prefetch many-to-many and many-to-one objects, which cannot be done using select_related, in addition to the foreign key and one-to-one relationships that are supported by select_related. It also supports prefetching of GenericRelation and GenericForeignKey, however, it must be restricted to a homogeneous set of results. For example, prefetching objects referenced by a GenericForeignKey is only supported if the query is restricted to one ContentType.

For example, suppose you have these models:

from django.db import models    class Topping(models.Model):      name = models.CharField(max_length=30)    class Pizza(models.Model):      name = models.CharField(max_length=50)      toppings = models.ManyToManyField(Topping)        def __str__(self):              # __unicode__ on Python 2          return "%s (%s)" % (              self.name,              ", ".join(topping.name for topping in self.toppings.all()),          )  

and run:


On Wed, 13 Oct 2021, 2:06 PM Eugene TUYIZERE, <eugenetuyizere@gmail.com> wrote:
Dear All,

Kindly assist me to have a tutorial or code to make this kind of table in django. I failed to do this from the datatable .net tutorial.


regards, 

--
 Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHuY_zoSvcwQL79UPts6g%3DmJRD%3DO_B%2Bc5%3DvinOtPKNLFLw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHs1H7vL%3Dzawt%2BqPiBU1qrZojSLpdjZuMWYiWT3jic-8dZfTEw%40mail.gmail.com.


--
TUYIZERE Eugene

Msc Degree in Mathematical Science

African Institute for Mathematical Sciences (AIMS Cameroon)
Crystal Garden-Lime, Cameroon


Bsc in Computer Science

UR-Nyagatare Campus

Email: eugene.tuyizere@aims-cameroon.org
           eugenetuyizere@gmail.com

Tel: (+250) 7 88 26 33 38, (+250) 7 22 26 33 38

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHtwZg6JVSMa4Gbc%2B2cb1obRNs5mxsX95qghNAsM23%2B%2BUg%40mail.gmail.com.

Re: Child data table in Django

Hello Dear

You can use djangos prefetch_related in the docs :

prefetch_related()

prefetch_related(*lookups)

Returns a QuerySet that will automatically retrieve, in a single batch, related objects for each of the specified lookups.

This has a similar purpose to select_related, in that both are designed to stop the deluge of database queries that is caused by accessing related objects, but the strategy is quite different.

select_related works by creating an SQL join and including the fields of the related object in the SELECT statement. For this reason, select_related gets the related objects in the same database query. However, to avoid the much larger result set that would result from joining across a 'many' relationship, select_related is limited to single-valued relationships - foreign key and one-to-one.

prefetch_related, on the other hand, does a separate lookup for each relationship, and does the 'joining' in Python. This allows it to prefetch many-to-many and many-to-one objects, which cannot be done using select_related, in addition to the foreign key and one-to-one relationships that are supported by select_related. It also supports prefetching of GenericRelation and GenericForeignKey, however, it must be restricted to a homogeneous set of results. For example, prefetching objects referenced by a GenericForeignKey is only supported if the query is restricted to one ContentType.

For example, suppose you have these models:

from django.db import models    class Topping(models.Model):      name = models.CharField(max_length=30)    class Pizza(models.Model):      name = models.CharField(max_length=50)      toppings = models.ManyToManyField(Topping)        def __str__(self):              # __unicode__ on Python 2          return "%s (%s)" % (              self.name,              ", ".join(topping.name for topping in self.toppings.all()),          )  

and run:


On Wed, 13 Oct 2021, 2:06 PM Eugene TUYIZERE, <eugenetuyizere@gmail.com> wrote:
Dear All,

Kindly assist me to have a tutorial or code to make this kind of table in django. I failed to do this from the datatable .net tutorial.


regards, 

--
 Eugene

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABxpZHuY_zoSvcwQL79UPts6g%3DmJRD%3DO_B%2Bc5%3DvinOtPKNLFLw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHs1H7vL%3Dzawt%2BqPiBU1qrZojSLpdjZuMWYiWT3jic-8dZfTEw%40mail.gmail.com.