Re: Makemigrations and migrate for already existing database

2021-06-04 Thread sourav panja
Have you created a new model field ?
Then put on that  null= "True"

Example ::
Name = Model.CharField(max_legth,* null= "True"*)

On Fri, Jun 4, 2021 at 7:59 PM OSA-33 SyCS Atik Rangnekar <
atikrangneka...@gmail.com> wrote:

> It think the problem is there is null values/bytes
>
> On Fri, 4 Jun, 2021, 6:28 pm Ankita Sharma, 
> wrote:
>
>> Hello All
>> Hope all are doing great.
>> The issue is as follows:
>> I have already existing 2 MSSql databases from which I have migrated
>> required tables into models.py
>> Now I am not able to do makemigrations on one of them. Below is the error:
>>
>> from records.models.transactions_east import AdgSrtransactionsEast
>> ValueError: source code string cannot contain null bytes
>>
>> Please help me here
>>
>> Thanks in advance
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/0528c4a7-36a2-4762-a576-db114c7d445cn%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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CABOD_T69227mDF0abmkiTR_EiEuGTTQ%3D6LhQYoP3yyDOARHsyA%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH2jLM%2BcX8Cfp0ck%3DLXkDf4LWuj0GrK%2BuBodPSgCycvYsVkbCA%40mail.gmail.com.


Re: model configuration

2021-06-04 Thread Mike Dewhirst
FrankYou don't have to import the class for the FK. Instead do a "lazy 
import".That means you just use "appname.Modelname" and Django is smart enough 
to fugure it out.CheersMike--(Unsigned mail from my phone)
 Original message From: frank dilorenzo  
Date: 5/6/21  01:20  (GMT+10:00) To: Django users 
 Subject: Re: model configuration Thank Mike.  I 
am sorry for all this code but I am including it to show the problem I can't 
resolve.  I have 3 apps, shipment, supplier, specie. This is the models for 
them.from django.db import modelsfrom .models import Shipmentfrom django.utils 
import timezone# Create your models here.# A specie can belong to many 
shipmentsclass Specie(models.Model):shipment = 
models.ManyToManyField(Shipment)name = models.CharField(max_length=120, 
null=True)image = models.ImageField(upload_to="species", 
default="no_picture.png")created = 
models.DateTimeField(default=timezone.now)def __str__(self):return 
self.name===from django.db import modelsfrom .models import 
Supplier# Create your models here.# A shipment can have many speciesclass 
Shipment(models.Model):supplier = models.ForeignKey(Supplier, 
on_delete=models.CASCADE)slabel = models.CharField(max_length=10)
received = models.PositiveIntegerField(default=0)bad = 
models.PositiveIntegerField(default=0)non = 
models.PositiveIntegerField(default=0)doa = 
models.PositiveIntegerField(default=0)para = 
models.PositiveIntegerField(default=0)released = 
models.PositiveIntegerField(default=0)entered = 
models.BooleanField(default=False)created = 
models.DateTimeField(auto_now_add=True)def __str__(self):return 
f"{self.slabel}"==from django.db import models# Create your 
models here.# Supplier can have many shipmentsclass Supplier(models.Model):
name = models.CharField(max_length=120, null=True)phone = 
models.CharField(max_length=15, null=True)email = 
models.CharField(max_length=120, null=True)created = 
models.DateTimeField(auto_now_add=True)updated = 
models.DateTimeField(auto_now=True)def __str__(self):return 
self.namethe error I can't resolve is:ImportError: cannot import name 
'Supplier' from partially initialized module 'shipment.models' (most likely due 
to a circular import) 
(/Users/frankd/django_projects/tryit/src/shipment/models.py)thanks again.On 
Thursday, June 3, 2021 at 10:47:07 PM UTC-5 Mike Dewhirst wrote:On 4/06/2021 
1:39 pm, Mike Dewhirst wrote:
> On 4/06/2021 11:34 am, frank dilorenzo wrote:
>> I have the following conditions.
>> A supplier can have many shipments.
>> A shipment can have many species.
>> A shipment can have only one supplier.
>> Species can belong to many shipments.
>
> supplier 1:n shipment
> shipment n:m species

shipment has FK to supplier

species has m2m field with shipment

The latter implements a connecting table between species and shipment 
which can be expanded to carry additional information if you need to 
include anything related to a particular shipment + species

In all this I refer to the word species in its singular sense. E.g., we 
are members of the human species.


>
>>
>> No matter how I try I can't seem to configure the models correctly.  
>> I was hoping someone could help me on this.
>>
>> Thank you.
>> -- 
>> 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/5ea61c33-9f24-470d-8191-177c2e73adf1n%40googlegroups.com
>>  
>> .
>>  
>>
>
>


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.






-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ae4089fd-3499-41e4-8409-1b3a7f83d96dn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/60bad65b.1c69fb81.99f34.a675SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

Re: TypeError: Password must be a string or bytes, got BoundField

2021-06-04 Thread DJANGO DEVELOPER
have you converted your password into hashed? if not then do it by using
set_password.

On Fri, Jun 4, 2021 at 10:29 PM Kasper Laudrup 
wrote:

>
> https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2bd
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/cf6e4a2a-62a3-18b2-d9f4-1c9228a59259%40stacktrace.dk
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKPY9pne3j9CC3cjouZbjemfXOHJhmrVsYxSVd9EH%3DaemNV%3DcQ%40mail.gmail.com.


Re: TypeError: Password must be a string or bytes, got BoundField

2021-06-04 Thread Kasper Laudrup
https://betterprogramming.pub/how-to-ask-questions-about-programming-dcd948fcd2bd

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cf6e4a2a-62a3-18b2-d9f4-1c9228a59259%40stacktrace.dk.


OpenPGP_signature
Description: OpenPGP digital signature


Models Mixin Inherit Many to Many

2021-06-04 Thread sebasti...@gmail.com
Hello,

i need a mixin where i can inherit many to many like this:

mixin.py:

class RightsModelRelation(models.Model):

user_link = models.ForeignKey(User, on_delete=models.CASCADE, 
blank=False, null=False, default=None,
related_name="%(class)s_rights_user")
right_to_view = models.BooleanField(default=True)
right_to_change = models.BooleanField(default=False)
right_to_delete = models.BooleanField(default=False)


class RightsModelMixin(models.Model):
owner = models.ForeignKey(User, on_delete=models.CASCADE, null=False, 
default=None,
  related_name="%(class)s_owner", )
rights_link = models.ManyToManyField(RightsModelRelation, default=None,

 related_name="%(class)s_rights_link")

and in my normal model.py i want:

class Address(RightsModelMixin,models.Model):
lastname = models.CharField(max_length=255, default="", )
firstname = models.CharField(max_length=255, default="", blank=True, 
null=True)


On migrations i get:

You are trying to add a non-nullable field 'rightsmodelmixin_ptr' to 
address without a default; we can't do that (the database needs something 
to populate existing rows).

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5ae24367-e341-4ecc-9d7e-d204d866de6dn%40googlegroups.com.


TypeError: Password must be a string or bytes, got BoundField

2021-06-04 Thread pikasu pikasu
*models.py*
class recruiterLogin(models.Model):

user = models.ForeignKey(User, on_delete=models.CASCADE)
mobile = models.CharField(max_length=15,null=True)
image = models.FileField(null=True)
gender = models.CharField(max_length=10)
type = models.CharField(max_length=15)
def __str__(self):
return self.user.username
-
*Views.py*
def recruiteRegister(request):
error = ""
if request.method == 'POST':
fname = request.POST['firstname'],
lname = request.POST['lastname'],
email = request.POST['email'],
phone = request.POST['phone'],
Pwd = request.POST['password1'],
gender = request.POST['gender'],
img = request.FILES['images'],
userss = User.objects.create_user(first_name=fname,last_name=lname,username=
email,password=Pwd)
recruiterLogin.objects.create(user=userss,mobile=phone,gender=gender,image=
img,type="Recruiter")
userss.save()
return redirect("/")
print("success")
else: 
return render(request, 'recruiteRegister.html')

-
*userform*

{% csrf_token %}
































Gender: 



Male



Female















-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4a5d00c8-9213-4e87-a3a6-d57dc3034e46n%40googlegroups.com.


Re: model configuration

2021-06-04 Thread frank dilorenzo
Thank Mike.  I am sorry for all this code but I am including it to show the 
problem I can't resolve.  I have 3 apps, shipment, supplier, specie. This 
is the models for them.

from django.db import models
from .models import Shipment
from django.utils import timezone

# Create your models here.
# A specie can belong to many shipments
class Specie(models.Model):
shipment = models.ManyToManyField(Shipment)
name = models.CharField(max_length=120, null=True)
image = models.ImageField(upload_to="species", default="no_picture.png")
created = models.DateTimeField(default=timezone.now)

def __str__(self):
return self.name
===

from django.db import models
from .models import Supplier

# Create your models here.
# A shipment can have many species
class Shipment(models.Model):

supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE)
slabel = models.CharField(max_length=10)
received = models.PositiveIntegerField(default=0)
bad = models.PositiveIntegerField(default=0)
non = models.PositiveIntegerField(default=0)
doa = models.PositiveIntegerField(default=0)
para = models.PositiveIntegerField(default=0)
released = models.PositiveIntegerField(default=0)
entered = models.BooleanField(default=False)
created = models.DateTimeField(auto_now_add=True)

def __str__(self):
return f"{self.slabel}"
==

from django.db import models

# Create your models here.

# Supplier can have many shipments
class Supplier(models.Model):
name = models.CharField(max_length=120, null=True)
phone = models.CharField(max_length=15, null=True)
email = models.CharField(max_length=120, null=True)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)

def __str__(self):
return self.name


the error I can't resolve is:
ImportError: cannot import name 'Supplier' from partially initialized 
module 'shipment.models' (most likely due to a circular import) 
(/Users/frankd/django_projects/tryit/src/shipment/models.py)

thanks again.
On Thursday, June 3, 2021 at 10:47:07 PM UTC-5 Mike Dewhirst wrote:

> On 4/06/2021 1:39 pm, Mike Dewhirst wrote:
> > On 4/06/2021 11:34 am, frank dilorenzo wrote:
> >> I have the following conditions.
> >> A supplier can have many shipments.
> >> A shipment can have many species.
> >> A shipment can have only one supplier.
> >> Species can belong to many shipments.
> >
> > supplier 1:n shipment
> > shipment n:m species
>
> shipment has FK to supplier
>
> species has m2m field with shipment
>
> The latter implements a connecting table between species and shipment 
> which can be expanded to carry additional information if you need to 
> include anything related to a particular shipment + species
>
> In all this I refer to the word species in its singular sense. E.g., we 
> are members of the human species.
>
>
> >
> >>
> >> No matter how I try I can't seem to configure the models correctly.  
> >> I was hoping someone could help me on this.
> >>
> >> Thank you.
> >> -- 
> >> 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/5ea61c33-9f24-470d-8191-177c2e73adf1n%40googlegroups.com
>  
> >> <
> https://groups.google.com/d/msgid/django-users/5ea61c33-9f24-470d-8191-177c2e73adf1n%40googlegroups.com?utm_medium=email_source=footer>.
>  
>
> >>
> >
> >
>
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ae4089fd-3499-41e4-8409-1b3a7f83d96dn%40googlegroups.com.


Re: Makemigrations and migrate for already existing database

2021-06-04 Thread OSA-33 SyCS Atik Rangnekar
It think the problem is there is null values/bytes

On Fri, 4 Jun, 2021, 6:28 pm Ankita Sharma, 
wrote:

> Hello All
> Hope all are doing great.
> The issue is as follows:
> I have already existing 2 MSSql databases from which I have migrated
> required tables into models.py
> Now I am not able to do makemigrations on one of them. Below is the error:
>
> from records.models.transactions_east import AdgSrtransactionsEast
> ValueError: source code string cannot contain null bytes
>
> Please help me here
>
> Thanks in advance
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0528c4a7-36a2-4762-a576-db114c7d445cn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABOD_T69227mDF0abmkiTR_EiEuGTTQ%3D6LhQYoP3yyDOARHsyA%40mail.gmail.com.


Re: Makemigrations and migrate for already existing database

2021-06-04 Thread Mahendra
Check the error in Google

Mahendra Yadav

On Fri, 4 Jun 2021, 18:28 Ankita Sharma,  wrote:

> Hello All
> Hope all are doing great.
> The issue is as follows:
> I have already existing 2 MSSql databases from which I have migrated
> required tables into models.py
> Now I am not able to do makemigrations on one of them. Below is the error:
>
> from records.models.transactions_east import AdgSrtransactionsEast
> ValueError: source code string cannot contain null bytes
>
> Please help me here
>
> Thanks in advance
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0528c4a7-36a2-4762-a576-db114c7d445cn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-6G3xNFg%3DGfu%3DZebJsagBhDjOL-UgpN-Tx-kAH9mRNvi2N6Q%40mail.gmail.com.


Re: Makemigrations/migrate in existing database

2021-06-04 Thread Mahendra
I think surely run makemigrations and migrate

Mahendra Yadav

On Fri, 4 Jun 2021, 18:28 Ankita Sharma,  wrote:

> Hello Team
> Hope all are doing great
>
> I have a database in microsoft sql server. I created tables and views in
> it.
>
> I ran py manage.py inspetdb  > Models.py and populated my models.py file .
> I also don't want my model to alter my database. I just want it for data
> retrieval.
>
> *Should I definitely run migrate/makemigrations?*
>
> *After inspectdb should i apply makemigrations on my app or is just
> migrate enough?* And also what are the points to remember while using
> inspectdb on an existing database.
>
> Thanks in advance
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/908ff564-adca-4b64-9ec4-e347a3818efbn%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-6G3ykKx-Ab7qGAHhDL5WXNWL8bSU8_H5Hioypa%2Ba8A8CXzA%40mail.gmail.com.


Makemigrations and migrate for already existing database

2021-06-04 Thread Ankita Sharma
Hello All
Hope all are doing great.
The issue is as follows:
I have already existing 2 MSSql databases from which I have migrated 
required tables into models.py
Now I am not able to do makemigrations on one of them. Below is the error:

from records.models.transactions_east import AdgSrtransactionsEast
ValueError: source code string cannot contain null bytes

Please help me here

Thanks in advance

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0528c4a7-36a2-4762-a576-db114c7d445cn%40googlegroups.com.


Makemigrations/migrate in existing database

2021-06-04 Thread Ankita Sharma


Hello Team
Hope all are doing great

I have a database in microsoft sql server. I created tables and views in it.

I ran py manage.py inspetdb  > Models.py and populated my models.py file . 
I also don't want my model to alter my database. I just want it for data 
retrieval.

*Should I definitely run migrate/makemigrations?*

*After inspectdb should i apply makemigrations on my app or is just migrate 
enough?* And also what are the points to remember while using inspectdb on 
an existing database.

Thanks in advance

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/908ff564-adca-4b64-9ec4-e347a3818efbn%40googlegroups.com.


Re: SVG widget for the Admin

2021-06-04 Thread Mike Dewhirst

On 4/06/2021 5:15 pm, Derek wrote:

Hi Mike

The SVG is not going to display as SVG in a *form* - for that you'd 
need a widget, or perhaps just let users edit the text.


It will always be readonly.  Forever.



Did you try displaying in the normal admin lists? This was my 
understanding of where you wanted to see it and the code snippets I 
posted were for that purpose.


I did try that and it did show the svg image - but that isn't where I 
want it. It needs to be in the Admin displayed form.




If you want to see it as "read only" in the form, but shown as SVG,


but shown as an image

perhaps you need a custom model template 
(https://docs.djangoproject.com/en/dev/ref/contrib/admin/#templates-which-may-be-overridden-per-app-or-model)


I think that's where I need to go. Might be easier than a widget - 
unless someone has built one already?


It would be quite handy to use mark_safe() somewhere ...

Thanks

Mike



Derek


On Thursday, 3 June 2021 at 08:22:57 UTC+2 Mike Dewhirst wrote:

On 3/06/2021 4:00 pm, Derek wrote:
> >
> > E.g.
> >
> > class MyModel():
> >     svg_text = CharField()
>
> in my case it is ...
>
> class Chemical(models.Model):
>     ...
>     ddstructure = models.TextField(
>     null=True,
>     blank=True,
>     verbose_name="2D structure",
>     )
>

The above is unchanged.

# admin
class ChemicalAdmin(admin.ModelAdmin):

    def _ddstructure(self, obj):
        return mark_safe(obj.ddstructure)
    ...
    fieldsets = (
    (
    None,
    {
    "fields": (
    "ddstructure",        # displays svg code
    "_ddstructure",
                    ...
            }
    ),

FYI it works perfectly as a column in the list display - but I don't
need it there, rather in the page for the chemical.

This is what happens if it is included in the fieldsets "fields"
roster.


FieldError at /admin/chemical/chemical/17/change/

Unknown field(s) (_ddstructure) specified for Chemical. Check
fields/fieldsets/exclude attributes of class ChemicalAdmin.

Request Method: GET
Request URL:
http://localhost:8088/admin/chemical/chemical/17/change/

Django Version: 3.2.3
Exception Type: FieldError
Exception Value:

Unknown field(s) (_ddstructure) specified for Chemical. Check
fields/fieldsets/exclude attributes of class ChemicalAdmin.

Exception Location:
D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py,

line 712, in get_form
Python Executable: D:\Users\mike\envs\xxai\Scripts\python.exe
Python Version: 3.8.3


Cheers

Mike


> >
> >     def _the_svg(self):
> >         return """%s""" %
> > self.svg_text
> >         _the_svg.allow_tags = True
>


-- 
Signed email is an absolute defence against phishing. This email has

been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

--
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+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4862b67b-e5e9-40a3-b3aa-1666f4739703n%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ed050bc5--0bba-ef03-eb2a26d71387%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature


Re: Where can I work as a freelancer (Django dev)

2021-06-04 Thread Lutalo Bbosa joseph
please admin add jamex...@gmail.com to this group

On Wed, Jun 2, 2021 at 5:44 PM Gobi Dasu  wrote:

> Hi Allison, Nikola, and others in this group for whom it is relevant.
>
> We'd love to have you join our talent network of software developers, data
> scientists, and designers. Our site is ldtalent.org
>  which has some important FAQs. If you
> are already strong in your stack you will not need to go through our
> vetting / training program. If you could send us your resumé to
> i...@learningdollars.com we can start sending you full-time or contract
> opportunities for your skillset. You can set your own rate. An additional
> perk of LD Talent is that for every skill you learn or passion project you
> do on your own, we'll pay you a financial reward just for learning. We also
> have an LD Ventures program which invests in and supports developers and
> designers launching their own startup ideas as part of LD.
>
> *Regards,*
> *Gobi Dasu*  (calendar
> )
> *Stanford CS **·* *Northwestern HCI*
> *LD Talent  *(demo
> )
>
>
> On Tue, Jun 1, 2021 at 5:28 PM Allison Tretina 
> wrote:
>
>> I found someone who needed a project and asked them if they’d write me a
>> recommendation on completion. Then, I’ve charged a bit for the second
>> project. I’ve had to go to clients. Small businesses. They’ve never come to
>> me, at least not yet. I served the website on my Raspberry Pi and charged
>> for hosting the server and made a bit of money. Users are key. They are the
>> goal.
>>
>> On Tuesday, June 1, 2021, Nikola Pavlovic 
>> wrote:
>>
>>> Hello, I've been learning *Django* for *1 year*. I've made *2 personal
>>> projects* for *practice*. But, I'm not *friendly* with the *freelancing
>>> process* on the *internet* *yet*.
>>> *Any suggestions. Where should I begin?*
>>>
>>> --
>>> 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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/d05b3b84-781b-4087-aa20-6bae43665d77n%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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAJrG93DvzqZpT428muNSdhdSn1Y0H2f_QnarnaARBq4FvQh7rg%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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMk8evk39aZXdgkgequUrfkxO1DyRr_7-HxJAURrKfdpTKuxmw%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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMz%3Dh%3DQa_WkGzfj2jm5RUO4zBR2T2mr%2BquB_kZ9M%2BJkEbJ%2BFSA%40mail.gmail.com.


Re: In immediate help of a long time pending request, kindly help.

2021-06-04 Thread Aritra Ray
Hello

I tried this but I'm still seeing the list of cart items. Can you tell me
where I am going wrong?

Regards,
Aritra

On Tue, 1 Jun 2021 at 21:23, Joel Tanko <7thog...@gmail.com> wrote:

> If you want to show the items relative to the currently logged in user,
> try adding this option => limit_choices_to={'user' : 'user'}, to your items
> field in models.py
>
>
>
> On Tuesday, 1 June 2021, Aritra Ray  wrote:
>
>> Right, thank you so much.
>>
>> Regards.
>>
>> On Tue, 1 Jun, 2021, 8:27 pm oba stephen,  wrote:
>>
>>> You should return this if you want to redirect to cart;
>>>
>>> return redirect(reverse("store:cart-page", kwargs={"id": >> cart>}))
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 3:27 PM Aritra Ray  wrote:
>>>
 Sure, here's the file.

 [image: 2021-06-01 (6).png]

 Regards,
 Aritra.

 On Tue, 1 Jun 2021 at 19:45, oba stephen  wrote:

> Can I see your urls.py?
>
> Best regards
>
> Stephen Oba
>
> On Tue, Jun 1, 2021, 3:05 PM Aritra Ray  wrote:
>
>> Oh, okay. I was unaware of that. Although, my cart page is getting
>> redirected back to home page. Can you spot any mistake in the provided
>> screenshots?
>> Also, can you please guide on how to redirect a function to the
>> previously visited page? Like add-to-cart should redirect to either
>> products page or cart page itself depending on which page the user called
>> it from.
>>
>> On Tue, 1 Jun, 2021, 6:37 pm oba stephen, 
>> wrote:
>>
>>> Hi,
>>>
>>> I don't think you have an error here. Although I haven't looked at
>>> the code, but from your django admin page I can see that none of those
>>> items are selected.
>>>
>>> If you run a query from your terminal, you would notice that the
>>> items would return as empty.
>>>
>>> When you create a many to many relationship in django, all objects
>>> on that related model would display this way.
>>>
>>> What is the difference between different carts?  The difference is,
>>> the items would be selected or highlighted in a cart they belong to.
>>>
>>> Regards
>>>
>>> Best regards
>>>
>>> Stephen Oba
>>>
>>> On Tue, Jun 1, 2021, 1:52 PM Aritra Ray  wrote:
>>>

 Hello,
 This is Aritra reposting the same error. I have a problem regarding
 an E-commerce Django website where the cart model on the admin page is
 showing the items added to cart by one user to all other users as well.
 I have a Profile model and a Cart model attached below. The
 views.py has been attached too. Kindly comment back if anything else is
 needed.
 Thanks in advance.


 Regards,
 Aritra

 Error:

 [image: 2021-06-01 (4).png]

 Views.py

 [image: 2021-06-01 (1).png][image: 2021-06-01 (5).png]

 Models.py

 [image: 2021-06-01 (2).png][image: 2021-06-01 (3).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+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/CAFecadtNZeLbatpdnuC_RUDdjLjbrvZTO%2BMVD7hPuHNkN%2Bv%2BBA%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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAAJsLnpYBVfacxd3NJ7sqnC6dD2b6nBQw%3DFqfQe9Od1%2BpwTHww%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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAFecadvZ11v-bvZzCXUVUTpr0WBa6eVmF7M6qpoVRFNF5dS%2Bcg%40mail.gmail.com
>> 
>> .
>>
> --

Re: SVG widget for the Admin

2021-06-04 Thread Derek
Hi Mike

The SVG is not going to display as SVG in a *form* - for that you'd need a 
widget, or perhaps just let users edit the text.

Did you try displaying in the normal admin lists? This was my understanding 
of where you wanted to see it and the code snippets I posted were for that 
purpose.

If you want to see it as "read only" in the form, but shown as SVG, perhaps 
you need a custom model template 
(https://docs.djangoproject.com/en/dev/ref/contrib/admin/#templates-which-may-be-overridden-per-app-or-model)

Derek


On Thursday, 3 June 2021 at 08:22:57 UTC+2 Mike Dewhirst wrote:

> On 3/06/2021 4:00 pm, Derek wrote:
> > >
> > > E.g.
> > >
> > > class MyModel():
> > > svg_text = CharField()
> >
> > in my case it is ...
> >
> > class Chemical(models.Model):
> > ...
> > ddstructure = models.TextField(
> > null=True,
> > blank=True,
> > verbose_name="2D structure",
> > )
> >
>
> The above is unchanged.
>
> # admin
> class ChemicalAdmin(admin.ModelAdmin):
>
> def _ddstructure(self, obj):
> return mark_safe(obj.ddstructure)
> ...
> fieldsets = (
> (
> None,
> {
> "fields": (
> "ddstructure",# displays svg code
> "_ddstructure",
> ...
> }
> ),
>
> FYI it works perfectly as a column in the list display - but I don't 
> need it there, rather in the page for the chemical.
>
> This is what happens if it is included in the fieldsets "fields" roster.
>
>
> FieldError at /admin/chemical/chemical/17/change/
>
> Unknown field(s) (_ddstructure) specified for Chemical. Check 
> fields/fieldsets/exclude attributes of class ChemicalAdmin.
>
> Request Method: GET
> Request URL: http://localhost:8088/admin/chemical/chemical/17/change/
> Django Version: 3.2.3
> Exception Type: FieldError
> Exception Value: 
>
> Unknown field(s) (_ddstructure) specified for Chemical. Check 
> fields/fieldsets/exclude attributes of class ChemicalAdmin.
>
> Exception Location: 
> D:\Users\mike\envs\xxai\lib\site-packages\django\contrib\admin\options.py, 
> line 712, in get_form
> Python Executable: D:\Users\mike\envs\xxai\Scripts\python.exe
> Python Version: 3.8.3
>
>
> Cheers
>
> Mike
>
>
> > >
> > > def _the_svg(self):
> > > return """%s""" %
> > > self.svg_text
> > > _the_svg.allow_tags = True
> >
>
>
> -- 
> Signed email is an absolute defence against phishing. This email has
> been signed with my private key. If you import my public key you can
> automatically decrypt my signature and be sure it came from me. Just
> ask and I'll send it to you. Your email software can handle signing.
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4862b67b-e5e9-40a3-b3aa-1666f4739703n%40googlegroups.com.


Re: Support for moving a model between two Django apps #24686

2021-06-04 Thread Mike Dewhirst

On 4/06/2021 2:28 pm, lalit suthar wrote:
We had a similar problem and we resolved it by moving all the models 
into a separate internal python package.
We can have a separate app in our django project also for writing 
models only and all other apps import models from there.


Interesting.

What does the main menu of the Admin look like?




On Friday, 4 June 2021 at 06:07:53 UTC+5:30 Mike Dewhirst wrote:

I can see a ticket https://code.djangoproject.com/ticket/24686
 which
would likely solve my current need to merge two apps.

Is the code OK to try out?

Happy to test it.

Cheers

Mike

-- 
Signed email is an absolute defence against phishing. This email has

been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27fb1633-e8be-43e1-b92e-f92409347731n%40googlegroups.com 
.



--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bf3f0499-21e8-3a05-3c01-6c02d2b7b603%40dewhirst.com.au.


OpenPGP_signature
Description: OpenPGP digital signature